/* Northsider Design System - Enhanced CSS */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Brand Colors (Alumni-classic, modern) */
  --primary-purple: #56237F; /* School purple */
  --primary-purple-dark: #3E1C60;
  --primary-purple-light: #7A45B1;
  --accent-gold: #FFC323; /* School gold */
  --accent-gold-dark: #D7A01E;
  --accent-gold-light: #FFD766;
  
  /* Neutral Colors */
  --white: #FFFFFF;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F4;
  --gray-200: #E8EAED;
  --gray-300: #DADCE0;
  --gray-400: #BDC1C6;
  --gray-500: #9AA0A6;
  --gray-600: #80868B;
  --gray-700: #5F6368;
  --gray-800: #3C4043;
  --gray-900: #202124;
  
  /* Semantic Colors */
  --success: #34A853;
  --warning: #FBBC04;
  --danger: #EA4335;
  --info: #4285F4;
  
  /* Typography */
  --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
  
  /* Mobile-specific variables */
  --touch-target-size: 44px;
  --mobile-nav-height: 60px;
  --mobile-padding: 16px;
  --mobile-border-radius: 12px;

  /* Bootstrap variable bridge */
  --bs-primary: var(--accent-gold);
  --bs-secondary: var(--gray-700);
  --bs-success: var(--success);
  --bs-info: var(--info);
  --bs-warning: var(--warning);
  --bs-danger: var(--danger);
  --bs-light: var(--gray-100);
  --bs-dark: var(--gray-900);
  --bs-body-bg: var(--gray-50);
  --bs-body-color: var(--gray-900);
}

/* Auto dark-mode disabled; use [data-theme="dark"] toggle only */

/* Manual theme: dark mode via data attribute */
[data-theme="dark"] {
  --white: #0F1114;
  --gray-50: #0F1114;
  --gray-100: #14171A;
  --gray-200: #1B1F23;
  --gray-300: #23282E;
  --gray-400: #8B949E;
  --gray-500: #9AA0A6;
  --gray-600: #ADB5BD;
  --gray-700: #C7CDD3;
  --gray-800: #DEE2E6;
  --gray-900: #F8F9FA;

  /* Bootstrap bridge for dark theme */
  --bs-primary: var(--accent-gold);
  --bs-body-bg: var(--gray-50);
  --bs-body-color: var(--gray-800);
}

[data-theme="dark"] body {
  color: var(--gray-800);
  background-color: var(--gray-50);
}

[data-theme="dark"] .card { background: #1A1D22; box-shadow: none; }
[data-theme="dark"] .card-header { color: var(--white); }
[data-theme="dark"] .card-footer { background: #1A1D22; border-top-color: #2A2F36; }

[data-theme="dark"] .dropdown-menu { background: #171A1F; border-color: #23282E; }
[data-theme="dark"] .dropdown-item { color: var(--gray-700); }
[data-theme="dark"] .dropdown-item:hover { background: rgba(255,195,35,0.12); color: var(--accent-gold); }

[data-theme="dark"] .form-control, 
[data-theme="dark"] .form-select { background-color: #12161B; color: var(--gray-700); border-color: #2A2F36; }
[data-theme="dark"] .form-control::placeholder { color: #6C757D; }
[data-theme="dark"] .form-control:focus, 
[data-theme="dark"] .form-select:focus { box-shadow: 0 0 0 0.2rem rgba(201,162,39,0.15); }

[data-theme="dark"] .mobile-nav { background: #121417; border-top-color: #23282E; }
[data-theme="dark"] .mobile-dropdown-menu { background: #171A1F; border-color: #23282E; }

[data-theme="dark"] footer { background: linear-gradient(135deg, #0E0F12 0%, #14171A 100%); }
[data-theme="dark"] footer a { color: var(--accent-gold-light); }

/* ===== MOBILE-FIRST BASE STYLES ===== */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-900);
  background-color: var(--gray-50);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--gray-900);
  margin-bottom: var(--space-md);
  margin-top: 0;
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.75rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1.125rem; font-weight: 600; }
h6 { font-size: 1rem; font-weight: 600; }

.display-1 { font-size: 2.5rem; font-weight: 700; }
.display-2 { font-size: 2.25rem; font-weight: 700; }
.display-3 { font-size: 2rem; font-weight: 700; }
.display-4 { font-size: 1.75rem; font-weight: 700; }

.lead {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.7;
}

.text-muted { color: var(--gray-600) !important; }
.text-primary { color: var(--primary-purple) !important; }
.text-accent { color: var(--accent-gold) !important; }

/* ===== MOBILE NAVIGATION ===== */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: var(--space-sm) 0;
  display: none;
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target-size);
  min-width: var(--touch-target-size);
  padding: var(--space-xs);
  text-decoration: none;
  color: var(--gray-600);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--primary-purple);
  background: rgba(86, 35, 127, 0.1);
}

.mobile-nav-item i {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.mobile-nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
}

/* Mobile nav badge for notifications */
.mobile-nav-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: var(--white);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* ===== DESKTOP NAVIGATION ENHANCEMENTS ===== */
  .navbar {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-dark) 100%) !important;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.navbar-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--white) !important;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--accent-gold) !important;
}

.navbar-nav .nav-link {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9) !important;
  transition: all var(--transition-fast);
  position: relative;
  padding: var(--space-sm) var(--space-md) !important;
}

.navbar-nav .nav-link:hover {
  color: var(--accent-gold) !important;
  transform: translateY(-1px);
}

.navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  transition: all var(--transition-fast);
  transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after {
  width: 80%;
}

.navbar-toggler {
  border: none;
  padding: var(--space-sm);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 195, 35, 0.25);
}

/* ===== MOBILE-OPTIMIZED CARDS ===== */
.card {
  border: none;
  border-radius: var(--mobile-border-radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  background: var(--white);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

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

.card-header {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-light) 100%);
  color: var(--white);
  border: none;
  padding: var(--space-lg);
}

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

.card-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  padding: var(--space-md) var(--space-lg);
}

.card-img-top {
  height: 200px;
  object-fit: cover;
  aspect-ratio: 16/9;
  transition: transform var(--transition-normal);
}

/* Media grid hover cues */
.media-card { transition: transform 0.2s ease-in-out; }
.media-card:hover { transform: translateY(-2px); }
.media-thumbnail { cursor: pointer; }
.video-thumbnail { cursor: pointer; }

/* Height utilities to replace inline styles blocked by CSP */
.h-200 { height: 200px !important; }
.obj-cover { object-fit: cover !important; }

/* Utility classes to replace inline styles */
.img-cover-150 { max-height: 150px; width: 100%; object-fit: cover; }
.h-150 { height: 150px; }

.card:hover .card-img-top {
  transform: scale(1.05);
}

/* Mobile card grid */
.mobile-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  padding: var(--mobile-padding);
}

/* ===== MOBILE-OPTIMIZED BUTTONS ===== */
.btn {
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  transition: all var(--transition-fast);
  border: none;
  position: relative;
  overflow: hidden;
  min-height: var(--touch-target-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-light) 100%);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-purple-dark) 0%, var(--primary-purple) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #2E7D32 100%);
  color: var(--white);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, #F57C00 100%);
  color: var(--white);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #D32F2F 100%);
  color: var(--white);
}

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

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

/* Floating action button for mobile */
.fab {
  position: fixed;
  bottom: calc(var(--mobile-nav-height) + var(--space-lg));
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: var(--primary-purple);
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 999;
  transition: all var(--transition-fast);
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

/* ===== MOBILE-OPTIMIZED FORMS ===== */
.form-control, .form-select {
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: all var(--transition-fast);
  font-size: 1rem;
  min-height: var(--touch-target-size);
  width: 100%;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 0.2rem rgba(86, 35, 127, 0.25);
  outline: none;
}

.form-label {
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-sm);
  display: block;
}

/* Scale down checkboxes while keeping accessible hit area via label padding */
.form-check-input {
  width: calc(var(--touch-target-size) / 2);
  height: calc(var(--touch-target-size) / 2);
  min-width: auto;
  min-height: auto;
}

/* Optional: tighten label spacing for compact checkboxes */
.form-check-label {
  padding-left: var(--space-sm);
}

.form-check-input:checked {
  background-color: var(--primary-purple);
  border-color: var(--primary-purple);
}

/* Mobile form layout */
.mobile-form {
  padding: var(--mobile-padding);
}

.mobile-form .form-group {
  margin-bottom: var(--space-lg);
}

/* ===== MOBILE-OPTIMIZED ALERTS ===== */
.alert {
  border: none;
  border-radius: var(--mobile-border-radius);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
  margin-left: var(--mobile-padding);
  margin-right: var(--mobile-padding);
}

.alert-success {
  background: linear-gradient(135deg, #E8F5E8 0%, #C8E6C9 100%);
  color: #2E7D32;
  border-left: 4px solid var(--success);
}

.alert-danger {
  background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
  color: #D32F2F;
  border-left: 4px solid var(--danger);
}

.alert-warning {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
  color: #F57C00;
  border-left: 4px solid var(--warning);
}

.alert-info {
  background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
  color: #1976D2;
  border-left: 4px solid var(--info);
}

/* ===== MOBILE-OPTIMIZED BADGES ===== */
.badge {
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  min-height: 20px;
  display: inline-flex;
  align-items: center;
}

.bg-primary { background: var(--primary-purple) !important; }
.bg-success { background: var(--success) !important; }
.bg-warning { background: var(--warning) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-info { background: var(--info) !important; }

/* ===== MOBILE-OPTIMIZED PAGINATION ===== */
.pagination .page-link {
  border: none;
  color: var(--primary-purple);
  padding: var(--space-sm) var(--space-md);
  margin: 0 var(--space-xs);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: var(--touch-target-size);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination .page-link:hover {
  background: var(--primary-purple);
  color: var(--white);
  transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
  background: var(--primary-purple);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

/* ===== MOBILE-OPTIMIZED MODALS ===== */
.modal-content {
  border: none;
  border-radius: var(--mobile-border-radius);
  box-shadow: var(--shadow-xl);
  margin: var(--mobile-padding);
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-light) 100%);
  color: var(--white);
  border-bottom: none;
  border-radius: var(--mobile-border-radius) var(--mobile-border-radius) 0 0;
}

.modal-footer {
  border-top: 1px solid var(--gray-200);
  padding: var(--space-lg);
}

/* ===== UTILITY CLASSES ===== */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-light) 100%);
}

.bg-gradient-accent {
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-light) 100%);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-hover {
  transition: box-shadow var(--transition-normal);
}

.shadow-hover:hover {
  box-shadow: var(--shadow-lg);
}

/* Reserve aspect ratio for media to prevent CLS */
.img-16x9 {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  height: auto;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

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

.pulse {
  animation: pulse 2s infinite;
}

/* ===== RESPONSIVE DESIGN ===== */
/* Mobile-first approach */
.container-fluid {
  padding-left: var(--mobile-padding);
  padding-right: var(--mobile-padding);
}

/* Tablet and up */
@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.75rem; }
  
  .mobile-nav {
    display: none;
  }
  
  .mobile-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .container-fluid {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

/* Desktop and up */
@media (min-width: 992px) {
  .mobile-card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .card-body {
    padding: var(--space-xl);
  }
  
  .btn {
    padding: var(--space-sm) var(--space-xl);
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .mobile-card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus indicators for keyboard navigation */
.btn:focus,
.form-control:focus,
.form-select:focus,
.nav-link:focus,
.mobile-nav-item:focus {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-purple: #000000;
    --accent-gold: #FFFFFF;
  }
}

/* ===== LOADING STATES ===== */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ===== CUSTOM COMPONENTS ===== */
.stat-card {
  background: var(--white);
  border-radius: var(--mobile-border-radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  text-align: center;
}

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

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-purple);
  margin-bottom: var(--space-sm);
}

.stat-label {
  color: var(--gray-600);
  font-weight: 500;
}

/* Mobile search bar */
.mobile-search {
  position: sticky;
  top: 0;
  background: var(--white);
  padding: var(--space-md);
  border-bottom: 1px solid var(--gray-200);
  z-index: 100;
}

.mobile-search .form-control {
  border-radius: var(--mobile-border-radius);
  padding: var(--space-md);
  font-size: 1rem;
}

/* ===== FOOTER ENHANCEMENTS ===== */
footer {
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
  color: var(--white);
  margin-top: auto;
  padding-bottom: calc(var(--mobile-nav-height) + var(--space-lg));
}

footer a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

footer a:hover {
  color: var(--accent-gold-light);
}

/* ===== MOBILE-SPECIFIC UTILITIES ===== */
.mobile-only {
  display: block;
}

.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
  
  .desktop-only {
    display: block;
  }
}

/* Safe area for devices with notches */
@supports (padding: max(0px)) {
  .mobile-nav {
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  }
  
  .fab {
    bottom: max(
      calc(var(--mobile-nav-height) + var(--space-lg)),
      calc(env(safe-area-inset-bottom) + var(--space-lg))
    );
  }
}

/* Touch-friendly spacing */
.mobile-touch-area {
  min-height: var(--touch-target-size);
  min-width: var(--touch-target-size);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile-optimized text */
.mobile-text {
  font-size: 1rem;
  line-height: 1.5;
}

.mobile-text-small {
  font-size: 0.875rem;
  line-height: 1.4;
}

.mobile-text-large {
  font-size: 1.125rem;
  line-height: 1.6;
}
