:root {
  --primary: #1a6faa;
  --primary-dark: #145a8c;
  --accent: #f0a500;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #2c2c2c;
  --muted: #6b7280;
  --border: #d1d5db;
  --error: #dc2626;
  --success-bg: #ecfdf5;
  --success-border: #6ee7b7;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --sidebar-width: 230px;
}

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

/* ─── APP LAYOUT (sidebar + content) ────────────────────────────────────────── */

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ─── SIDEBAR ────────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform 0.28s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  font-size: 1.8rem;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-site-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  color: white;
}

.sidebar-site-sub {
  font-size: 0.68rem;
  opacity: 0.65;
  margin-top: 2px;
  line-height: 1.3;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-left 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 6px 16px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 6px 0;
  transition: color 0.15s;
}
.sidebar-lang:hover { color: white; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user span:last-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 4px 0;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: #fca5a5; }

/* ─── MAIN CONTENT AREA ──────────────────────────────────────────────────────── */

.page-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px 28px 48px;
  min-width: 0;
  max-width: 900px;
}

.page-content.wide { max-width: 1160px; }

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ─── MOBILE SIDEBAR TOGGLE ──────────────────────────────────────────────────── */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 300;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .page-content { margin-left: 0; padding: 64px 16px 40px; }
}

/* ─── AUTH PAGES (login / signup) — centered, no sidebar ─────────────────────── */

body.auth-page {
  display: block;
  padding: 24px 16px 48px;
}

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

/* Login page header (logo only, no user-bar) */
body.auth-page header {
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

body.auth-page .logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

body.auth-page .logo-circle {
  font-size: 2.4rem;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.auth-page header h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
body.auth-page .subtitle { font-size: 0.95rem; opacity: 0.85; margin-top: 4px; }

/* ─── CARD ───────────────────────────────────────────────────────────────────── */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bg);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bg);
}

.section-header h2 { margin: 0; padding: 0; border: none; }

/* ─── FORM ───────────────────────────────────────────────────────────────────── */

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

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

.required { color: var(--error); }

input, select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 0.95rem;
  background: #fafafa;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,111,170,0.12);
  background: #fff;
}

input.invalid, select.invalid { border-color: var(--error); }

.error-msg {
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 3px;
  min-height: 16px;
}

/* ─── RADIO GENDER ───────────────────────────────────────────────────────────── */

.radio-group { display: flex; gap: 20px; padding-top: 6px; }

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 400;
}

.radio-group input[type="radio"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--primary);
}

/* ─── CHILD CARD ─────────────────────────────────────────────────────────────── */

.child-card {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 14px;
  position: relative;
}

.child-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.child-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.btn-remove {
  background: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  color: var(--error);
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-remove:hover { background: #fee2e2; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 13px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #e8f2fa; }

.btn-danger {
  background: white;
  color: #dc2626;
  border: 1.5px solid #dc2626;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: #fef2f2; }

.form-actions { margin-top: 8px; }

/* ─── SUCCESS ────────────────────────────────────────────────────────────────── */

.success-card {
  background: var(--success-bg);
  border: 1.5px solid var(--success-border);
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.success-icon { font-size: 3rem; margin-bottom: 12px; }

.success-card h2 { font-size: 1.5rem; color: #065f46; margin-bottom: 10px; }
.success-card p  { color: #374151; margin-bottom: 20px; font-size: 1rem; }

.hidden { display: none; }

/* ─── SPINNER ────────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── AUTH ALERTS ────────────────────────────────────────────────────────────── */

.alert-error {
  background: #fee2e2;
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius);
  color: #991b1b;
  font-size: 0.9rem;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.alert-success {
  background: var(--success-bg);
  border: 1.5px solid var(--success-border);
  border-radius: var(--radius);
  color: #065f46;
  font-size: 0.9rem;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 20px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-google:hover { background: #f8fafc; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ─── DATA TABLE ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── SMALL BUTTONS ──────────────────────────────────────────────────────────── */

.btn-sm {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  border: 1.5px solid var(--border);
  color: var(--text);
  background: white;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-sm:hover { background: #f0f0f0; }
.btn-sm-primary { background: var(--primary); color: white !important; border-color: var(--primary); }
.btn-sm-primary:hover { background: var(--primary-dark); }
.btn-sm-danger { color: var(--error) !important; border-color: #fca5a5; }
.btn-sm-danger:hover { background: #fee2e2; }

/* ─── MEDALS ─────────────────────────────────────────────────────────────────── */

.medal-1 { font-weight: 700; color: #b8860b; }
.medal-2 { font-weight: 700; color: #6b7280; }
.medal-3 { font-weight: 700; color: #92400e; }

/* ─── GROUP HEADER / BADGE ───────────────────────────────────────────────────── */

.group-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.group-header h2 { margin: 0; border: none; padding: 0; }
.badge {
  background: var(--primary);
  color: white;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ─── PAGE HEADER ROW (title + action button) ────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
