@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Premium Color System */
  --primary-blue: #1A73E8;
  --secondary-purple: #6F42C1;
  --success-green: #0F9D58;
  --danger-red: #DB4437;
  --warning-orange: #F4B400;
  
  /* Grey Scale & Surfaces */
  --white: #FFFFFF;
  --black: #121212;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F4;
  --gray-200: #E8EAED;
  --gray-800: #202124;
  --gray-900: #171717;

  /* Typography */
  --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Consistent Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Soft Shadows & Elevations */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 10px 40px rgba(26, 115, 232, 0.15);
  
  /* Glassmorphism Variables */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(255, 255, 255, 0.2);
  --glass-blur: blur(12px);

  /* Animations */
  --transition-fast: 150ms ease-in-out;
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 🌟 Dark Mode Support (Premium Navy Blue Fix) */
@media (prefers-color-scheme: dark) {
  :root {
    --white: #1E1E1E;
    --black: #FFFFFF;
    --gray-50: #0f172a; /* Deep premium navy blue */
    --gray-100: #1e293b;
    --gray-900: #f1f5f9;
    --glass-bg: rgba(30, 41, 59, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
  }
}

/* Global Resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

/* 🌟 Background Fix: !important forces clean colors & ignores inline muddy grey */
body {
  font-family: var(--font-primary);
  background-color: var(--gray-50) !important; 
  color: var(--gray-900) !important;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: all var(--transition-smooth);
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Premium Components */
.glass-panel {
  background: var(--glass-bg) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background-color: var(--primary-blue);
  color: #ffffff !important;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-outline {
  background-color: transparent;
  color: var(--gray-900);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: 600;
  border: 2px solid var(--gray-200);
}

.btn-outline:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

/* Typography Classes */
.text-gradient {
  background: linear-gradient(90deg, var(--primary-blue), var(--secondary-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Text Visibility Fixes */
h1, h2, h3, h4, h5, h6, .section-heading, .dashboard-heading {
    color: var(--gray-900) !important; 
}

.question-text, .question-container h3, .question, label, .exam-page h3 {
    color: var(--gray-900) !important; 
}

/* ====================================================
   📱 100% RESPONSIVE FIX FOR MOBILE (HOMEPAGE & DASHBOARD)
   ==================================================== */
@media screen and (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    /* Navbar / Header Fixes - Horizontal layout, no stacking! */
    .navbar, .nav-container, .dashboard-header, header {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Shrink logo so it doesn't push buttons off screen */
    .logo svg, .desktop-logo {
        width: 120px !important;
        height: auto !important;
    }

    /* Nav links and User controls grouping */
    .nav-links, .user-info {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        align-items: center !important;
        gap: 6px !important;
        margin: 0 !important;
    }

    /* Tiny but readable buttons on mobile */
    .btn-primary, .btn-outline, .badge, .logout-btn, .premium-btn, .nav-btn, .tab-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }
    
    /* Dashboard Tabs Scrollable Fix (Class IV, General, etc.) */
    .tabs-container, .category-tabs, .sub-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        gap: 8px;
        width: 100%;
        scrollbar-width: none; /* Hide scrollbar for cleaner look */
    }
    
    .tabs-container::-webkit-scrollbar, .category-tabs::-webkit-scrollbar, .sub-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Hero section spacing */
    .hero-title {
        font-size: 26px !important;
        line-height: 1.3 !important;
    }
    .hero-cta {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* Full width cards on mobile */
    .card, .test-card, .box, .test-item, .glass-panel {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 15px !important;
    }
}
/* --- MINI LEADERBOARD STYLES --- */
.mini-leaderboard-container {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid #334155;
  border-radius: 15px;
  padding: 20px;
  max-width: 400px;
  margin: 30px auto; /* Ise apne design ke hisaab se adjust kar sakte hain */
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
  color: white;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.leaderboard-header {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 15px;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0 0 15px 0;
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.05);
  margin-bottom: 10px;
  padding: 12px 15px;
  border-radius: 10px;
  font-weight: bold;
  align-items: center;
}

/* Medals styling */
.leaderboard-list li:nth-child(1) { border-left: 5px solid #FFD700; } /* Gold */
.leaderboard-list li:nth-child(2) { border-left: 5px solid #C0C0C0; } /* Silver */
.leaderboard-list li:nth-child(3) { border-left: 5px solid #CD7F32; } /* Bronze */

.student-name {
  font-size: 16px;
  color: #e2e8f0;
}

.student-score {
  background-color: #fbbf24;
  color: #000;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 14px;
}

.loading-text {
  text-align: center;
  color: #94a3b8;
  font-style: italic;
}

.view-all-btn {
  display: block;
  text-align: center;
  color: #38bdf8;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
}

.view-all-btn:hover {
  text-decoration: underline;
}