/* ============================================================
   AI Auto Reply Marketing — Admin Panel Design System
   Brand: indigo -> teal gradient (matches Flutter app identity)
   ============================================================ */

:root {
  --brand-indigo: #6C5CE7;
  --brand-teal: #00D9C0;
  --brand-gradient: linear-gradient(135deg, var(--brand-indigo), var(--brand-teal));
  --bg-page: #F4F5FA;
  --bg-sidebar: #14142B;
  --bg-sidebar-hover: #1F1F3D;
  --bg-card: #FFFFFF;
  --text-dark: #14142B;
  --text-muted: #6E7191;
  --text-on-sidebar: #E4E4F0;
  --text-on-sidebar-muted: #8B8BA7;
  --border-soft: #E7E7F1;
  --success: #17B26A;
  --danger: #F04438;
  --warning: #F79009;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-card: 0 2px 10px rgba(20, 20, 43, 0.06);
}

* { box-sizing: border-box; }

body {
  background: var(--bg-page);
  color: var(--text-dark);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
}

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-on-sidebar);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  padding: 24px 28px 60px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 22px;
}
.sidebar-brand .logo-badge {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand .name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.sidebar-brand .sub { font-size: 11px; color: var(--text-on-sidebar-muted); }

.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-on-sidebar-muted);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-on-sidebar-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item i { font-size: 17px; width: 20px; text-align: center; }
.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--bg-sidebar-hover);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-teal);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 22px; font-weight: 700; margin: 0; }
.topbar .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.admin-chip {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: 999px; padding: 6px 14px 6px 6px;
}
.admin-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ---------- Cards ---------- */
.card-soft {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}

/* ---------- Buttons ---------- */
.btn-brand {
  background: var(--brand-gradient);
  border: none; color: #fff; font-weight: 600;
  border-radius: 10px; padding: 8px 18px;
  transition: opacity 0.15s;
}
.btn-brand:hover { opacity: 0.92; color: #fff; }
.btn-soft {
  background: #F1F1FB; border: 1px solid var(--border-soft);
  color: var(--text-dark); border-radius: 10px; font-weight: 500;
}
.btn-soft:hover { background: #E7E7F8; }

/* ---------- Tables ---------- */
.table-modern { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-modern thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 14px; text-align: left; white-space: nowrap;
}
.table-modern tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px; vertical-align: middle;
}
.table-modern tbody tr:hover { background: #FAFAFE; }

/* ---------- Badges ---------- */
.badge-soft {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.badge-success { background: #E6F9F0; color: var(--success); }
.badge-danger { background: #FEECEB; color: var(--danger); }
.badge-warning { background: #FFF4E5; color: var(--warning); }
.badge-info { background: #EEF0FF; color: var(--brand-indigo); }
.badge-neutral { background: #F1F1F5; color: var(--text-muted); }

/* ---------- Forms ---------- */
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; }
.form-control, .form-select {
  border-radius: 10px; border: 1px solid var(--border-soft);
  font-size: 13.5px; padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-indigo);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

/* ---------- Section visibility ---------- */
.admin-section { display: none; }
.admin-section.active { display: block; }

/* ---------- Login screen ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-sidebar);
}
.login-card {
  width: 100%; max-width: 380px;
  background: #1A1A38; border: 1px solid #2A2A4E;
  border-radius: var(--radius-lg); padding: 32px 28px;
  color: #fff;
}
.login-card .form-control {
  background: #14142B; border: 1px solid #2A2A4E; color: #fff;
}
.login-card .form-control::placeholder { color: #6E6E8F; }
.login-card .form-control:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(0,217,192,0.15); }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.toast-float { position: fixed; top: 20px; right: 20px; z-index: 2000; min-width: 280px; }
.spinner-brand { color: var(--brand-indigo); }
.gap-8 { gap: 8px; }
.cursor-pointer { cursor: pointer; }
.mobile-toggle { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 18px; }
  .mobile-toggle { display: inline-flex; }
}
