/* ═══════════════════════════════════════════════════════════
   Leyoo AI Admin Panel — Professional Dark Theme
   Inter font · Violet accent · Glassmorphism cards
   ═══════════════════════════════════════════════════════════ */

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

/* ─── Design Tokens ─── */
:root {
  --bg-body:        #06060f;
  --bg-sidebar:     #0c0c1a;
  --bg-card:        rgba(255, 255, 255, 0.035);
  --bg-input:       rgba(255, 255, 255, 0.05);
  --bg-hover:       rgba(255, 255, 255, 0.06);
  --bg-chip:        rgba(255, 255, 255, 0.07);
  --bg-chip-active: rgba(108, 71, 255, 0.18);

  --border:         rgba(255, 255, 255, 0.08);
  --border-focus:   rgba(108, 71, 255, 0.7);

  --accent:         #6c47ff;
  --accent-end:     #9b6dff;
  --accent-glow:    rgba(108, 71, 255, 0.25);
  --accent-text:    #a47dff;

  --danger:         #ff4d6d;
  --success:        #22c55e;
  --warning:        #f59e0b;
  --info:           #38bdf8;

  --text-primary:   #f0f0f8;
  --text-secondary: #a0a0b8;
  --text-muted:     #60607a;
  --text-accent:    #a47dff;

  --sidebar-w:      240px;
  --radius:         12px;
  --radius-lg:      18px;
  --radius-sm:      8px;
  --shadow:         0 4px 24px rgba(0, 0, 0, 0.5);
  --transition:     0.18s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-primary); }

img { max-width: 100%; display: block; }

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

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.sidebar-brand h1 span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: none;
  -webkit-text-fill-color: var(--text-muted);
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all var(--transition);
  position: relative;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-left-color: rgba(108, 71, 255, 0.4);
}

.sidebar-nav a.active {
  background: var(--bg-chip-active);
  color: var(--text-primary);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-nav a .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.sidebar-footer a:hover { color: var(--danger); }

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  max-width: 1200px;
}

/* ─── Page Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Stats Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: rgba(108, 71, 255, 0.3);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ─── Section Title ─── */
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 28px 0 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Card ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-chip);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 77, 109, 0.25);
}

.btn-danger:hover {
  background: rgba(255, 77, 109, 0.2);
  color: var(--danger);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
}

/* ─── Forms ─── */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

label .required { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 100px; }

select option { background: #1a1a2e; }

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Radio Cards (gender, age_group, etc.) ─── */
.radio-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-card {
  position: relative;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.radio-card label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  background: var(--bg-chip);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
  text-align: center;
}

.radio-card label .emoji { font-size: 22px; margin-bottom: 2px; }

.radio-card input:checked + label {
  border-color: var(--accent);
  background: var(--bg-chip-active);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.radio-card label:hover {
  border-color: rgba(108, 71, 255, 0.4);
  color: var(--text-primary);
}

/* ─── Multi-select Chips ─── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
}

.chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.chip label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--bg-chip);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.chip input:checked + label {
  background: var(--bg-chip-active);
  border-color: var(--accent);
  color: var(--text-primary);
}

.chip label:hover {
  border-color: rgba(108, 71, 255, 0.4);
  color: var(--text-primary);
}

/* ─── Table ─── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody td {
  padding: 12px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:last-child { border-bottom: none; }

/* ─── Status Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-active  { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.badge-inactive{ background: rgba(96,96,122,0.15); color: var(--text-muted); border: 1px solid var(--border); }
.badge-female  { background: rgba(255,100,160,0.12); color: #ff64a0; border: 1px solid rgba(255,100,160,0.2); }
.badge-male    { background: rgba(56,189,248,0.12); color: var(--info); border: 1px solid rgba(56,189,248,0.2); }

/* ─── Character Photo Thumb ─── */
.char-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-chip);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.char-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-chip);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.char-row-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.char-row-name {
  font-weight: 600;
  font-size: 14px;
}

.char-row-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ─── Photo Upload ─── */
.photo-upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.photo-upload-box:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.photo-upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.photo-upload-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }
.photo-upload-text { font-size: 13px; color: var(--text-muted); }
.photo-upload-text strong { color: var(--text-accent); }

.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  margin: 0 auto 12px;
  display: none;
}

.photo-preview.visible { display: block; }

/* ─── Flash Messages ─── */
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: var(--success);
}

.flash-error {
  background: rgba(255,77,109,0.1);
  border: 1px solid rgba(255,77,109,0.25);
  color: var(--danger);
}

.flash-info {
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.25);
  color: var(--info);
}

/* ─── Search Bar ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  max-width: 320px;
}

.search-bar input {
  background: none;
  border: none;
  box-shadow: none;
  padding: 9px 0;
  font-size: 13.5px;
  width: 100%;
}

.search-bar input:focus { box-shadow: none; border: none; }
.search-icon { color: var(--text-muted); font-size: 14px; }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ─── Actions row ─── */
.actions { display: flex; align-items: center; gap: 8px; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 20px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Login Page ─── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  backdrop-filter: blur(20px);
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ─── Colour dot indicators ─── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-green  { background: var(--success); }
.dot-orange { background: var(--warning); }
.dot-purple { background: var(--accent); }

/* ─── Toggle switch ─── */
.toggle {
  position: relative;
  display: inline-block;
  width: 38px; height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
