/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL — Pr. Elton Pinto
   Tema: Navy + Gold (consistente com o site principal)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Raleway:wght@300;400;500;600;700&display=swap');

/* ── RESET / BASE ── */
.admin-body {
  margin: 0; padding: 0;
  font-family: 'Raleway', sans-serif;
  background: #f4f3f0;
  color: #2a2520;
}

/* ═══════════ LOGIN ═══════════ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #071330 0%, #1D2846 60%, #2a3a5c 100%);
  padding: 24px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.3);
  text-align: center;
}

.login-logo { margin-bottom: 32px; }
.login-logo img {
  height: 90px; display: inline-block;
  filter: invert(1) sepia(1) saturate(2) hue-rotate(15deg) brightness(0.7);
}

.login-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem; font-weight: 600;
  color: #1D2846; margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.85rem; color: #888; margin-bottom: 32px;
}

.login-form { text-align: left; }

.form-group { margin-bottom: 0; }

.form-label {
  display: block; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: #555; margin-bottom: 8px;
}

.form-input {
  width: 100%; padding: 12px 16px; border: 1.5px solid #ddd;
  border-radius: 6px; font-family: 'Raleway', sans-serif;
  font-size: 0.95rem; color: #2a2520;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa; box-sizing: border-box;
}

.form-input:focus {
  outline: none; border-color: #C8A96E;
  box-shadow: 0 0 0 3px rgba(200,169,110,0.15);
  background: #fff;
}

.form-textarea {
  width: 100%; padding: 12px 16px; border: 1.5px solid #ddd;
  border-radius: 6px; font-family: 'Lora', serif;
  font-size: 0.9rem; color: #2a2520; line-height: 1.7;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa; box-sizing: border-box;
  resize: vertical; min-height: 120px;
}

.form-textarea:focus {
  outline: none; border-color: #C8A96E;
  box-shadow: 0 0 0 3px rgba(200,169,110,0.15);
  background: #fff;
}

.form-hint {
  display: block; font-size: 0.75rem; color: #999;
  margin-top: 6px;
}

.password-wrapper { position: relative; }

.password-wrapper .form-input { padding-right: 44px; }

.toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #aaa; padding: 4px; display: flex; align-items: center;
  transition: color 0.2s;
}
.toggle-pw:hover { color: #C8A96E; }

.login-error {
  background: #ffeaea; border: 1px solid #ffbcbc;
  color: #c0392b; border-radius: 6px;
  padding: 10px 14px; font-size: 0.82rem;
  margin: 12px 0;
}

.login-btn {
  width: 100%; justify-content: center; margin-top: 20px;
  padding: 14px; font-size: 0.9rem; letter-spacing: 1px;
}

.login-hint {
  font-size: 0.72rem; color: #bbb; margin-top: 20px;
}
.login-hint code {
  background: #f0ede8; padding: 2px 6px; border-radius: 3px;
  font-size: 0.7rem; color: #888;
}

/* ═══════════ LAYOUT ADMIN ═══════════ */
.admin-app {
  display: flex; min-height: 100vh;
}

/* ── SIDEBAR ── */
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: #1D2846;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(200,169,110,0.15);
}

.sidebar-logo__img {
  height: 70px; display: block;
}

.sidebar-nav {
  flex: 1; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
}

.sidebar-nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 6px;
  font-size: 0.82rem; font-weight: 500; letter-spacing: 0.3px;
  color: rgba(255,255,255,0.65); text-decoration: none;
  cursor: pointer; transition: all 0.2s;
  border: none; background: none; width: 100%; text-align: left;
}

.sidebar-nav__item:hover {
  background: rgba(200,169,110,0.1);
  color: #C8A96E;
}

.sidebar-nav__item.active {
  background: rgba(200,169,110,0.15);
  color: #C8A96E;
  font-weight: 600;
}

.sidebar-nav__item svg { flex-shrink: 0; opacity: 0.8; }
.sidebar-nav__item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(200,169,110,0.1);
  display: flex; flex-direction: column; gap: 4px;
}

.sidebar-logout { color: rgba(255,100,100,0.7) !important; }
.sidebar-logout:hover {
  background: rgba(255,100,100,0.08) !important;
  color: #ff6b6b !important;
}

/* ── MAIN ── */
.admin-main {
  margin-left: 240px;
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

.admin-topbar {
  background: #fff; padding: 20px 32px;
  border-bottom: 1px solid #e8e5e0;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.admin-page-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem; font-weight: 600;
  color: #1D2846; margin: 0;
}

.admin-page-sub {
  font-size: 0.8rem; color: #999; margin: 2px 0 0;
}

.admin-topbar-right { display: flex; align-items: center; gap: 16px; }

.admin-status-badge {
  display: flex; align-items: center; gap: 8px;
  background: #f8f6f3; border: 1px solid #e0dbd3;
  padding: 6px 14px; border-radius: 20px;
  font-size: 0.78rem; color: #555; font-weight: 500;
}

.badge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ddd; flex-shrink: 0;
}
.badge-dot.active { background: #27ae60; box-shadow: 0 0 0 3px rgba(39,174,96,0.2); }
.badge-dot.empty { background: #e0a020; }

.admin-section { padding: 32px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-card {
  background: #fff; border-radius: 10px;
  border: 1px solid #e8e5e0;
  padding: 22px; display: flex; align-items: center; gap: 16px;
}

.stat-card__icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon--gold { background: rgba(200,169,110,0.15); color: #C8A96E; }
.stat-card__icon--navy { background: rgba(29,40,70,0.1); color: #1D2846; }
.stat-card__icon--success { background: rgba(39,174,96,0.1); color: #27ae60; }
.stat-card__icon--muted { background: rgba(0,0,0,0.05); color: #999; }

.stat-card__label {
  display: block; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px; color: #999;
  margin-bottom: 4px;
}

.stat-card__value {
  font-family: 'Cinzel', serif; font-size: 1.4rem;
  font-weight: 700; color: #1D2846; display: block;
}

/* ── ADMIN CARD ── */
.admin-card {
  background: #fff; border-radius: 10px;
  border: 1px solid #e8e5e0; overflow: hidden;
}

.admin-card__header {
  padding: 20px 24px; border-bottom: 1px solid #f0ede8;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}

.admin-card__title {
  font-family: 'Cinzel', serif; font-size: 1rem;
  font-weight: 600; color: #1D2846; margin: 0;
}

.admin-card__hint {
  font-size: 0.78rem; color: #aaa;
}

.admin-card__body { padding: 24px; }

/* ── HOW IT WORKS ── */
.how-it-works {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.how-step {
  display: flex; gap: 16px;
}

.how-step__num {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1D2846; color: #C8A96E;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.how-step__content strong {
  display: block; font-size: 0.9rem; color: #1D2846;
  margin-bottom: 6px; font-weight: 600;
}

.how-step__content p {
  font-size: 0.82rem; color: #777; line-height: 1.6;
}

/* ── TRAINING TABS ── */
.training-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: #e8e5e0; padding: 4px; border-radius: 8px;
  width: fit-content;
}

.training-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 6px; border: none;
  font-family: 'Raleway', sans-serif; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  color: #777; background: transparent;
}

.training-tab.active {
  background: #fff; color: #1D2846;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.training-tab:hover:not(.active) { color: #C8A96E; }

.tab-panel { /* controlled by JS display:none */ }

/* ── PDF DROP ZONE ── */
.pdf-drop-zone {
  border: 2px dashed #d0cab8; border-radius: 8px;
  padding: 48px 32px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  background: #fafaf8;
}

.pdf-drop-zone:hover, .pdf-drop-zone.drag-over {
  border-color: #C8A96E;
  background: rgba(200,169,110,0.05);
}

.pdf-drop-icon { color: #C8A96E; margin: 0 auto 16px; display: block; }

.pdf-drop-text { font-size: 0.95rem; color: #555; margin-bottom: 8px; }

.pdf-drop-hint { font-size: 0.78rem; color: #aaa; }

.link-btn {
  background: none; border: none; cursor: pointer;
  color: #C8A96E; font-family: 'Raleway', sans-serif;
  font-size: inherit; font-weight: 600;
  text-decoration: underline;
}
.link-btn:hover { color: #b8964f; }

/* ── PDF PROGRESS ── */
.pdf-progress-area {
  border: 1px solid #e8e5e0; border-radius: 8px;
  padding: 20px;
}

.pdf-progress-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}

.pdf-progress-header span {
  font-size: 0.88rem; font-weight: 600; color: #333;
}

.progress-bar {
  height: 6px; background: #e8e5e0; border-radius: 3px;
  overflow: hidden; margin-bottom: 8px;
}

.progress-bar__fill {
  height: 100%; background: linear-gradient(90deg, #1D2846, #C8A96E);
  border-radius: 3px; transition: width 0.3s;
}

.pdf-progress-label { font-size: 0.78rem; color: #999; }

/* ── PDF RESULT ── */
.pdf-result-area {
  border: 1px solid #d4c9b0;
  border-radius: 8px; padding: 20px;
  background: #fffdf8;
}

.pdf-result-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.pdf-result-header h4 {
  font-family: 'Cinzel', serif; font-size: 0.9rem;
  color: #1D2846; margin: 0;
}

.pdf-result-stats { display: flex; gap: 16px; }

.pdf-result-stats span {
  font-size: 0.75rem; color: #888;
  background: #f0ede8; padding: 2px 10px; border-radius: 10px;
}

.pdf-result-info {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 10px; font-size: 0.78rem; color: #888;
}

/* ── SAMPLES LIST ── */
.sample-item {
  border: 1px solid #e8e5e0; border-radius: 8px;
  padding: 16px 20px; margin-bottom: 12px;
  transition: border-color 0.2s;
}

.sample-item:hover { border-color: #C8A96E; }

.sample-item:last-child { margin-bottom: 0; }

.sample-item__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}

.sample-item__title {
  font-weight: 600; font-size: 0.88rem; color: #1D2846;
}

.sample-item__meta {
  font-size: 0.72rem; color: #aaa;
}

.sample-item__excerpt {
  font-family: 'Lora', serif; font-size: 0.82rem;
  color: #666; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.sample-item__footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}

.sample-item__badges { display: flex; gap: 8px; }

.sample-badge {
  font-size: 0.65rem; font-weight: 600; padding: 2px 10px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}

.sample-badge--pdf { background: rgba(200,169,110,0.15); color: #b8964f; }
.sample-badge--text { background: rgba(29,40,70,0.08); color: #1D2846; }

.sample-delete-btn {
  background: none; border: none; cursor: pointer;
  color: #ddd; padding: 4px; border-radius: 4px;
  transition: all 0.2s; display: flex; align-items: center;
}
.sample-delete-btn:hover { color: #e74c3c; background: rgba(231,76,60,0.08); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 40px 24px; color: #ccc;
}
.empty-state svg { display: block; margin: 0 auto 16px; }
.empty-state p { font-size: 0.85rem; margin: 4px 0; }

/* ── PROMPT PREVIEW ── */
.prompt-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.prompt-tokens-label {
  font-size: 0.75rem; color: #aaa;
}

.prompt-preview {
  background: #1D2846; color: #d4c9a8;
  padding: 24px; border-radius: 8px;
  font-family: 'Courier New', monospace; font-size: 0.8rem;
  line-height: 1.8; white-space: pre-wrap; overflow-x: auto;
  margin: 0;
}

/* ── FORM ACTIONS ── */
.form-actions {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn--sm { padding: 8px 16px; font-size: 0.78rem; }

.btn-text {
  background: none; border: none; cursor: pointer;
  font-family: 'Raleway', sans-serif; font-size: 0.8rem;
  font-weight: 600; padding: 4px 8px; border-radius: 4px;
  transition: all 0.2s; text-decoration: underline;
}
.btn-text--danger { color: #e74c3c; }
.btn-text--danger:hover { background: rgba(231,76,60,0.08); }

/* ── TOAST NOTIFICATIONS ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}

.toast {
  background: #1D2846; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 0.85rem; font-family: 'Raleway', sans-serif;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  display: flex; align-items: center; gap: 10px;
  max-width: 320px;
  animation: toastIn 0.3s ease;
  pointer-events: all;
  border-left: 4px solid #C8A96E;
}

.toast--success { border-left-color: #27ae60; }
.toast--error { border-left-color: #e74c3c; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .how-it-works { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-sidebar { width: 200px; }
  .admin-main { margin-left: 200px; }
  .admin-section { padding: 20px; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ═══════════ AGENDA ═══════════ */
.agenda-info {
  display: flex; align-items: flex-start; gap: 8px;
  background: #faf8f3; border: 1px solid #e8e2d4;
  border-radius: 8px; padding: 12px 16px;
  font-size: 0.85rem; color: #666; margin-bottom: 24px;
}

.agenda-slots { display: flex; flex-direction: column; gap: 16px; }

.agenda-slot {
  border: 1px solid #e8e2d4;
  border-radius: 10px;
  overflow: hidden;
}

.agenda-slot__header {
  display: flex; align-items: center; gap: 12px;
  background: #f9f7f3; padding: 14px 16px;
  border-bottom: 1px solid #e8e2d4;
}

.agenda-slot__dia { flex: 1; }

.agenda-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d4c9b0;
  border-radius: 6px;
  background: #fff;
  font-family: 'Raleway', sans-serif;
  font-size: 0.9rem;
  color: #2a2520;
  cursor: pointer;
}

.agenda-slot__hora {
  display: flex; align-items: center; gap: 6px;
}

.agenda-time {
  padding: 8px 10px;
  border: 1px solid #d4c9b0;
  border-radius: 6px;
  background: #fff;
  font-family: 'Raleway', sans-serif;
  font-size: 0.9rem;
  color: #2a2520;
  width: 110px;
}

.agenda-tz {
  font-size: 0.75rem; color: #999; font-weight: 600;
  letter-spacing: 0.5px;
}

.agenda-slot__badge {
  background: var(--gold, #c8a96e);
  color: #fff;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap;
}

.agenda-slot__tema {
  padding: 16px;
}

.agenda-slot__tema .form-label { margin-bottom: 8px; display: block; }
.agenda-slot__tema .form-hint { margin-top: 6px; display: block; font-size: 0.8rem; color: #999; }

@media (max-width: 600px) {
  .agenda-slot__header { flex-wrap: wrap; }
  .agenda-time { width: 90px; }
}

/* ═══════════ LIVROS ═══════════ */
.livro-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid #f0ede8;
}
.livro-row:last-child { border-bottom: none; }

.livro-row__thumb {
  width: 56px; height: 72px; border-radius: 4px;
  overflow: hidden; flex-shrink: 0;
  background: #e8e4dc;
  display: flex; align-items: center; justify-content: center;
}
.livro-row__thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.livro-row__no-img {
  font-size: 1.4rem; opacity: 0.5;
}

.livro-row__info {
  flex: 1; min-width: 0;
}
.livro-row__info strong {
  display: block; font-size: 0.9rem; color: #1D2846;
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.livro-row__info span { font-size: 0.78rem; color: #888; }

.livro-row__actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-text--gold { color: #C8A96E; }
.btn-text--gold:hover { background: rgba(200,169,110,0.1); }

/* Capa upload */
.livro-capa-area { margin-top: 8px; }

.livro-capa-preview {
  width: 100%; min-height: 60px; border: 1.5px dashed #d0cab8;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: #fafaf8; padding: 12px;
}
.livro-capa-empty { font-size: 0.8rem; color: #bbb; }

/* ── TABLES ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid #e1dcd5;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f8f6f2;
  color: #1D2846;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 14px 18px;
  border-bottom: 2px solid #e1dcd5;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #e8e4dc;
  color: #4a4540;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover td {
  background-color: #faf9f6;
}
