/* --- Site-Editor Header: 3-Zonen-Grid --- */

.ax-site-editor-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ax-site-editor-header__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

/* --- Publish-Widget --- */

.ax-publish-widget--boxed {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ax-r-md);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.ax-btn--workflow {
  white-space: nowrap;
  min-width: 82px;
  padding: 6px 12px;
  text-align: center;
  font-size: 13px;
}

.ax-btn--workflow:disabled {
  opacity: 0.25;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* --- Page-Editor: Content-Editor Nav (Vorschau + Zurück ohne Publish-Widget) --- */

.ax-page-editor-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* --- Draft-Modus: Option D (gelbe Border + Badge) --- */

.ax-view--site-editor.is-draft,
.ax-view--page-editor.is-draft {
  border: 2px solid #eab308;
}

.ax-badge--draft {
  display: inline-block;
  background: #eab308;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* --- Page-Create collapsible --- */

.ax-page-create-form--collapsible[hidden] {
  display: none;
}

.ax-page-create-form--collapsible {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ax-site-editor {
  padding-top: 10px;
}

.ax-site-editor-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.ax-site-editor-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ax-r-md);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ax-site-editor-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ax-site-editor-panel__head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ax-site-editor-panel__head h3 {
  margin: 0;
  font-size: 14px;
}

/* Spaltenüberschriften */
.ax-site-editor-panel__columns {
  display: grid;
  gap: 10px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.45;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ax-page-card-columns {
  grid-template-columns: 20px 1fr minmax(200px, 260px) auto;
}

.ax-nav-card-columns {
  grid-template-columns: 20px minmax(120px, 1fr) minmax(120px, 1fr) auto;
}

.ax-editor-context-form {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-items: end;
  width: 100%;
}

.ax-editor-context-form .ax-select {
  width: 100%;
  min-width: 0;
}

/* --- Context Wizard --- */

.ax-context-wizard__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ax-context-wizard__action {
  align-self: end;
}

.ax-context-wizard__action .ax-btn {
  white-space: nowrap;
}

/* #10: Visueller Container um Wizard-Form */
.ax-context-wizard--boxed {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ax-r-md);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px 12px;
}

/* #6: Konsistentes Disabled-Styling */
.ax-context-wizard .ax-select:disabled,
.ax-context-wizard__action .ax-btn:disabled {
  opacity: var(--ax-disabled-opacity, 0.4);
  cursor: not-allowed;
}

/* Wizard locked im Draft-Mode */
.ax-context-wizard.is-locked {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Scope-Summary (Draft-Mode Wizard-Ersatz) --- */

.ax-scope-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 6px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ax-r-md);
  background: rgba(255, 255, 255, 0.02);
  width: 100%;
}

.ax-scope-summary--draft {
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.06);
}

.ax-scope-summary__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ax-scope-summary__item .ax-small {
  font-size: 11px;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ax-scope-summary__item strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* #1: Loading-Animation fuer AJAX-Kaskade */
.ax-select.is-loading {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'/%3E%3Cpath d='M12 2a10 10 0 0 1 10 10' fill='none' stroke='rgba(255,255,255,0.9)' stroke-width='2' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
}

/* #6: Einheitliches Disabled-Styling fuer Struktur-Inputs */
.ax-site-editor .ax-input:disabled,
.ax-site-editor .ax-select:disabled,
.ax-site-editor .ax-btn:disabled,
.ax-page-structure .ax-input:disabled,
.ax-page-structure .ax-select:disabled,
.ax-page-structure .ax-btn:disabled {
  opacity: var(--ax-disabled-opacity, 0.4);
  cursor: not-allowed;
}

.ax-page-create-form {
  padding: 12px 14px 0;
}

.ax-page-create-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.3fr 1fr auto;
}

.ax-sort-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  max-height: 60vh;
  overflow-y: auto;
}

.ax-sort-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 67px;
}

.ax-sort-card[draggable="true"] {
  cursor: grab;
}

.ax-sort-card.is-dragging {
  opacity: 0.55;
}

.ax-sort-card__handle {
  user-select: none;
  font-size: 16px;
  line-height: 1;
  width: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  cursor: grab;
}

.ax-sort-card__handle--hidden {
  visibility: hidden;
}

.ax-page-card {
  grid-template-columns: 20px 1fr minmax(200px, 260px) auto;
}

.ax-page-card__title {
  font-weight: 600;
}

.ax-page-card__path {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.9;
}

.ax-page-card__slug {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.ax-page-card__slug .ax-btn--sm {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
}

.ax-page-card__slug .ax-btn[hidden] {
  display: none;
}

.ax-page-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.ax-nav-card {
  grid-template-columns: 20px minmax(120px, 1fr) minmax(120px, 1fr) auto;
}

.ax-nav-card.is-missing {
  opacity: 0.7;
}

.ax-site-editor-nav-actions {
  padding: 0 16px 16px;
  justify-content: flex-end;
}

/* #11: Sort-Buttons (Tastatur-Alternative) */
.ax-btn--icon {
  min-width: 28px;
  padding: 6px 6px;
  font-size: 13px;
  line-height: 1;
  text-align: center;
}

/* #7: Scope-Banner */
.ax-scope-banner {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--ax-r-sm, 4px);
  margin-top: 4px;
}

.ax-scope-banner--global {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: rgba(255, 255, 255, 0.85);
}

.ax-scope-banner--unit {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: rgba(255, 255, 255, 0.85);
}

/* #5: Undo-Toast */
.ax-undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--ax-r-md, 8px);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 9000;
  animation: ax-toast-in 0.25s ease-out;
}

.ax-undo-toast__btn {
  font-weight: 600;
  color: var(--ax-color-primary, #3b82f6);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  text-decoration: underline;
}

@keyframes ax-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* #3: Screenreader-only */
.ax-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ADR-063: Seitenliste (my-pages) */
.ax-my-pages {
  padding: 12px 14px 14px;
}

.ax-my-pages-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ax-my-pages-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ax-r-md, 8px);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s;
}

.ax-my-pages-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.ax-my-pages-card__title {
  font-weight: 600;
  font-size: 15px;
}

.ax-my-pages-card__path {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.7;
}

/* Unabhängige Scrollbars für Seitenstruktur + Katalog */
.ax-page-structure-column {
  max-height: 75vh;
  overflow-y: auto;
}

/* ADR-063: Page-Editor Light-Modus */
.ax-view--page-editor.is-content-editor-only .ax-page-structure-column--right,
.ax-view--page-editor.is-content-editor-only .ax-page-structure-create-section {
  display: none;
}

.ax-view--page-editor.is-content-editor-only .ax-page-structure-layout {
  grid-template-columns: 1fr;
}

.ax-sort-card.is-hidden {
  display: none;
}

@media (max-width: 1200px) {
  .ax-site-editor-header {
    grid-template-columns: 1fr;
  }

  .ax-publish-widget--boxed {
    justify-content: center;
  }

  .ax-site-editor-grid {
    grid-template-columns: 1fr;
  }

  .ax-editor-context-form {
    grid-template-columns: 1fr;
    width: min(400px, 100%);
  }

  .ax-scope-summary {
    grid-template-columns: 1fr 1fr;
    width: min(400px, 100%);
  }

  .ax-site-editor-panel__columns {
    display: none;
  }

  .ax-page-card {
    grid-template-columns: 20px 1fr;
  }

  .ax-page-card__slug,
  .ax-page-card__actions {
    grid-column: 1 / -1;
  }

  .ax-nav-card {
    grid-template-columns: auto 1fr;
  }

  .ax-nav-card .ax-select,
  .ax-nav-card [data-nav-remove] {
    grid-column: 1 / -1;
  }

  .ax-page-create-fields {
    grid-template-columns: 1fr;
  }
}

[data-theme="light"] .ax-site-editor-panel,
[data-theme="light"] .ax-sort-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ax-sort-card__handle {
  color: rgba(0, 0, 0, 0.45);
}

[data-theme="light"] .ax-context-wizard--boxed,
[data-theme="light"] .ax-publish-widget--boxed {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ax-site-editor-header {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ax-btn--workflow:disabled {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .ax-scope-summary {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ax-scope-summary--draft {
  border-color: rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.08);
}

[data-theme="light"] .ax-scope-summary__item .ax-small {
  color: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .ax-site-editor-panel__columns {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ax-page-create-form--collapsible {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .ax-scope-banner--global {
  background: rgba(59, 130, 246, 0.08);
  color: rgba(0, 0, 0, 0.75);
}

[data-theme="light"] .ax-scope-banner--unit {
  background: rgba(34, 197, 94, 0.08);
  color: rgba(0, 0, 0, 0.75);
}

[data-theme="light"] .ax-undo-toast {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.85);
}

[data-theme="light"] .ax-my-pages-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ax-my-pages-card:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .ax-select.is-loading {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='rgba(0,0,0,0.2)' stroke-width='2'/%3E%3Cpath d='M12 2a10 10 0 0 1 10 10' fill='none' stroke='rgba(0,0,0,0.6)' stroke-width='2' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
}

/* --- Draft-Banner (Soft-Lock + Resume) --- */

.ax-draft-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid;
}

.ax-draft-banner--locked {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--ax-color-text, #e2e8f0);
}

.ax-draft-banner__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.ax-draft-banner__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.875rem;
  line-height: 1.4;
}

.ax-draft-banner__text strong {
  display: block;
}

.ax-draft-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

/* Light-Theme Overrides */
[data-theme="light"] .ax-draft-banner--locked {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #78350f;
}

/* --- Übernahme-Dialog --- */

.ax-takeover-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.ax-takeover-modal__box {
  background: var(--ax-color-surface, #1e293b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ax-r-lg, 10px);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ax-takeover-modal__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.ax-takeover-modal__body {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ax-color-text-muted, #94a3b8);
}

.ax-takeover-modal__warning {
  font-size: 0.8rem;
  color: #f59e0b;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.ax-takeover-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

[data-theme="light"] .ax-takeover-modal__box {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .ax-takeover-modal__body {
  color: #475569;
}
