/* ============================================================
   Senior Youth Meeting — Main CSS Design System
   Modern Christian Youth UI | Arabic RTL
   ============================================================ */

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

/* ─── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Brand Colors */
  --primary:          #162B4A;
  --primary-light:    #244573;
  --primary-dark:     #0C182A;
  --primary-alpha:    rgba(22, 43, 74, 0.08);

  --accent:           #C5A059;
  --accent-light:     #E5C587;
  --accent-dark:      #9F7B3C;
  --accent-alpha:     rgba(197, 160, 89, 0.15);

  /* Semantic Colors */
  --success:          #10B981;
  --success-light:    #D1FAE5;
  --warning:          #F59E0B;
  --warning-light:    #FEF3C7;
  --danger:           #EF4444;
  --danger-light:     #FEE2E2;
  --info:             #3B82F6;
  --info-light:       #DBEAFE;

  /* Neutrals */
  --bg:               #F4F6FC;
  --bg-2:             #EEF1F8;
  --surface:          #FFFFFF;
  --surface-2:        #F9FAFB;
  --border:           #E5E7EB;
  --border-dark:      #D1D5DB;

  /* Text */
  --text-primary:     #1A1F36;
  --text-secondary:   #6B7280;
  --text-muted:       #9CA3AF;
  --text-on-primary:  #FFFFFF;

  /* Gradients */
  --grad-primary:     linear-gradient(135deg, #162B4A 0%, #244573 100%);
  --grad-accent:      linear-gradient(135deg, #C5A059 0%, #E5C587 100%);
  --grad-hero:        linear-gradient(135deg, #0C182A 0%, #162B4A 50%, #244573 100%);
  --grad-card:        linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);

  /* Shadows */
  --shadow-xs:        0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:        0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:        0 8px 40px rgba(0,0,0,0.12);
  --shadow-xl:        0 20px 60px rgba(0,0,0,0.16);
  --shadow-primary:   0 8px 25px rgba(30, 58, 95, 0.30);
  --shadow-accent:    0 8px 25px rgba(201, 168, 76, 0.30);

  /* Radius */
  --radius-xs:        4px;
  --radius-sm:        8px;
  --radius-md:        12px;
  --radius-lg:        16px;
  --radius-xl:        24px;
  --radius-2xl:       32px;
  --radius-full:      9999px;

  /* Spacing */
  --space-xs:         4px;
  --space-sm:         8px;
  --space-md:         16px;
  --space-lg:         24px;
  --space-xl:         32px;
  --space-2xl:        48px;
  --space-3xl:        64px;

  /* Transitions */
  --transition:       all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Sidebar */
  --sidebar-width:    260px;
  --navbar-height:    64px;
  --bottom-nav-height: 64px;
}

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

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

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

body.ltr {
  direction: ltr;
  text-align: left;
}

img { max-width: 100%; height: auto; display: block; }
a  { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; }

/* ─── Typography ─────────────────────────────────────────── */
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem);   font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem;     font-weight: 600; }
p  { color: var(--text-secondary); line-height: 1.7; }

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

.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  padding-top: var(--navbar-height);
  transition: var(--transition);
}

.main-content.no-sidebar {
  margin-right: 0;
}

.page-container {
  padding: var(--space-lg) var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
}

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  right: var(--sidebar-width);
  left: 0;
  height: var(--navbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  z-index: 900;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.navbar-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.navbar-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 1.1rem;
}

.navbar-icon-btn:hover {
  background: var(--primary-alpha);
  color: var(--primary);
}

.badge-count {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.navbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.navbar-avatar:hover {
  border-color: var(--primary-light);
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--grad-primary);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-header {
  padding: var(--space-xl) var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  background: var(--accent-alpha);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.sidebar-title {
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-subtitle {
  color: rgba(255,255,255,0.6);
  font-size: 0.72rem;
}

.sidebar-user {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
}

.sidebar-user-name {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
}

.sidebar-user-role {
  color: var(--accent-light);
  font-size: 0.75rem;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
}

.sidebar-section-label {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  margin-top: var(--space-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-lg);
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border-radius: 0;
  position: relative;
  margin: 1px 0;
}

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

.sidebar-link.active {
  color: white;
  background: rgba(255,255,255,0.15);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 0 0 3px;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-link .badge-count {
  position: static;
  margin-right: auto;
  margin-left: 0;
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: var(--transition);
  width: 100%;
}

.sidebar-logout:hover {
  color: var(--danger);
  background: rgba(239,68,68,0.1);
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-body {
  padding: var(--space-xl);
}

.card-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-footer {
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* Stat Cards */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-spring);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.stat-card.primary::after  { background: var(--grad-primary); }
.stat-card.accent::after   { background: var(--grad-accent); }
.stat-card.success::after  { background: var(--success); }
.stat-card.warning::after  { background: var(--warning); }
.stat-card.danger::after   { background: var(--danger); }

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: var(--space-md);
}

.stat-card.primary .stat-card-icon  { background: var(--primary-alpha); color: var(--primary); }
.stat-card.accent  .stat-card-icon  { background: var(--accent-alpha); color: var(--accent-dark); }
.stat-card.success .stat-card-icon  { background: var(--success-light); color: var(--success); }
.stat-card.warning .stat-card-icon  { background: var(--warning-light); color: var(--warning); }
.stat-card.danger  .stat-card-icon  { background: var(--danger-light); color: var(--danger); }

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card-change {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-change.up   { color: var(--success); }
.stat-card-change.down { color: var(--danger); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition-spring);
  border: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(30,58,95,0.40);
}

.btn-accent {
  background: var(--grad-accent);
  color: var(--primary-dark);
  box-shadow: var(--shadow-accent);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(201,168,76,0.40);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

.btn-outline-accent {
  background: transparent;
  color: var(--accent-dark);
  border-color: var(--accent);
}

.btn-outline-accent:hover {
  background: var(--accent);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-success  { background: var(--success); color: white; }
.btn-warning  { background: var(--warning); color: white; }
.btn-danger   { background: var(--danger);  color: white; }
.btn-ghost    { background: var(--primary-alpha); color: var(--primary); }

.btn-success:hover, .btn-warning:hover, .btn-danger:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Icon Button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ─── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  gap: 4px;
}

.badge-gold    { background: var(--accent-alpha); color: var(--accent-dark); }
.badge-blue    { background: var(--primary-alpha); color: var(--primary); }
.badge-gray    { background: var(--bg-2); color: var(--text-secondary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-dark    { background: var(--text-secondary); color: white; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

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

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(43, 91, 161, 0.12);
}

.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.form-control::placeholder { color: var(--text-muted); }

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

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 14px;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-group .form-control { padding-right: 42px; }

/* ─── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.table thead tr {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}

.table th {
  padding: var(--space-md) var(--space-lg);
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-primary);
}

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

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: var(--primary-alpha);
}

/* ─── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  animation: slideInDown 0.3s ease;
}

.alert-close {
  margin-right: auto;
  margin-left: 0;
  color: inherit;
  opacity: 0.6;
  font-size: 1.2rem;
  line-height: 1;
  transition: var(--transition);
}

.alert-close:hover { opacity: 1; }

.alert-success { background: var(--success-light); border-color: var(--success); color: #065f46; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #92400e; }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: #1e40af; }

/* ─── Toast Notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 20px);
  left: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--text-primary);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 280px;
  max-width: 380px;
  animation: slideInUp 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ─── Progress Bar ─────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  transition: width 1s ease;
}

.progress-bar.accent  { background: var(--grad-accent); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ─── Avatar ──────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--bg-2);
  flex-shrink: 0;
}

.avatar-xs  { width: 28px; height: 28px; }
.avatar-sm  { width: 36px; height: 36px; }
.avatar-md  { width: 48px; height: 48px; }
.avatar-lg  { width: 64px; height: 64px; }
.avatar-xl  { width: 96px; height: 96px; }
.avatar-2xl { width: 128px; height: 128px; }

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  background: var(--grad-primary);
}

/* ─── Grid Utilities ──────────────────────────────────────── */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-lg); }

/* ─── Flex Utilities ──────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }

/* ─── Page Header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.breadcrumb a {
  color: var(--primary-light);
  transition: var(--transition);
}

.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-dark); }

/* ─── Bottom Nav (Mobile) ─────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 950;
}

.bottom-nav-inner {
  display: flex;
  height: 100%;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.bottom-nav-item i { font-size: 1.25rem; }

/* ─── Dropdown Menu ───────────────────────────────────────── */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  min-width: 200px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  padding: var(--space-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 1000;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: var(--transition);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--primary-alpha);
  color: var(--primary);
}

.dropdown-item.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xs) 0;
}

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: var(--transition-spring);
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 1.2rem;
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-body { padding: var(--space-xl); }

.modal-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.4;
}

.empty-state h3 {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

/* ─── Loading Skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ─── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-xl);
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.page-btn:hover {
  background: var(--primary-alpha);
  color: var(--primary);
  border-color: var(--primary-light);
}

.page-btn.active {
  background: var(--grad-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Attendance Buttons ──────────────────────────────────── */
.attendance-btn-group {
  display: flex;
  gap: var(--space-xs);
}

.att-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid transparent;
  transition: var(--transition);
}

.att-btn.present  { background: var(--success-light); color: var(--success); border-color: transparent; }
.att-btn.absent   { background: var(--danger-light);  color: var(--danger);  border-color: transparent; }
.att-btn.excused  { background: var(--warning-light); color: var(--warning); border-color: transparent; }

.att-btn.present.active { background: var(--success); color: white; }
.att-btn.absent.active  { background: var(--danger);  color: white; }
.att-btn.excused.active { background: var(--warning); color: white; }

/* ─── Timeline (Follow-up) ────────────────────────────────── */
.timeline {
  position: relative;
  padding-right: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  right: 14px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-xl);
}

.timeline-dot {
  position: absolute;
  right: -40px;
  top: 4px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary);
  border: 3px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: white;
  box-shadow: var(--shadow-sm);
}

.timeline-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.timeline-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: var(--space-sm);
}

/* ─── Quiz Engine ─────────────────────────────────────────── */
.quiz-option {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--surface);
}

.quiz-option:hover {
  border-color: var(--primary-light);
  background: var(--primary-alpha);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-alpha);
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.quiz-option-key {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.quiz-option.selected .quiz-option-key {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ─── Leaderboard ─────────────────────────────────────────── */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: var(--space-sm);
  transition: var(--transition-spring);
}

.leaderboard-item:hover {
  transform: translateX(-4px);
  box-shadow: var(--shadow-md);
}

.rank-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.rank-1 { background: var(--grad-accent); color: var(--primary-dark); font-size: 1.1rem; }
.rank-2 { background: linear-gradient(135deg, #9ca3af, #d1d5db); color: white; }
.rank-3 { background: linear-gradient(135deg, #C9A84C, #92672A); color: white; }
.rank-n { background: var(--bg-2); color: var(--text-secondary); }

/* ─── Post Card ───────────────────────────────────────────── */
.post-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
  margin-bottom: var(--space-lg);
}

.post-card:hover { box-shadow: var(--shadow-md); }

.post-card-header {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.post-card-body {
  padding: 0 var(--space-lg) var(--space-lg);
}

.post-card-img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}

.post-card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* ─── Notification Panel ──────────────────────────────────── */
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 360px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  z-index: 1000;
  overflow: hidden;
}

.notif-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.notif-item:hover { background: var(--primary-alpha); }
.notif-item.unread { background: rgba(43,91,161,0.04); }

.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-alpha);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

/* ─── Circular Progress ───────────────────────────────────── */
.circular-progress {
  position: relative;
  width: 80px;
  height: 80px;
}

.circular-progress svg {
  transform: rotate(-90deg);
}

.circular-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* ─── Animations ──────────────────────────────────────────── */
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade    { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideInUp 0.4s ease; }
.animate-pulse   { animation: pulse 2s infinite; }
.spin { animation: spin 1s linear infinite; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
    --navbar-height: 60px;
  }

  .sidebar {
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    width: 280px;
  }

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

  .sidebar-overlay.show { display: block; }

  .main-content {
    margin-right: 0;
    padding-bottom: var(--bottom-nav-height);
  }

  .navbar { right: 0; }

  .bottom-nav { display: flex; }

  .page-container { padding: var(--space-md); }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .notif-panel {
    width: calc(100vw - 32px);
    left: -150px;
  }

  .modal { max-width: 100%; margin: var(--space-md); }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stat-card-value { font-size: 1.6rem; }
}

/* ─── Utility Classes ─────────────────────────────────────── */
.text-primary     { color: var(--primary); }
.text-accent      { color: var(--accent-dark); }
.text-success     { color: var(--success); }
.text-warning     { color: var(--warning); }
.text-danger      { color: var(--danger); }
.text-muted       { color: var(--text-muted); }
.text-secondary   { color: var(--text-secondary); }
.text-sm          { font-size: 0.875rem; }
.text-xs          { font-size: 0.75rem; }
.text-lg          { font-size: 1.125rem; }
.text-xl          { font-size: 1.25rem; }
.font-bold        { font-weight: 700; }
.font-extrabold   { font-weight: 800; }
.font-medium      { font-weight: 500; }

.mt-auto          { margin-top: auto; }
.mb-auto          { margin-bottom: auto; }
.mr-auto          { margin-right: auto; }
.ml-auto          { margin-left: auto; }

.truncate         { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rounded-full     { border-radius: var(--radius-full); }
.w-full           { width: 100%; }
.h-full           { height: 100%; }

.d-none           { display: none; }
.d-flex           { display: flex; }
.d-block          { display: block; }

/* Scrollbar Styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Mobile Enhancements ────────────────────────────────── */
@media (max-width: 768px) {
  .page-header.flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  
  .navbar-brand {
    font-size: 0.9rem;
  }

  .table-wrapper {
    margin-bottom: var(--space-lg);
  }

  #sidebar-toggle {
    display: flex !important;
  }

  .grid, .grid-2, .grid-3, .grid-4, div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .flex-between {
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .attendance-btn-group {
    flex-wrap: wrap;
  }

  .attendance-btn-group .att-btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 4px;
    font-size: 0.8rem;
  }
}
