@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import 'sweetalert2/dist/sweetalert2.min.css';

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important;
  margin: 0;
  background: #f5f5f5;
}

#root {
  min-height: 100vh;
}

.admin-menu-toggle {
  display: none;
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  color: #0f172a;
  align-items: center;
  justify-content: center;
}

.admin-sidebar-backdrop {
  display: none;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  background: #161c24;
  color: #fff;
  min-height: 100vh;
  width: 260px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  z-index: 20;
}

.admin-sidebar a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  margin: 2px 12px;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.admin-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-main {
  flex: 1;
  padding: 24px;
  background: #f5f5f5;
}

@media (max-width: 768px) {
  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: admin-fade-in 0.2s ease;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    max-width: 85vw;
    min-height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: none;
  }

  .admin-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .admin-sidebar > div:first-child {
    min-height: 56px;
  }

  .admin-main {
    padding: 16px;
  }

  .admin-menu-toggle {
    display: inline-flex;
  }
}

/* Pages list – modern card grid */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.page-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  gap: 20px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.page-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.page-card__title {
  font-weight: 600;
  font-size: 17px;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 8px;
}

.page-card__slug {
  font-size: 13px;
  color: #64748b;
  font-family: ui-monospace, monospace;
  margin: 0;
}

.page-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.page-card__status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
}

.page-card__status--published {
  background: #dcfce7;
  color: #166534;
}

.page-card__status--draft {
  background: #f1f5f9;
  color: #475569;
}

.page-card__status--archived {
  background: #fef3c7;
  color: #92400e;
}

.page-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}

.page-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.page-card__btn--primary {
  background: #0f172a;
  color: #fff;
}

.page-card__btn--primary:hover {
  background: #1e293b;
}

.page-card__btn--danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.page-card__btn--danger:hover {
  background: #fef2f2;
}

.page-card__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Page editor – responsive */
.page-editor-root {
  min-height: 100vh;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
}

.page-editor-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-editor-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-editor-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 48px;
  box-sizing: border-box;
}

.page-editor-form-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 24px;
}

.page-editor-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.page-editor-form-field {
  flex: 1 1 220px;
  min-width: 0;
}

.page-editor-form-field--status {
  flex: 0 0 auto;
}

.page-editor-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.page-editor-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 8px;
}

.page-editor-section-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-editor-section-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-editor-section-slots {
  padding: 16px;
  display: grid;
  gap: 16px;
}

.page-editor-slot {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  min-width: 0;
}

.page-editor-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 8px;
}

.page-editor-block-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-editor-add-section-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.page-editor-sections-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 88px;
}

.page-editor-section-insert {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.page-editor-section-insert-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.page-editor-section-insert-btn:hover {
  background: #fff;
  border-color: #94a3b8;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.page-editor-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
}

.page-editor-fab-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.page-editor-fab-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.32);
}

.page-editor-add-modal-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .page-editor-section-slots {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .page-editor-header {
    padding: 10px 16px;
  }

  .page-editor-main {
    padding: 24px 16px 32px;
  }

  .page-editor-form-card {
    padding: 20px 16px;
  }

  .page-editor-form-row {
    gap: 16px;
  }

  .page-editor-form-field,
  .page-editor-form-field--status {
    flex: 1 1 100%;
    min-width: 0;
  }

  .page-editor-section-slots {
    grid-template-columns: 1fr !important;
    padding: 12px;
  }

  .page-editor-section-row {
    padding: 10px 12px;
  }

  .page-editor-section-row-label span {
    font-size: 12px;
  }

  .page-editor-block-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-editor-block-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .page-editor-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .page-editor-header-actions button {
    min-width: 0;
    padding: 8px 12px;
    font-size: 12px;
  }

  .page-editor-fab {
    right: 16px;
    bottom: 16px;
  }

  .page-editor-fab-btn {
    padding: 12px 16px;
    font-size: 13px;
  }
}

@keyframes admin-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* SweetAlert2 — Orion admin theme */
.orion-swal-popup {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important;
  border-radius: 16px !important;
  padding: 28px 28px 24px !important;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(15, 23, 42, 0.08) !important;
  border: 1px solid #e2e8f0 !important;
  width: min(420px, calc(100vw - 32px)) !important;
}

.orion-swal-title {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em !important;
  padding: 0 !important;
}

.orion-swal-text {
  font-size: 0.9375rem !important;
  line-height: 1.55 !important;
  color: #475569 !important;
  margin-top: 0.5rem !important;
}

.orion-swal-icon {
  margin: 0.25rem auto 0.75rem !important;
  border-width: 3px !important;
}

.orion-swal-icon.swal2-warning {
  border-color: #f59e0b !important;
  color: #d97706 !important;
}

.orion-swal-icon.swal2-success {
  border-color: #22c55e !important;
}

.orion-swal-icon.swal2-error {
  border-color: #ef4444 !important;
}

.orion-swal-actions {
  gap: 10px !important;
  margin-top: 1.5rem !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
}

.orion-swal-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 112px !important;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  cursor: pointer !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.orion-swal-btn:focus-visible {
  outline: 2px solid #161c24 !important;
  outline-offset: 2px !important;
}

.orion-swal-btn--secondary {
  background: #fff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

.orion-swal-btn--secondary:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
}

.orion-swal-btn--danger {
  background: #dc2626 !important;
  color: #fff !important;
  border: 1px solid #dc2626 !important;
}

.orion-swal-btn--danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}

.orion-swal-btn--danger:active {
  background: #991b1b !important;
}

.orion-swal-btn:disabled,
.orion-swal-btn.swal2-loading {
  opacity: 0.72 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.orion-swal-loader {
  border-color: #161c24 transparent #161c24 transparent !important;
}

.swal2-container.orion-swal-container {
  z-index: 10050 !important;
}

@media (max-width: 480px) {
  .orion-swal-popup {
    padding: 24px 20px 20px !important;
  }

  .orion-swal-actions {
    flex-direction: column-reverse !important;
    width: 100% !important;
  }

  .orion-swal-btn {
    width: 100% !important;
  }
}
