/* ==========================================================================
   ClassAI ERP - Admin Panel Stylesheet
   ========================================================================== */
:root {
  --indigo-900: #1e1b4b;
  --indigo-800: #312e81;
  --indigo-700: #3730a3;
  --indigo-600: #4338ca;
  --indigo-500: #4f46e5;
  --indigo-400: #818cf8;
  --indigo-100: #e0e7ff;
  --indigo-50: #eef2ff;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --green-600: #16a34a;
  --red-600: #dc2626;
  --red-300: #fca5a5;
  --amber-500: #f59e0b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Roboto, Arial, sans-serif; background: var(--slate-50); color: var(--slate-900); }
a { text-decoration: none; color: inherit; }

/* ---- Login page ---- */
.admin-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--indigo-900), var(--indigo-600)); padding: 20px; }
.admin-login-card { background: #fff; border-radius: 18px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.admin-login-card .brand-row { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 20px; }
.admin-login-card .brand-row img { width: 40px; height: 40px; border-radius: 9px; }
.admin-login-card h1 { font-size: 20px; text-align: center; margin: 0 0 6px; color: var(--indigo-900); }
.admin-login-card .sub { text-align: center; color: var(--slate-500); font-size: 13px; margin-bottom: 24px; }

/* ---- Shell layout ---- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; flex: none; background: var(--indigo-900); color: #cbd5e1; padding: 20px 0; }
.admin-sidebar .brand-row { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.admin-sidebar .brand-row img { width: 32px; height: 32px; border-radius: 8px; }
.admin-sidebar .brand-row span { color: #fff; font-weight: 800; font-size: 16px; }
.brand-part--class { color: var(--indigo-600); }
.brand-part--ai { color: var(--red-600); }
.admin-sidebar .brand-row .brand-part--class { color: var(--indigo-400); }
.admin-sidebar .brand-row .brand-part--ai { color: var(--red-300); }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 20px; font-size: 14px; font-weight: 600; color: #b6c0e2; border-left: 3px solid transparent; }
.admin-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.admin-nav a.is-active { background: rgba(255,255,255,.08); color: #fff; border-left-color: #818cf8; }
.admin-nav .nav-section { padding: 16px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6b7bab; }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 16px 28px; border-bottom: 1px solid var(--slate-200); }
.admin-topbar h1 { font-size: 20px; margin: 0; }
.admin-topbar .who { font-size: 13px; color: var(--slate-500); }
.admin-content { padding: 28px; }

/* ---- Cards / tables / stats ---- */
.card { background: #fff; border: 1px solid var(--slate-200); border-radius: 14px; padding: 22px; margin-bottom: 22px; }
.card h2 { font-size: 16px; margin: 0 0 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: 14px; padding: 20px; }
.stat-card small { color: var(--slate-500); font-weight: 700; font-size: 12px; text-transform: uppercase; }
.stat-card strong { display: block; font-size: 28px; margin-top: 6px; color: var(--indigo-700); }

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th { text-align: left; padding: 10px 12px; background: var(--slate-100); font-size: 12px; text-transform: uppercase; color: var(--slate-500); }
table.data-table td { padding: 12px; border-bottom: 1px solid var(--slate-100); vertical-align: top; }
table.data-table tr:hover td { background: var(--slate-50); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge--demo { background: var(--indigo-100); color: var(--indigo-700); }
.badge--enquiry { background: #fef3c7; color: #92400e; }
.badge--new { background: #dbeafe; color: #1e40af; }
.badge--contacted { background: #fef9c3; color: #854d0e; }
.badge--closed { background: #dcfce7; color: #166534; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 13px; border: 1px solid transparent; cursor: pointer; background: var(--slate-100); }
.btn--primary { background: var(--indigo-600); color: #fff; }
.btn--primary:hover { background: var(--indigo-700); }
.btn--danger { background: #fee2e2; color: var(--red-600); }
.btn--danger:hover { background: #fecaca; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--block { width: 100%; justify-content: center; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--slate-700); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--slate-200); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--indigo-500); }
.field .hint { font-size: 12px; color: var(--slate-500); margin-top: 4px; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.alert--success { background: #dcfce7; color: #166534; }
.alert--error { background: #fee2e2; color: #991b1b; }

.thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--slate-200); }
.thumb-lg { width: 100%; max-width: 220px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--slate-200); margin-bottom: 10px; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.slot-box { border: 1px dashed var(--slate-200); border-radius: 12px; padding: 16px; text-align: center; }
.slot-box img { width: 100%; border-radius: 8px; margin-bottom: 10px; max-height: 220px; object-fit: cover; }
.slot-box .empty-thumb { height: 160px; background: var(--slate-100); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--slate-500); margin-bottom: 10px; font-size: 13px; }

.smtp-test-result { margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: 13px; display: none; white-space: pre-wrap; }
.smtp-test-result.show { display: block; }
.smtp-test-result.ok { background: #dcfce7; color: #166534; }
.smtp-test-result.fail { background: #fee2e2; color: #991b1b; }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; }
  .stat-grid, .form-grid, .slot-grid { grid-template-columns: 1fr; }
}
