/* assets/css/index.css - Premium Overhaul */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Premium Vibrant Light Theme */
  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  
  /* Brand Accents */
  --accent: #4f46e5;
  --accent-light: #818cf8;
  --accent-dark: #3730a3;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #0ea5e9;
  
  /* Surfaces & Premium Shadows */
  --surface-border: rgba(226, 232, 240, 0.8);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, 0.12);
  --shadow-glass: 0 8px 32px 0 rgba(79, 70, 229, 0.05);
  --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.3);

  --font-family: 'Outfit', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Base Resets & Global Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Animations */
@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(20px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInLeft {
  0% { opacity: 0; transform: translateX(-30px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79,70,229,0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 10px 4px rgba(79,70,229,0.2); }
}

/* Glassmorphism Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  border-radius: 20px;
  animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: var(--transition-smooth);
}
.glass-panel:hover {
  box-shadow: var(--shadow-lg);
}

/* Override inline dark overrides to keep things clean */
[style*="rgba(255,255,255,"] { border-color: var(--surface-border) !important; }
[style*="color: white"]:not(.btn):not(.badge):not(.action-card) * { color: var(--text-primary) !important; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  font-weight: 600;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition-bounce);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.45);
  background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background-color: #f1f5f9;
  color: var(--text-primary);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-group { margin-bottom: 1.5rem; animation: fadeSlideUp 0.5s ease backwards; }
.form-group:nth-child(2) { animation-delay: 0.1s; }
.form-group:nth-child(3) { animation-delay: 0.15s; }
.form-group:nth-child(4) { animation-delay: 0.2s; }
.form-group:nth-child(5) { animation-delay: 0.25s; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  text-align: left;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.form-control {
  width: 100%;
  padding: 1rem 1.2rem;
  background-color: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition-smooth);
}
.form-control:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
  transform: translateY(-1px);
}

/* Dashboard Layout Overhaul */
.dashboard-layout {
  display: flex !important;
  flex-direction: row;
  min-height: 100vh;
  width: 100vw;
  overflow-x: hidden;
}

/* Premium Sidebar */
.sidebar {
  width: 280px;
  min-width: 280px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  height: 100vh;
  position: relative;
  animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-brand {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--surface-border);
}
.sidebar-brand h2 {
  color: var(--text-primary);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-list { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; overflow-y: auto;}
.nav-item { margin-bottom: 0.2rem; }
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.2rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  transition: var(--transition-smooth);
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
  overflow: hidden;
}
.nav-link::before {
  content: '';
  position: absolute;
  top: 0; left: 0; height: 100%; width: 0;
  background: var(--accent-gradient);
  opacity: 0.08;
  transition: var(--transition-smooth);
  z-index: -1;
}
.nav-link:hover {
  color: var(--accent);
  transform: translateX(4px);
}
.nav-link:hover::before { width: 100%; }

/* Main Content Area */
.main-content {
  flex: 1;
  width: calc(100% - 280px);
  min-width: 0;
  padding: 3rem 4rem;
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  animation: fadeSlideUp 0.4s ease forwards;
}
.page-header h2 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
}

/* Stat Cards */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
}
.stat-card {
  padding: 1.8rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-bounce);
  position: relative;
  overflow: hidden;
  animation: fadeSlideUp 0.6s ease backwards;
}
.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::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 6px; height: 100%;
  background: var(--accent-gradient);
  opacity: 0.5;
  transition: var(--transition-smooth);
}
.stat-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.95);
}
.stat-card:hover::after { opacity: 1; width: 100%; z-index: -1; filter: blur(20px); }

.stat-card h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  font-weight: 700;
}
.stat-card .value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  background: var(--text-primary);
  -webkit-background-clip: text;
  background-clip: text;
}
.stat-card:hover h3, .stat-card:hover .value {
  position: relative;
  z-index: 2;
}

/* Alerts Framework */
.alert { 
  padding: 1.2rem; 
  border-radius: 12px; 
  margin-bottom: 1.5rem; 
  font-size: 0.95rem; 
  font-weight: 600; 
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeSlideUp 0.4s ease forwards;
}
.alert-danger { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* Enhanced Data Tables */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
}
.data-table th, .data-table td {
  padding: 1.2rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
}
.data-table th {
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.data-table th:first-child { border-top-left-radius: 12px; }
.data-table th:last-child { border-top-right-radius: 12px; }
.data-table td { 
  background: rgba(255, 255, 255, 0.4); 
  transition: var(--transition-smooth);
}
.data-table tr {
  animation: fadeSlideUp 0.4s ease backwards;
}
.data-table tr:nth-child(1) { animation-delay: 0.05s; }
.data-table tr:nth-child(2) { animation-delay: 0.1s; }
.data-table tr:nth-child(3) { animation-delay: 0.15s; }
.data-table tr:nth-child(4) { animation-delay: 0.2s; }
.data-table tr:nth-child(5) { animation-delay: 0.25s; }
.data-table tr:nth-child(6) { animation-delay: 0.3s; }

.data-table tr:nth-child(even) td {
  background: rgba(248, 250, 252, 0.3);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:last-child td:first-child { border-bottom-left-radius: 12px; }
.data-table tr:last-child td:last-child { border-bottom-right-radius: 12px; }

.data-table tr:hover td { 
  background-color: #ffffff; 
  transform: scale(1.002);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

.data-table td a.btn, 
.data-table td a.btn-sm, 
.data-table td a.badge {
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
  display: inline-block;
}

.badge {
  background: var(--accent-gradient);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  letter-spacing: 0.02em;
  transition: var(--transition-smooth);
}
.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.text-warning { color: var(--warning); font-weight: 600; }
.text-success { color: var(--success); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 700;}

/* Login Setup Overrides */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
  background: url('https://images.unsplash.com/photo-1549317661-bd32c8ce0db2?auto=format&fit=crop&q=80') center/cover;
}
.login-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(248,250,252,0.8));
  backdrop-filter: blur(10px);
  z-index: 1;
}
.login-card {
  width: 100%;
  max-width: 440px;
  padding: 3.5rem 3rem;
  text-align: center;
  position: relative;
  z-index: 10;
  border-top: 5px solid transparent;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(25px);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.2);
  border-radius: 24px;
}
.login-card h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-card p {
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
}

/* Responsive Overhaul */
@media (max-width: 990px) {
  .dashboard-layout {
    flex-direction: column !important;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--surface-border);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar-brand { margin-bottom: 0.5rem; padding-bottom: 0.5rem; display: flex; align-items: center; justify-content: space-between;}
  .sidebar-brand h2 { font-size: 1.3rem; margin: 0; }
  
  /* Horizontal Scrolling Nav for Tablets/Mobile */
  .nav-list { 
    display: flex; 
    flex-direction: row; 
    flex-wrap: nowrap; 
    gap: 0.6rem; 
    margin-top: 0.5rem; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    padding-bottom: 0.5rem;
    scrollbar-width: none; /* Firefox */
  }
  .nav-list::-webkit-scrollbar { display: none; } /* Chrome */
  .nav-item { margin-bottom: 0; flex-shrink: 0; }
  .nav-link { padding: 0.6rem 1rem; font-size: 0.9rem; border: 1px solid var(--surface-border); background: white;}
  
  .main-content {
    width: 100%;
    padding: 1.5rem;
    min-height: unset;
  }
  .grid-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .page-header { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
  .page-header h2 { font-size: 1.6rem; margin: 0;}
}

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr !important; }
  .grid-cards { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .data-table th, .data-table td { padding: 1rem; font-size: 0.85rem; }
  /* Full-width actionable forms on mobile */
  form .btn { width: 100% !important; justify-content: center; margin-bottom: 0.8rem; }
}
