/*
 * Arixa Physiotherapy Learning Solutions
 * Premium Partner Dashboard Styles
 * 
 * Design System & Architecture
 */

:root {
  /* Brand Colors - Gold */
  --primary-gold: #D99E20;
  --primary-gold-light: #E8B94A;
  --primary-gold-dark: #B8841A;
  --primary-gold-rgb: 217, 158, 32;
  
  /* Brand Colors - Teal/Blue */
  --primary-teal: #105F88;
  --deep-blue: #0E5375;
  --medium-blue: #0E6895;
  --dark-teal: #0C5570;
  --darkest-teal: #084E70;
  --teal-blue: #0E628E;
  --medium-teal: #145979;
  --lighter-teal: #17789A;
  --teal-rgb: 16, 95, 136;
  
  /* Background & Surface */
  --bg-light: #FAFCFC;
  --bg-dark: #0A1628;
  --surface-white: #FFFFFF;
  --sidebar-bg: linear-gradient(180deg, #084E70 0%, #0E5375 50%, #105F88 100%);
  
  /* Typography */
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-light: #FAFCFC;
  --text-muted: #9ca3af;
  
  /* Semantic Colors */
  --success: #10B981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #EF4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.1);
  
  /* Status Colors */
  --status-not-started: #6b7280;
  --status-not-started-bg: rgba(107, 114, 128, 0.1);
  --status-in-course: var(--primary-gold);
  --status-in-course-bg: rgba(217, 158, 32, 0.1);
  --status-in-clinic: var(--primary-teal);
  --status-in-clinic-bg: rgba(16, 95, 136, 0.1);
  --status-completed: var(--success);
  --status-completed-bg: var(--success-light);
  
  /* Borders & Shadows */
  --border-color: #e5e7eb;
  --border-light: rgba(255, 255, 255, 0.1);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 12px 32px rgba(16, 95, 136, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --glow-shadow: 0 4px 14px rgba(217, 158, 32, 0.3);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: all 0.15s ease;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

html {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

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

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: var(--medium-teal);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-gold);
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
p, span { color: var(--text-secondary); margin-bottom: 1rem; }

/* ==========================================================================
   Login Page
   ========================================================================== */
.login-page {
  min-height: 100vh;
  width: 100vw;
  background: linear-gradient(135deg, #084E70 0%, #0E5375 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}

.login-container {
  width: 100%;
  max-width: 440px;
  z-index: 10;
  animation: fadeInUp 0.6s ease-out forwards;
}

.login-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Top accent border line */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-teal) 0%, var(--primary-gold) 100%);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1,
.login-header .brand-title {
  color: #ffffff !important;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-header p,
.login-header .brand-subtitle {
  color: var(--primary-gold) !important;
  font-size: 0.825rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 0;
  text-transform: uppercase;
}

.login-card .form-group {
  margin-bottom: 1.25rem;
}

.login-card .form-label {
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.login-card .form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  font-size: 0.95rem;
  transition: var(--transition);
}

.login-card .form-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.login-card .form-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--primary-gold);
  box-shadow: 0 0 0 3px rgba(217, 158, 32, 0.25);
}

.btn-login {
  background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-light) 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
  margin-top: 0.5rem;
  box-shadow: 0 4px 14px rgba(217, 158, 32, 0.35);
  border: none;
}

.btn-login:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(217, 158, 32, 0.45);
}

.login-footer-text {
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 1rem;
  transition: var(--transition);
  text-align: center;
  white-space: nowrap;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-light) 100%);
  color: var(--surface-white);
  box-shadow: var(--glow-shadow);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(217, 158, 32, 0.4);
  transform: scale(1.02);
}

.btn-secondary {
  background: var(--primary-teal);
  color: var(--surface-white);
}

.btn-secondary:hover {
  background: var(--medium-teal);
  box-shadow: 0 4px 12px rgba(16, 95, 136, 0.2);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: var(--surface-white);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-success {
  background: var(--success);
  color: var(--surface-white);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.btn-outline:hover {
  border-color: var(--primary-teal);
  color: var(--primary-teal);
  background: rgba(16, 95, 136, 0.05);
}

.btn-edit {
  color: var(--primary-teal);
  background: rgba(16, 95, 136, 0.1);
}

.btn-edit:hover {
  background: var(--primary-teal);
  color: white;
}

.btn-delete {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.btn-delete:hover {
  background: var(--danger);
  color: white;
}

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

.btn-add:hover {
  background: var(--primary-gold-light);
  transform: translateY(-2px);
}

/* ==========================================================================
   Dashboard Layout
   ========================================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  color: var(--surface-white);
  transition: var(--transition);
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.sidebar-brand h2 {
  color: var(--primary-gold);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
}

.sidebar-brand span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
  display: block;
}

.sidebar-nav {
  padding: 2rem 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.sidebar-nav-item {
  margin: 0 1rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  transition: var(--transition);
  border-left: 4px solid transparent;
}

.sidebar-nav-link i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  opacity: 0.8;
  transition: var(--transition);
}

.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--surface-white);
}

.sidebar-nav-link:hover i {
  opacity: 1;
  transform: scale(1.1);
}

.sidebar-nav-link.active {
  background: rgba(217, 158, 32, 0.1);
  color: var(--primary-gold);
  border-left-color: var(--primary-gold);
  font-weight: 600;
}

.sidebar-nav-link.active i {
  color: var(--primary-gold);
  opacity: 1;
}

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

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 32px;
  max-width: calc(100vw - 260px);
  min-height: 100vh;
  background: var(--bg-light);
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  animation: fadeInUp 0.5s ease-out;
}

.welcome-section {
  display: flex;
  flex-direction: column;
}

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

.welcome-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.notification-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface-white);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: var(--transition);
  position: relative;
}

.notification-btn::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface-white);
}

.notification-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  color: var(--primary-teal);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-teal), var(--deep-blue));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(16, 95, 136, 0.2);
}

/* Sidebar Toggle */
.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-white);
  box-shadow: var(--card-shadow);
  align-items: center;
  justify-content: center;
  color: var(--primary-teal);
  font-size: 1.5rem;
  margin-right: 1rem;
}

/* ==========================================================================
   Statistics Cards
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--surface-white);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

/* Staggered animation */
.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

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

.stat-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-card-info {
  flex-grow: 1;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.25rem;
  display: inline-block;
}

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

/* Stat Variants */
.stat-total { border-left-color: var(--primary-teal); }
.stat-total .stat-card-icon { background: rgba(16, 95, 136, 0.1); color: var(--primary-teal); }

.stat-active { border-left-color: var(--primary-gold); }
.stat-active .stat-card-icon { background: rgba(217, 158, 32, 0.1); color: var(--primary-gold-dark); }

.stat-clinic { border-left-color: var(--info); }
.stat-clinic .stat-card-icon { background: rgba(59, 130, 246, 0.1); color: var(--info); }

.stat-completed { border-left-color: var(--success); }
.stat-completed .stat-card-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }

/* ==========================================================================
   Data Table Section
   ========================================================================== */
.data-section {
  background: var(--surface-white);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  animation: fadeInUp 0.7s ease forwards;
  opacity: 0;
  animation-delay: 0.3s;
}

.section-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
}

.section-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  border-radius: 10px;
  transition: var(--transition);
}

.search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  opacity: 0.5;
  pointer-events: none;
}

.search-input {
  padding: 10px 16px 10px 36px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.875rem;
  width: 240px;
  transition: var(--transition);
  background: var(--bg-light);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-teal);
  box-shadow: 0 0 0 3px rgba(16, 95, 136, 0.1);
  background: var(--surface-white);
  width: 280px;
}

.filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.filter-select {
  padding: 10px 32px 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-light);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  transition: var(--transition);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-teal);
  box-shadow: 0 0 0 3px rgba(16, 95, 136, 0.1);
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
  min-height: 300px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.data-table thead {
  background: var(--darkest-teal);
  color: white;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

.data-table th {
  padding: 16px 20px;
  font-weight: 600;
  white-space: nowrap;
}

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

.data-table tbody tr {
  transition: background 0.3s ease;
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

/* Stagger row animations via JS usually, but fallback here */
.data-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.15s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.2s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.25s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.3s; }

.data-table tbody tr:nth-child(even) {
  background: #FAFAFA;
}

.data-table tbody tr:hover {
  background: rgba(217, 158, 32, 0.05); /* very light gold */
}

/* Badges */
.status-badge, .payment-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

/* Status variants */
.status-badge.not-started { background: rgba(107, 114, 128, 0.1); color: #6b7280; }
.status-badge.in-course { background: rgba(217, 158, 32, 0.1); color: #D99E20; }
.status-badge.in-clinic { background: rgba(16, 95, 136, 0.1); color: #105F88; }
.status-badge.completed { background: rgba(16, 185, 129, 0.1); color: #10B981; }

/* Payment variants */
.payment-badge.paid { background: rgba(16, 185, 129, 0.1); color: #10B981; }
.payment-badge.not-paid { background: rgba(239, 68, 68, 0.1); color: #EF4444; }
.payment-badge.partial { background: rgba(245, 158, 11, 0.1); color: #F59E0B; }

/* Score Badges */
.score-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(16, 95, 136, 0.1);
  color: var(--primary-teal);
}

.score-badge.score-empty {
  background: #f3f4f6;
  color: var(--text-muted);
  font-weight: 500;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.no-data {
  padding: 60px;
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.no-data::before {
  content: '📁';
  font-size: 3rem;
  opacity: 0.5;
}

/* ==========================================================================
   Admin Tabs
   ========================================================================== */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tab {
  padding: 12px 24px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}

.admin-tab:hover {
  color: var(--primary-gold);
}

.admin-tab.active {
  color: var(--primary-gold);
  font-weight: 600;
  border-bottom-color: var(--primary-gold);
}

.tab-content {
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeInUp 0.4s ease forwards;
}

.tab-pane.active {
  display: block;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal {
  width: 100%;
  margin: auto;
  max-width: 640px;
  background: var(--surface-white);
  border-radius: 20px;
  transform: translateY(-20px);
  transition: var(--transition);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

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

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: var(--transition);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

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

/* Modal Form Specifics */
.modal-body .form-group {
  margin-bottom: 1.25rem;
}

.modal-body .form-label {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-body .form-input, .modal-body select {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  background: var(--surface-white);
  padding: 12px 16px;
  border-radius: 10px;
  width: 100%;
}

.modal-body .form-input:focus, .modal-body select:focus {
  border-color: var(--primary-teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 95, 136, 0.1);
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
  padding: 14px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeInUp 0.4s ease forwards;
  box-shadow: var(--card-shadow);
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border-left-color: var(--success);
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-left-color: var(--danger);
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-left-color: var(--warning);
}

.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

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

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

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

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

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

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .main-content {
    padding: 24px;
  }
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 1050;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    max-width: 100vw;
  }
  
  .sidebar-toggle {
    display: flex;
  }
  
  .overlay-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: var(--transition);
  }
  
  .sidebar.open ~ .overlay-bg {
    display: block;
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .section-actions {
    width: 100%;
  }
  
  .search-wrapper, .search-input {
    width: 100%;
  }
  
  .search-input:focus {
    width: 100%;
  }
  
  .filter-group {
    width: 100%;
    flex-direction: column;
  }
  
  .filter-select {
    width: 100%;
  }
  
  .modal {
    max-width: calc(100% - 2rem);
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  
  .top-bar-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 16px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .data-table th, .data-table td {
    padding: 12px 10px;
  }
  
  .login-card {
    padding: 32px 24px;
  }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}
