/* ==========================================================================
   admin.css - Painel Administrativo CMS Alex Faria
   Tema: Deep Noir & Champagne Gold Luxury Suite
   ========================================================================== */

:root {
  --admin-bg: #09080c;
  --admin-surface: #121116;
  --admin-surface-card: #18171f;
  --admin-surface-hover: #22202a;
  --admin-border: rgba(203, 163, 88, 0.22);
  --admin-border-focus: #cba358;
  --admin-gold: #cba358;
  --admin-gold-light: #e8d3a2;
  --admin-gold-glow: rgba(203, 163, 88, 0.28);
  --admin-text: #faf8f5;
  --admin-text-muted: #a6a099;
  --admin-danger: #e05252;
  --admin-success: #4ec985;
  --font-display: "Bebas Neue", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.admin-body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   1. TELA DE AUTENTICAÇÃO / BLOQUEIO POR PIN
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(203, 163, 88, 0.15) 0%, transparent 60%),
    rgba(9, 8, 12, 0.96);
  backdrop-filter: blur(14px);
  transition: opacity 300ms ease, visibility 300ms ease;
}

.auth-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 44px 36px;
  background: var(--admin-surface-card);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 35px var(--admin-gold-glow);
  text-align: center;
}

.auth-brand__eyebrow {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--admin-gold-light);
  margin-bottom: 8px;
}

.auth-brand__title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  letter-spacing: 0.04em;
  line-height: 0.95;
  color: var(--admin-text);
  margin-bottom: 8px;
}

.auth-brand__subtitle {
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  margin-bottom: 32px;
}

.auth-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--admin-text-muted);
  margin-bottom: 10px;
}

.auth-input-wrapper {
  margin-bottom: 16px;
}

.auth-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  color: var(--admin-text);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.3em;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--admin-border-focus);
  box-shadow: 0 0 0 3px var(--admin-gold-glow);
}

.auth-error {
  min-height: 20px;
  font-size: 0.82rem;
  color: var(--admin-danger);
  margin-bottom: 16px;
}

.auth-hint {
  margin-top: 22px;
  font-size: 0.76rem;
  color: var(--admin-text-muted);
}

.auth-hint strong {
  color: var(--admin-gold-light);
}

/* ==========================================================================
   2. LAYOUT DO PAINEL CMS (Topbar + Sidebar + Main)
   ========================================================================== */
.admin-layout {
  display: grid;
  grid-template-rows: 64px 1fr;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

/* Topbar */
.admin-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 8px;
}

.admin-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--admin-text);
  margin: 5px 0;
  transition: transform 200ms ease;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-brand__title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.05em;
  color: var(--admin-text);
  line-height: 1;
}

.admin-brand__badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--admin-gold-light);
  background: rgba(203, 163, 88, 0.12);
  border: 1px solid var(--admin-border);
  padding: 2px 8px;
  border-radius: 999px;
}

.admin-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--admin-text-muted);
}

.admin-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--admin-success);
  box-shadow: 0 0 10px var(--admin-success);
}

.admin-status.is-saving .admin-status__dot {
  background: var(--admin-gold);
  box-shadow: 0 0 10px var(--admin-gold);
}

.admin-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Sidebar */
.admin-sidebar {
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  overflow-y: auto;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}

.admin-nav__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--admin-gold-light);
  padding: 0 12px;
  margin-bottom: 8px;
}

.admin-nav__link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 180ms ease;
}

.admin-nav__link:hover {
  color: var(--admin-text);
  background: rgba(255, 255, 255, 0.04);
}

.admin-nav__link.is-active {
  color: var(--admin-text);
  background: rgba(203, 163, 88, 0.12);
  border-color: var(--admin-border);
  font-weight: 600;
}

.admin-nav__icon {
  font-size: 1.1rem;
}

.admin-info-badge {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 0.74rem;
}

.admin-info-badge__title {
  display: block;
  font-weight: 600;
  color: var(--admin-gold-light);
}

.admin-info-badge__desc {
  color: var(--admin-text-muted);
}

/* Área Principal */
.admin-main {
  padding: 34px 40px 60px;
  overflow-y: auto;
}

.admin-container {
  max-width: 980px;
  margin: 0 auto;
}

.admin-pane {
  display: none;
}

.admin-pane.is-active {
  display: block;
  animation: fadeIn 220ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.pane-header__actions {
  display: flex;
  gap: 10px;
}

.pane-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--admin-gold-light);
  margin-bottom: 6px;
}

.pane-title {
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--admin-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.pane-description {
  font-size: 0.88rem;
  color: var(--admin-text-muted);
  margin-top: 6px;
  max-width: 620px;
}

/* ==========================================================================
   3. COMPONENTES DE FORMULÁRIO E CARDS
   ========================================================================== */
.admin-card {
  background: var(--admin-surface-card);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 8px;
}

.form-sublabel {
  display: block;
  font-size: 0.74rem;
  color: var(--admin-text-muted);
  margin-bottom: 4px;
}

.form-helper {
  font-size: 0.72rem;
  color: var(--admin-text-muted);
  margin-top: 5px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--admin-border-focus);
  box-shadow: 0 0 0 2px var(--admin-gold-glow);
}

.title-lines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

/* ==========================================================================
   4. EDITOR RICHTEXT & MOTOR DE CORREÇÃO AUTOMÁTICA
   ========================================================================== */
.richtext-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.richtext-container:focus-within {
  border-color: var(--admin-border-focus);
  box-shadow: 0 0 0 2px var(--admin-gold-glow);
}

.richtext-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--admin-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.richtext-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--admin-text-muted);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 140ms ease;
}

.richtext-toolbar button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--admin-text);
}

.richtext-toolbar button.btn-accent-style {
  color: var(--admin-gold-light);
  font-weight: 600;
  background: rgba(203, 163, 88, 0.12);
  border-color: rgba(203, 163, 88, 0.25);
}

.richtext-toolbar button.btn-accent-style:hover {
  background: rgba(203, 163, 88, 0.25);
}

.richtext-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

.richtext-editor {
  min-height: 110px;
  padding: 16px;
  color: var(--admin-text);
  font-size: 0.92rem;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
}

.richtext-editor:empty::before {
  content: "Digite ou cole o texto aqui...";
  color: rgba(255, 255, 255, 0.3);
}

/* Estilos de Destaque no Editor */
.richtext-editor .hero__title-accent,
.richtext-editor .access__title-accent,
.richtext-editor .gold-accent {
  color: var(--admin-gold-light);
  font-style: italic;
  font-weight: 600;
}

/* Barra de Ações do Corretor */
.corrector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(18, 17, 22, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
}

.corrector-actions {
  display: flex;
  gap: 8px;
}

.btn-autofix,
.btn-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 160ms ease;
}

.btn-autofix {
  background: rgba(203, 163, 88, 0.18);
  color: var(--admin-gold-light);
  border-color: rgba(203, 163, 88, 0.35);
}

.btn-autofix:hover {
  background: rgba(203, 163, 88, 0.3);
  box-shadow: 0 0 10px var(--admin-gold-glow);
}

.btn-check {
  background: rgba(255, 255, 255, 0.06);
  color: var(--admin-text-muted);
}

.btn-check:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--admin-text);
}

.corrector-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--admin-text-muted);
}

.metric-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.metric-status.is-clean {
  background: rgba(78, 201, 133, 0.12);
  color: var(--admin-success);
}

.metric-status.has-issues {
  background: rgba(203, 163, 88, 0.18);
  color: var(--admin-gold-light);
}

/* Painel com Detalhes das Correções */
.corrector-panel {
  padding: 12px 16px;
  background: rgba(14, 13, 18, 0.95);
  border-top: 1px solid rgba(203, 163, 88, 0.2);
  font-size: 0.8rem;
}

.corrector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.corrector-item:last-child {
  border-bottom: 0;
}

.corrector-item__badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.corrector-item__badge--spelling {
  background: rgba(224, 82, 82, 0.18);
  color: var(--admin-danger);
}

.corrector-item__badge--tone {
  background: rgba(203, 163, 88, 0.18);
  color: var(--admin-gold-light);
}

.corrector-item__text {
  flex: 1;
  color: var(--admin-text-muted);
}

.corrector-item__text strong {
  color: var(--admin-text);
}

.btn-apply-fix {
  background: transparent;
  border: 1px solid var(--admin-border);
  color: var(--admin-gold-light);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
}

.btn-apply-fix:hover {
  background: var(--admin-gold);
  color: #000;
}

/* ==========================================================================
   5. REPEATERS & CARDS DE ESPECIALIDADES
   ========================================================================== */
.specialties-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.specialty-item-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.specialty-item-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.specialty-item-card__badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--admin-gold-light);
}

.btn-item-delete {
  background: transparent;
  border: 0;
  color: var(--admin-danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-item-delete:hover {
  background: rgba(224, 82, 82, 0.15);
}

/* FAQ Accordion no Admin */
.faq-admin-item {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 14px;
}

.faq-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ==========================================================================
   6. BOTÕES & TOASTS
   ========================================================================== */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 160ms ease;
  border: 1px solid transparent;
}

.admin-btn--sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.admin-btn--icon {
  padding: 8px;
  background: transparent;
  color: var(--admin-text-muted);
}

.admin-btn--icon:hover {
  color: var(--admin-text);
  background: rgba(255, 255, 255, 0.06);
}

.admin-btn--gold {
  background: linear-gradient(135deg, var(--admin-gold) 0%, var(--admin-gold-light) 100%);
  color: #0d0c10;
  box-shadow: 0 4px 14px rgba(203, 163, 88, 0.3);
}

.admin-btn--gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(203, 163, 88, 0.45);
}

.admin-btn--outline {
  background: transparent;
  border-color: var(--admin-border);
  color: var(--admin-gold-light);
}

.admin-btn--outline:hover {
  background: rgba(203, 163, 88, 0.1);
  border-color: var(--admin-border-focus);
}

.admin-btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--admin-text);
}

.admin-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.admin-btn--danger {
  background: rgba(224, 82, 82, 0.15);
  border-color: var(--admin-danger);
  color: var(--admin-danger);
}

.admin-btn--danger:hover {
  background: var(--admin-danger);
  color: #fff;
}

.admin-btn--full {
  width: 100%;
}

/* Modais */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.admin-modal__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 580px;
  background: var(--admin-surface-card);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  padding: 28px;
}

.admin-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.admin-modal__title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--admin-text);
}

.admin-modal__close {
  background: transparent;
  border: 0;
  color: var(--admin-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.backup-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.backup-box {
  padding: 18px;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.backup-box h4 {
  font-size: 0.95rem;
  color: var(--admin-gold-light);
  margin-bottom: 6px;
}

.backup-box p {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  margin-bottom: 14px;
}

.backup-danger-zone {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.backup-danger-zone h4 {
  color: var(--admin-danger);
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.backup-danger-zone p {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  margin-bottom: 12px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  background: var(--admin-surface-card);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideUp 200ms ease;
}

.toast--success {
  border-color: var(--admin-success);
}

.toast--error {
  border-color: var(--admin-danger);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   7. RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    top: 64px;
    left: -280px;
    width: 270px;
    z-index: 90;
    transition: left 240ms ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
  }

  .admin-sidebar.is-open {
    left: 0;
  }

  .admin-nav-toggle {
    display: block;
  }

  .admin-main {
    padding: 24px 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .backup-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   BARRA DE AÇÕES INFERIOR DA PÁGINA / SEÇÃO
   ========================================================================== */
.pane-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
  padding: 18px 22px;
  background: rgba(22, 22, 27, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.pane-save-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--admin-text-muted);
}

.pane-save-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}
