/* ===== CORE STYLES ===== */
/* Merged: variables.css + base.css + layout.css + components.css + animations.css */

:root {
  --primary: #003366;
  --secondary: #0055a5;
  --accent: #ff6b00;
  --light: #f8f9fa;
  --dark: #212529;
  --success: #28a745;
  --warning: #ffc107;
  --error: #dc3545;
  --transition: all 0.3s ease-in-out;
  --bg-color: #f8f9fa;
  --text-color: #333;
  --card-bg: white;
  --shadow-color: rgba(0,0,0,0.08);
  --border-radius: 12px;
  --box-shadow: 0 10px 30px var(--shadow-color);
  --scrollbar-thumb: #c1c1c1;
  --scrollbar-track: #f1f1f1;

    /* Keep existing variables, add these: */
  --neon-glow: 0 0 20px rgba(0, 150, 255, 0.3);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --depth-shadow-1: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --depth-shadow-2: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --depth-shadow-3: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --accent-rgb: 255, 107, 0;
  --primary-rgb: 0, 51, 102;
  --success-rgb: 40, 167, 69;
  --elevate-bezier: cubic-bezier(0.34, 1.56, 0.64, 1);
  --neu-shadow-light: 5px 5px 10px rgba(0, 0, 0, 0.08), -5px -5px 10px rgba(255, 255, 255, 0.8);
  --neu-shadow-dark: 5px 5px 10px rgba(0, 0, 0, 0.3), -5px -5px 10px rgba(255, 255, 255, 0.05);
}

.dark-mode {
  --primary: #4a8cff;
  --secondary: #0077e6;
  --accent: #ff8c40;
  --light: #1a1a1a;
  --dark: #f8f9fa;
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --card-bg: #2d2d2d;
  --shadow-color: rgba(0,0,0,0.3);
  --scrollbar-thumb: #555;
  --scrollbar-track: #2a2a2a;

   /* Keep existing dark mode variables, add these: */
  --neon-glow: 0 0 25px rgba(74, 140, 255, 0.4);
  --glass-bg: rgba(45, 45, 45, 0.3);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent-rgb: 255, 140, 64;
  --primary-rgb: 74, 140, 255;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Open Sans', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  overflow-x: hidden;
  transition: var(--transition);
}
/* ===== SPLIT-SCREEN SECTIONS OVERVIEW ===== */
.sections-overview {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  min-width: 400px;
  max-width: 600px;
  box-shadow: var(--box-shadow);
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.section-btn {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-color);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.section-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.section-btn.completed {
  border-color: var(--success);
  background: rgba(40, 167, 69, 0.05);
}

.section-icon {
  position: relative;
  margin-right: 1rem;
  flex-shrink: 0;
}

.section-icon i:first-child {
  font-size: 2rem;
  color: var(--primary);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 51, 102, 0.1);
  border-radius: 50%;
}

/*------------------------------------------------  COMPLETION BADGE EMOJI START----------------------------------------- */
.completion-badge {
  position: absolute;
  top: 45px;
  right: 12px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card-bg);
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25);
  z-index: 5;
  font-weight: 700;
}

.completion-badge::before {
  content: "✓";
  font-size: 12px;
  line-height: 1;
  display: block;
  transform: translate(5px, 4.5px); /* Move right 5px and down 1.5px */
}

/* Dark mode adjustments */
.dark-mode .completion-badge {
  border-color: var(--bg-color);
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

/* Mobile optimization */
@media (max-width: 768px) {
  .completion-badge {
    width: 20px;
    height: 20px;
    top: 28px;
    right: 7px;
  }

  .completion-badge::before {
    font-size: 11px;
    position: absolute;
    top: -1px;   /* move up */
    left: -1.5px;   /* move left */
  }
}


/*------------------------------------------------  COMPLETION BADGE EMOJI END----------------------------------------- */
.section-info {
  flex: 1;
}

.section-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  font-size: 1.1rem;
}

.section-info p {
  margin: 0 0 0.8rem 0;
  color: var(--text-color);
  opacity: 0.8;
  font-size: 0.9rem;
  line-height: 1.4;
}

.section-progress {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section-progress .progress-bar.mini {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.section-progress .progress-bar.mini .progress-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.section-progress span {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
  min-width: 40px;
  text-align: right;
}

.overall-progress {
  font-weight: 600;
  color: var(--primary);
  margin-top: 20px !important;
}

.back-to-sections {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}

.back-to-sections:hover {
  background: rgba(0, 51, 102, 0.1);
}
/* ===== IMPROVED SECTION CARDS WITH RESET BUTTONS ===== */
.section-card {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: var(--bg-color);
  transition: var(--transition);
}

.section-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.section-card.completed {
  border-color: var(--success);
  background: rgba(40, 167, 69, 0.05);
}

.section-card .section-btn {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: none;
}

.section-card .section-btn:hover {
  transform: none;
}

.reset-section-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 32px;
  height: 32px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 50%;
  color: var(--error);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition);
  opacity: 0;
}

.section-card:hover .reset-section-btn {
  opacity: 1;
}

.reset-section-btn:hover {
  background: var(--error);
  color: white;
  transform: scale(1.1);
}
/* Simple Payment Modal Fix */
.auth-modal-content {
  max-width: 1400px !important;
  width: 95vw !important;
  max-height: 90vh !important;
  margin: 2vh auto !important;
  overflow: auto !important;
}

.payment-plans {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 1.5rem !important;
  max-height: none !important;
  padding: 1rem !important;
}

.payment-plan {
  min-height: 450px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

.close-modal {
  background: #dc3545 !important;
  color: white !important;
  border: none !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  font-size: 1.2rem !important;
  position: absolute !important;
  top: 15px !important;
  right: 15px !important;
  z-index: 1000 !important;
}
/* ===== ENHANCED PROFESSIONAL CONSOLE BUTTONS ===== */
.locked-exercise-btn {
  background: #6c757d !important;
  opacity: 0.7;
  cursor: not-allowed;
}

.locked-exercise-btn:hover {
  transform: none !important;
  background: #6c757d !important;
}

.locked-exercise-btn i.fa-lock {
  margin-right: 8px;
}

/*---------------------------------------------RESTART BUTTON START (PC)------------------------------------------ */


.restart-pdf-btn {
  /* Electric gradient that contrasts beautifully with blue */
  background: linear-gradient(135deg, 
    #FFD700 0%,     /* Vibrant gold */
    #FFA500 30%,    /* Bright orange */
    #FF6347 70%,    /* Tomato red */
    #FF4500 100%    /* Orange-red */
  );
  
  /* Dark outline for maximum contrast on blue */
  border: 2px solid #000;
  border-bottom: 4px solid #000;
  color: #000 !important;
  cursor: pointer;
  
  /* Modern flex layout - UPDATED FOR ROUND SHAPE */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  
  /* REMOVED: gap: 0.75rem; - Not needed for icon-only */
  
  /* 🔥 PC BUTTON WIDTH + HEIGHT CONTROL - UPDATED FOR ROUND SHAPE */
  /* REMOVED: padding: 0.1rem 0.5rem; - Not needed for fixed size */
  width: 32px;               /* ← NEW: Controls ROUND button diameter */
  height: 32px;              /* ← NEW: Must equal width for perfect circle */
  border-radius: 50%;        /* ← UPDATED: Changed from 16px to 50% for round */
  position: relative;
  margin: 0;
  
  /* Advanced animations */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Multi-layered shadow for depth */
  box-shadow: 
    0 8px 0px rgba(0, 0, 0, 0.3),
    0 15px 25px rgba(255, 165, 0, 0.4),
    0 0 30px rgba(255, 215, 0, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
  
  /* Glow effect */
  filter: drop-shadow(0 0 12px rgba(255, 165, 0, 0.5));
  
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Metallic shine effect */
.restart-pdf-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0.8),
    rgba(255, 255, 255, 0.6),
    transparent
  );
  transition: left 0.7s ease;
  z-index: -1;
}

/* Hover state - more vibrant */
.restart-pdf-btn:hover {
  transform: translateY(-4px) scale(1.03);
  background: linear-gradient(135deg, 
    #FFEA00 0%,     /* Brighter gold */
    #FF8C00 30%,    /* Darker orange */
    #FF4500 70%,    /* Brighter orange-red */
    #FF0000 100%    /* Pure red */
  );
  box-shadow: 
    0 12px 0px rgba(0, 0, 0, 0.4),
    0 25px 40px rgba(255, 140, 0, 0.6),
    0 0 40px rgba(255, 234, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.7);
  filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.8));
  color: #000 !important;
}

.restart-pdf-btn:hover::before {
  left: 100%;
}

/* Active/pressed state */
.restart-pdf-btn:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 
    0 4px 0px rgba(0, 0, 0, 0.3),
    0 8px 15px rgba(255, 165, 0, 0.3),
    0 0 15px rgba(255, 215, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border-bottom-width: 3px;
  transition-duration: 0.1s;
}

/* Focus for accessibility */
.restart-pdf-btn:focus {
  outline: 3px solid #FFD700;
  outline-offset: 3px;
  box-shadow: 
    0 8px 0px rgba(0, 0, 0, 0.3),
    0 15px 25px rgba(255, 165, 0, 0.4),
    0 0 40px rgba(255, 215, 0, 0.6);
}

/* Restart icon styling - UPDATED FOR ROUND BUTTON */
.restart-pdf-btn .restart-icon {
  font-size: 1.2rem;          /* ← SLIGHTLY SMALLER for round button */
  font-weight: 900;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* REMOVED: width: 1.8em; height: 1.8em; background: rgba(0, 0, 0, 0.1); border-radius: 50%; padding: 0.2em; */
  /* Icon now takes natural size inside round button */
}

.restart-pdf-btn:hover .restart-icon {
  transform: rotate(360deg);
}

/* Disabled state */
.restart-pdf-btn:disabled {
  background: linear-gradient(135deg, #666, #444);
  filter: grayscale(1);
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 4px 0px rgba(0, 0, 0, 0.2);
}

/* ===== ANIMATION KEYFRAMES FOR EXTRA PIZZAZZ ===== */
@keyframes buttonPulse {
  0% { filter: drop-shadow(0 0 12px rgba(255, 165, 0, 0.5)); }
  50% { filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.8)); }
  100% { filter: drop-shadow(0 0 12px rgba(255, 165, 0, 0.5)); }
}

/* Add pulsing animation on hover for extra attention */
.restart-pdf-btn:hover {
  animation: buttonPulse 1.5s infinite;
}

/* ===== DARK MODE VARIATION ===== */
@media (prefers-color-scheme: dark) {
  .restart-pdf-btn {
    background: linear-gradient(135deg, 
      #FFD700 0%,
      #FF8C00 40%,
      #FF4500 80%,
      #DC143C 100%
    );
    border-color: #111;
    box-shadow: 
      0 8px 0px rgba(0, 0, 0, 0.5),
      0 15px 25px rgba(255, 165, 0, 0.5),
      0 0 40px rgba(255, 215, 0, 0.3),
      inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }
  
  .restart-pdf-btn:hover {
    background: linear-gradient(135deg, 
      #FFFF00 0%,
      #FFA500 40%,
      #FF6347 80%,
      #FF0000 100%
    );
  }
}

/*---------------------------------------------RESTART BUTTON END (PC)------------------------------------------ */



/*---------------------------------------------RESTART BUTTON START (MOBILE - ROUND & ADJUSTED)------------------------------------------ */

/* ===== MOBILE STYLING (Integrated with your existing code) ===== */
@media (max-width: 768px) {
  .restart-pdf-btn {
    /* 🔥 MOBILE - ROUND & PROPERLY SIZED 🔥 */
    /* REMOVED 2X BIGGER STYLES - Now round and properly sized */
    
    /* NEW: Round button for mobile */
    width: 20px;              /* ← MOBILE ROUND button diameter (slightly larger for touch) */
    height: 20px;             /* ← Must equal width */
    border-radius: 50%;       /* ← ROUND shape */
    
  
    /* Scale up borders for the bigger button */
    border: 3px solid #000 !important;      /* ← Thinner border for round button */
    border-bottom: 4px solid #000 !important;
    
    /* Scale up shadows for bigger button */
    box-shadow: 
      0 8px 0px rgba(0, 0, 0, 0.3),
      0 20px 30px rgba(255, 165, 0, 0.4),
      0 0 40px rgba(255, 215, 0, 0.2),
      inset 0 2px 0 rgba(255, 255, 255, 0.5) !important;
    
    filter: drop-shadow(0 0 18px rgba(255, 165, 0, 0.5)) !important;
  }
  
  /* Scale up the icon for mobile button */
  .restart-pdf-btn .restart-icon {
    font-size: 0.5rem !important;    /* ← Slightly larger icon for mobile */
    /* REMOVED 2X sizing: width: 3.6em !important; height: 3.6em !important; padding: 0.4em !important; */
  }
  
  /* Bigger hover effects for mobile */
  .restart-pdf-btn:hover {
    transform: translateY(-4px) scale(1.03) !important; /* ← Adjusted for round button */
    box-shadow: 
      0 12px 0px rgba(0, 0, 0, 0.4),
      0 25px 40px rgba(255, 140, 0, 0.6),
      0 0 40px rgba(255, 234, 0, 0.4),
      inset 0 2px 0 rgba(255, 255, 255, 0.7) !important;
  }
  
  /* Your specific mobile positioning (compact button) - UPDATED FOR ROUND SHAPE */
  .sections-overview .restart-pdf-btn.return-btn-top {
    /* 🔥 COMPACT MOBILE BUTTON - ROUND & PROPERLY SIZED 🔥 */
    
    /* Round shape for compact button */
    width: 22px !important;           /* ← COMPACT ROUND button diameter */
    height: 22px !important;          /* ← Must equal width */
    border-radius: 50% !important;    /* ← ROUND shape */
    

    
    /* Scale up borders - adjusted for round */
    border-width: 2px 2px 3px 2px !important;
    
    /* Position adjustments (your existing positioning) */
    position: relative;
    top: 2px !important;                /* ← Adjusted top position */
    right: -10px;
    margin-left: auto;
    margin-right: 12px !important;       /* ← Adjusted margin */
    
    /* Scale up effects for mobile */
    box-shadow: 
      0 4px 0px rgba(0, 0, 0, 0.3),
      0 10px 15px rgba(255, 165, 0, 0.3),
      inset 0 2px 0 rgba(255, 255, 255, 0.5) !important;
    
    filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.3)) !important;
  }
  
  /* Compact button hover effects - scaled for round */
  .sections-overview .restart-pdf-btn.return-btn-top:hover {
    transform: translateY(-2px) scale(1.02) !important; /* ← Adjusted for compact */
    box-shadow: 
      0 6px 0px rgba(0, 0, 0, 0.4),
      0 15px 20px rgba(255, 140, 0, 0.4),
      inset 0 2px 0 rgba(255, 255, 255, 0.6) !important;
  }
  
  /* Compact icon styling - adjusted for round */
  .sections-overview .restart-pdf-btn.return-btn-top .restart-icon {
    font-size: 1rem !important;        /* ← Adjusted icon size for compact */
    /* REMOVED 2X sizing: width: 2.4em !important; height: 2.4em !important; padding: 0.2em !important; */
  }
  
  /* Mobile-only bigger pulse animation - ADJUSTED FOR ROUND */
  @keyframes mobileBigPulse {
    0% { filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.5)); }
    50% { filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.8)); }
    100% { filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.5)); }
  }
  
  /* Apply pulse for mobile */
  .restart-pdf-btn:hover {
    animation: mobileBigPulse 1.5s infinite !important;
  }
}

/*---------------------------------------------RESTART BUTTON END (MOBILE)------------------------------------------ */
/* ===========================
   Godly Ultra-Advanced Button
   - layered gradients, animated iridescence
   - glossy sheen, rim, tactile press, ripple
   - accessible + reduced-motion aware
   ===========================*/
.return-to-console{
  --a:#b02a37; --b:#e4606d; --c:#ff7b87; --rim: rgba(255,255,255,.08);
  --radius:12px; --pad: .64rem 1.1rem; --fw:700; --size: .96rem;
  position:relative; display:inline-flex; align-items:center; gap:.5rem;
  padding:var(--pad); font-weight:var(--fw); font-size:var(--size);
  color:#fff; color: color-mix(in srgb, #fff 92%, #fff 8%);
  border:0; border-radius:var(--radius); cursor:pointer; user-select:none;
  white-space:nowrap; overflow:hidden; min-height:44px; min-width:fit-content;
  transform:translateZ(0); /* promote to own layer */
  /* layered background: base gradient, soft radial glow, subtle noise-like sheen */
  background:
    radial-gradient(600px 160px at 10% 10%, rgba(255,120,120,.08), transparent 12%),
    linear-gradient(135deg, var(--a) 0%, var(--b) 52%, var(--c) 100%);
  box-shadow:
    0 8px 30px rgba(176,42,55,.20),
    inset 0 2px 0 rgba(255,255,255,.06);
  transition: transform .12s ease, box-shadow .16s ease, filter .12s ease;
  text-shadow: 0 1px 0 rgba(0,0,0,.15);
}

/* content clean */
.return-to-console .btn-content,
.return-to-console .btn-icon { background:transparent; box-shadow:none; color:inherit; }

/* iridescent animated layer (gpu-friendly via transform) */
.return-to-console::before{
  content:""; position:absolute; inset:0; pointer-events:none; border-radius:inherit;
  background: conic-gradient(from 120deg at 50% 50%,
               rgba(255,255,255,.06), transparent 10%,
               rgba(255,200,200,.03), transparent 40% );
  mix-blend-mode: overlay; opacity:.9; transform: translate3d(-12%,0,0) scale(1.05);
  will-change: transform; transition: transform 6s linear;
}

/* glossy sheen strip */
.return-to-console::after{
  content:""; position:absolute; left:-30%; top:-30%; width:60%; height:160%;
  transform: rotate(-18deg); border-radius:30%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.22) 50%, rgba(255,255,255,0) 100%);
  filter: blur(.6px); opacity:.9; pointer-events:none; transition: left .7s cubic-bezier(.2,.9,.2,1);
}

/* hover / focus (lift + stronger sheen) */
.return-to-console:hover,
.return-to-console:focus{
  transform: translateY(-4px);
  box-shadow: 0 18px 44px rgba(176,42,55,.26);
  filter: saturate(1.05) brightness(1.02);
}
.return-to-console:hover::before{ transform: translate3d(120%,0,0) scale(1.06); transition-duration: 5.5s; }
.return-to-console:hover::after{ left:120%; transition-duration:.65s; }

/* pressed look */
.return-to-console:active{
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(0,0,0,.14), inset 0 3px 8px rgba(0,0,0,.06);
  filter: brightness(.98);
}

/* tiny inner rim to give a premium border */
.return-to-console .rim{
  position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 0 0 1px rgba(0,0,0,.06);
  mix-blend-mode: normal; opacity:.95;
}

/* CSS ripple (pure CSS) — scales on :active for quick effect */
.return-to-console .ripple{
  position:absolute; width:14px; height:14px; background: rgba(255,255,255,.28);
  border-radius:50%; transform: translate(-50%,-50%) scale(.2); pointer-events:none;
  opacity:0; transition: transform .36s cubic-bezier(.2,.7,.2,1), opacity .36s;
  will-change:transform,opacity;
}
/* when active, show ripple centered where pointer was (use JS for precise coords; fallback center) */
.return-to-console:active .ripple{ transform: translate(-50%,-50%) scale(9); opacity:.18; transition-duration:.45s; }

/* accessible focus ring */
.return-to-console:focus-visible{ outline: 3px solid rgba(228,96,109,.14); outline-offset:4px; }

/* optional small icon sizing */
.return-to-console .btn-icon{ width:20px; height:20px; display:inline-flex; align-items:center; justify-content:center; flex:0 0 20px; }

/* responsive compacting */
@media (max-width:480px){
  .return-to-console{ width:100%; justify-content:center; padding:.56rem 1rem; font-size:.95rem; }
}

/* reduced-motion: disable long transitions + animations */
@media (prefers-reduced-motion: reduce){
  .return-to-console, .return-to-console::before, .return-to-console::after { transition:none; animation:none; }
  .return-to-console::before{ transform: none; }
  .return-to-console:active .ripple{ transition:none; transform:none; opacity:.12; }
}


/* Secondary Console Buttons - For header controls */
.console-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.console-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.console-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.console-btn:hover::after {
  opacity: 1;
}

.console-btn:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.console-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Icon animations */
.return-to-console i,
.console-btn i {
  transition: transform 0.3s ease;
}

.return-to-console:hover i {
  transform: translateX(2px);
}

.console-btn:hover i {
  transform: scale(1.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .return-to-console {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    gap: 0.5rem;
  }
  
  .console-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .return-to-console {
    width: 100%;
    justify-content: center;
  }
  
  .console-btn {
    min-width: auto;
    flex: 1;
  }
}
/* ===== IMPROVED RESET BUTTON ===== */
.reset-section-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 36px;
  height: 36px;
  background: rgba(220, 53, 69, 0.1);
  border: 2px solid rgba(220, 53, 69, 0.3);
  border-radius: 50%;
  color: var(--error);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition);
  opacity: 0.8;
  z-index: 10;
}

.reset-section-btn:hover {
  background: var(--error);
  color: white;
  transform: scale(1.1);
  opacity: 1;
  box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

/* Always show reset button on desktop, hide on mobile until hover */
@media (min-width: 769px) {
  .reset-section-btn {
    opacity: 0.7;
  }
  
  .section-card:hover .reset-section-btn {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .reset-section-btn {
    opacity: 1;
    width: 32px;
    height: 32px;
    top: 0.5rem;
    right: 0.5rem;
  }
}

/* ===== IMPROVED EXERCISE HEADER LAYOUT ===== */
.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eee;
  background: var(--primary);
  color: white;
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  gap: 1rem;
}

.exercise-header .header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0; /* Change from 1 to 0 so it doesn't take extra space */
  min-width: auto; /* Remove minimum width */
  margin-right: auto; /* Push to left */
  padding-left: 0; /* Remove any left padding */
}

.exercise-header .progress-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.exercise-header .score-display {
  font-weight: 600;
  font-size: 1.1rem;
  flex-shrink: 0;
  min-width: 120px;
  text-align: right;
}

.header-controls {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

/* ===== ADVANCED COMPLETION SCREEN STYLES ===== */
.completion-screen {
  padding: 2rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  isolation: isolate; /* Prevents stacking context issues */
}

.completion-visual {
  position: relative;
  margin-bottom: 2rem;
}

.completion-icon {
  position: relative;
  display: inline-block;
}

.completion-icon.mastered .icon-backdrop {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
}

.completion-icon.excellent .icon-backdrop {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  box-shadow: 0 8px 32px rgba(76, 175, 80, 0.3);
}

.completion-icon.good .icon-backdrop {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  box-shadow: 0 8px 32px rgba(33, 150, 243, 0.3);
}

.icon-backdrop {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  position: relative;
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border: 2px solid;
  border-radius: 50%;
  animation: pulse 2s infinite;
  z-index: 1;
}

.pulse-ring.delay-1 {
  animation-delay: 0.5s;
  width: 140px;
  height: 140px;
}

.completion-icon.mastered .pulse-ring {
  border-color: rgba(255, 215, 0, 0.3);
}

.completion-icon.excellent .pulse-ring {
  border-color: rgba(76, 175, 80, 0.3);
}

.completion-icon.good .pulse-ring {
  border-color: rgba(33, 150, 243, 0.3);
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

.completion-header h3 {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.completion-header p {
  color: var(--text-color);
  opacity: 0.8;
  font-size: 1.1rem;
}

.performance-analytics {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  margin: 2rem 0;
  align-items: center;
}

.score-display-circle {
  display: flex;
  justify-content: center;
}

.circular-progress {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress) * 3.6deg), #e0e0e0 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.circular-progress::before {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  background: var(--card-bg);
  border-radius: 50%;
}

.inner-circle {
  position: relative;
  z-index: 1;
  text-align: center;
}

.score-percentage {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.score-label {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
}

.performance-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.1);
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
}

.performance-message {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 12px;
  margin: 2rem 0;
  text-align: left;
}

.performance-message.mastered {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
  border-left: 4px solid #FFD700;
}

.performance-message.excellent {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(69, 160, 73, 0.1));
  border-left: 4px solid #4CAF50;
}

.performance-message.good {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(25, 118, 210, 0.1));
  border-left: 4px solid #2196F3;
}

.message-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.performance-message.mastered .message-icon {
  color: #FFD700;
}

.performance-message.excellent .message-icon {
  color: #4CAF50;
}

.performance-message.good .message-icon {
  color: #2196F3;
}

.message-content h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.message-content p {
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
}

.completion-actions.enhanced {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.completion-actions.enhanced button {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border: none;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.05);
  position: relative;
  z-index: 30;
  will-change: transform; /* Optimize animations */
  backface-visibility: hidden; /* Fix rendering issues */
  transform: translateZ(0); /* Hardware acceleration */
}

.completion-actions.enhanced button:hover {
  transform: translateY(-3px) translateZ(0);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  background: var(--primary);
  color: white;
  z-index: 40; /* Bring hovered button to front */
}

.completion-actions.enhanced button:hover .btn-subtext {
  color: rgba(255,255,255,0.8);
}

/* Clear any overlapping pseudo-elements */
.completion-actions.enhanced button::before,
.completion-actions.enhanced button::after {
  pointer-events: none;
}

/* Fix for mobile hover states */
@media (hover: hover) {
  .completion-actions.enhanced button:hover {
    z-index: 40;
  }
}


.completion-actions.enhanced button:hover .btn-subtext {
  color: rgba(255,255,255,0.8);
}

.btn-icon {
  font-size: 1.5rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
  flex-shrink: 0;
}

.btn-content {
  flex: 1;
}

.btn-text {
  display: block;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.btn-subtext {
  display: block;
  font-size: 0.85rem;
  opacity: 0.7;
}

.btn-arrow {
  opacity: 0.7;
  transition: transform 0.3s ease;
}

.completion-actions.enhanced button:hover .btn-arrow {
  transform: translateX(5px);
}

.completion-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.progress-tip {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
}

.progress-tip i {
  color: var(--accent);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .performance-analytics {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .completion-actions.enhanced {
    flex-direction: column;
  }
  
  .performance-breakdown {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  
  .completion-screen {
    padding: 1rem;
  }
  
  .completion-header h3 {
    font-size: 1.5rem;
  }
  
  .circular-progress {
    width: 120px;
    height: 120px;
  }
  
  .circular-progress::before {
    width: 100px;
    height: 100px;
  }
  
  .performance-message {
    flex-direction: column;
    text-align: center;
    gap: 0.8rem;
  }
}

/* ===== TEMPORARY MESSAGE STYLES ===== */
.temp-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease-out;
}

.temp-message.success {
  background: var(--success);
  color: white;
}

.temp-message.info {
  background: var(--primary);
  color: white;
}

.temp-message.error {
  background: var(--error);
  color: white;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 768px) {
  .exercise-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
  }
  
  .exercise-header .header-left {
    justify-content: space-between;
  }
  
  .exercise-header .progress-info {
    order: 3;
    width: 100%;
  }
  
  .exercise-header .score-display {
    text-align: center;
    min-width: auto;
  }
  
  .return-to-console {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .exercise-header .header-left {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  .return-to-console {
    justify-content: center;
    width: 100%;
  }
}
/* ===== IMPROVED EXERCISE HEADER LAYOUT ===== */
.exercise-header .header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}


.return-to-overview:hover {
  background: linear-gradient(135deg, #FF8C40 0%, var(--accent) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.return-to-overview:hover {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.return-to-overview:hover {
  background: rgba(0, 51, 102, 0.1);
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 768px) {
  .exercise-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .exercise-header .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .reset-section-btn {
    opacity: 1; /* Always show on mobile */
    top: 0.3rem;
    right: 0.3rem;
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
}
/* ===== RESPONSIVE DESIGN FOR SPLIT SCREEN ===== */
@media (max-width: 1024px) {
  .split-screen-container {
    flex-direction: column;
    height: auto;
    max-height: 90vh;
  }
  
  .pdf-section,
  .sections-overview {
    min-width: unset;
    width: 100%;
    flex: none;
  }
  
  .pdf-section {
    height: 40vh;
    min-height: 300px;
  }
  
  .sections-overview {
    height: 50vh;
  }
  
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 1rem;
  }
  
  .section-btn {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .split-screen {
    padding: 0.5rem;
    height: 97vh !important;
  }
  
  .sections-grid {
    grid-template-columns: 1fr;
  }
  
  .section-icon i:first-child {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
  }
  
  .section-info h4 {
    font-size: 1rem;
  }
  
  .section-info p {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .section-btn {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }
  
  .section-icon {
    margin-right: 0;
    margin-bottom: 0.8rem;
  }
  
  .section-progress {
    justify-content: space-between;
  }
}
/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary);
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent);
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Layout Styles */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23ffffff' fill-opacity='0.1' d='M0,128L48,117.3C96,107,192,85,288,112C384,139,480,213,576,224C672,235,768,181,864,160C960,139,1056,149,1152,165.3C1248,181,1344,203,1392,213.3L1440,224L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

header h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 0.5rem;
  position: relative;
  animation: fadeInDown 1s ease-out;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  color: white;
}

header p {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  animation: fadeInUp 1s ease-out;
  color: white;
}

/* Navigation Styles */
nav {
  background-color: var(--card-bg);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: var(--transition);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--primary);
}

.nav-links {
  display: flex;
  list-style: none;
  transition: var(--transition);
}

.nav-links li {
  margin: 0 0.5rem;
}

/* ===== ADVANCED PROFESSIONAL NAVIGATION — USER NAME FORCED BLUE (MOBILE + DARK) ===== */

/* ------------------------------
   Core variables — tweak here
   ------------------------------ */
:root{
  --nav-height: 56px;
  --nav-transition: all 0.32s cubic-bezier(.17,.85,.32,1.08);
  --nav-blur: blur(10px);

  /* Brand colors */
  --primary-rgb: 37,99,235;
  --primary: #2563eb;            /* brand blue */
  --accent: #7c3aed;             /* secondary purple */
  --premium-from: #f59e0b;       /* premium gradient */
  --premium-to: #d97706;

  /* Background & border */
  --card-bg-rgb: 255,255,255;
  --border-color-rgb: 0,0,0;

  /* Text palette */
  --text-default: #0f172a;       /* dark text for light mode */
  --text-muted: #6b7280;
  --text-inverse: #ffffff;       /* white for dark backgrounds */

  /* Special cases */
  --desktop-dark-text: #0f172a;  /* dark letters used on desktop in dark-mode */
  --btn-tint-opacity: 0.16;      /* base tint behind buttons (light mode) */
  --btn-tint-opacity-dark: 0.20; /* base tint behind buttons in dark mode (mobile) */
  --btn-tint-opacity-desktop-dark: 0.12; /* desktop dark-mode (so black text still reads) */

  --focus-ring: rgba(var(--primary-rgb),0.18);
  --shadow-small: 0 6px 18px rgba(5,10,20,0.06);
  --shadow-strong: 0 12px 30px rgba(5,10,20,0.10);
}

/* Make sure page content isn't hidden by fixed nav */
body { padding-top: var(--nav-height); }

/* ------------------------------
   Nav container
   ------------------------------ */
nav{
  position: fixed;
  left: 0; right: 0; top: 0;
  height: var(--nav-height);
  z-index: 9999;
  background: rgba(var(--card-bg-rgb),0.96);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  box-shadow: var(--shadow-small);
  border-bottom: 1px solid rgba(var(--border-color-rgb),0.06);
  transition: var(--nav-transition);
}

/* stronger scrolled state */
nav.scrolled{
  background: rgba(var(--card-bg-rgb),0.99);
  box-shadow: var(--shadow-strong);
  border-bottom-color: transparent;
}

/* layout */
.nav-container{
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.75rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ------------------------------
   Links
   ------------------------------ */
.nav-links{
  display:flex;
  gap: .35rem;
  align-items:center;
  height:100%;
  margin:0; padding:0; list-style:none;
}

.nav-links li{ height:100%; display:flex; align-items:center; position:relative; }

/* button-like link — compact and consistent */
.nav-links a{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  height:40px;                 /* compact */
  padding:.35rem .95rem;
  border-radius:12px;
  font-size:0.95rem;
  font-weight:500;
  text-decoration:none;
  color:var(--text-default);
  background: linear-gradient(180deg, rgba(255,255,255,0.0), rgba(255,255,255,0.0));
  transition: transform .25s ease, color .22s ease, box-shadow .22s ease;
  -webkit-font-smoothing:antialiased;
  line-height:1;
  outline: none;
  border: 1px solid rgba(15,23,42,0.02);
}

/* subtle colored tint behind every button to improve legibility BEFORE hover */
.nav-links a::before{
  content:'';
  z-index:-1;
  position:absolute;
  inset:0;
  border-radius:12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: var(--btn-tint-opacity);
  transition: opacity .22s ease, transform .22s ease;
  transform: translateZ(0);
}

/* underline accent */
.nav-links a::after{
  content:'';
  position:absolute;
  left:50%; bottom:0;
  transform:translateX(-50%);
  width:0; height:3px;
  border-radius:3px 3px 0 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .22s cubic-bezier(.2,.9,.3,1);
  opacity:.98;
}

/* hover -> visible gradient + white text for emphasis */
.nav-links a:hover{
  transform: translateY(-3px);
  color: var(--text-inverse);
  box-shadow: 0 10px 26px rgba(20,30,60,0.08);
}
.nav-links a:hover::before{ opacity: 1; transform: translateY(-1px); }
.nav-links a:hover::after{ width:78%; background: linear-gradient(90deg,var(--primary),var(--accent)); }

/* focus (keyboard) */
.nav-links a:focus{
  box-shadow: 0 10px 26px rgba(20,30,60,0.06), 0 0 0 4px var(--focus-ring);
  color: var(--text-inverse);
}
.nav-links a:focus::before{ opacity: 1; }

/* Active link style */
.nav-links a.active{
  background: linear-gradient(135deg,var(--primary),var(--accent));
  color: var(--text-inverse) !important;
  box-shadow: 0 10px 28px rgba(37,99,235,0.14);
  transform: translateY(-2px);
}
.nav-links a.active::after{ width:0; }

/* small icon hover micro interaction */
.nav-links a i{ transition: transform .2s ease; }
.nav-links a:hover i{ transform: scale(1.08); }

/* legal / muted links (privacy, terms) */
.nav-links .legal-nav a{
  font-size:0.9rem;
  padding:.4rem .85rem;
  color:var(--text-muted);
  height:34px;
  background: transparent;
}
.nav-links .legal-nav a:hover{ color: var(--primary); background: rgba(var(--primary-rgb),0.06); }

/* Premium link: standout but readable on all backgrounds */
.nav-links .premium-link{
  padding:.45rem 1.15rem;
  border-radius:12px;
  font-weight:600;
  background: linear-gradient(135deg,var(--premium-from),var(--premium-to));
  color: #fff;
  box-shadow: 0 8px 28px rgba(217,119,6,0.14);
  border: none;
}
.nav-links .premium-link:hover{
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(217,119,6,0.18);
}

/* ------------------------------
   Auth / User area
   ------------------------------ */
.auth-container{ display:flex; align-items:center; gap:1rem; margin-left:auto; }
.auth-buttons{ display:flex; gap:.65rem; }
.auth-btn{ padding:.5rem 1.1rem; border-radius:10px; font-weight:600; font-size:.9rem; cursor:pointer; border:none; transition: all .22s ease; }

/* login / signup */
.login-btn{ background:transparent; color:var(--primary); border:2px solid var(--primary); }
.login-btn:hover{ background: rgba(var(--primary-rgb),0.08); transform:translateY(-2px); }
.signup-btn{ background: linear-gradient(135deg,var(--primary),var(--accent)); color: #fff; box-shadow: 0 8px 26px rgba(37,99,235,0.12); }
.signup-btn:hover{ transform: translateY(-2px); box-shadow: 0 14px 40px rgba(37,99,235,0.14); }

/* user menu */
.user-menu{
  display:flex; align-items:center; gap:.65rem;
  padding:.35rem; border-radius:12px; background: rgba(var(--card-bg-rgb),0.94);
  border: 1px solid rgba(var(--border-color-rgb),0.06); box-shadow: 0 6px 18px rgba(0,0,0,0.04);
}
.user-avatar{
  width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  font-weight:600;font-size:1rem;color:#fff;background:linear-gradient(135deg,var(--primary),var(--accent));
  transition: transform .18s ease;
}
.user-avatar:hover{ transform: scale(1.04); }

/* -----------------------------------------------------------
   USER NAME — FORCED BLUE ON ALL MODES & DEVICES (IMPORTANT)
   * Uses !important to override any media-specific rules.
   * Tiny stroke + shadow for crisp legibility on varied backgrounds.
   ----------------------------------------------------------- */
.user-name{
  font-weight:700 !important;
  color: var(--primary) !important;            /* <-- FORCED BLUE */
  font-size:0.96rem !important;
  cursor:pointer;
  padding:0 .35rem;
  -webkit-font-smoothing:antialiased;
  text-shadow: 0 1px 0 rgba(255,255,255,0.02);
  -webkit-text-stroke: 0.25px rgba(0,0,0,0.08); /* micro stroke for contrast */
}

/* small controls */
.profile-btn,.logout-btn{ padding:.38rem .9rem; border-radius:8px; font-size:.84rem; font-weight:500; cursor:pointer; border:none; }

/* hamburger (mobile) */
.hamburger{ display:none; width:38px;height:38px;border-radius:10px;background: rgba(var(--primary-rgb),0.08); color:var(--primary); border:none; align-items:center; justify-content:center; cursor:pointer; transition: all .18s ease; margin-left:.85rem; }
.hamburger:hover{ background: rgba(var(--primary-rgb),0.14); transform: rotate(90deg); }

/* ------------------------------
   Responsive breakpoints
   ------------------------------ */

/* Mobile / small screens — polished, professional touch */
@media (max-width:992px) {
  nav { padding: 0 1rem; }

  /* tweak these to control position/height/spacing on mobile */
  :root {
    --mobile-nav-rise: 16px;     /* how many px the menu rises (positive = higher) */
    --mobile-nav-extra: 1200px;  /* extra effective height (you used a big value earlier) */
    --mobile-gap: 1rem;          /* gap between menu items */
    --mobile-item-pad: 0.95rem;  /* vertical padding inside each link (tap target) */
    --mobile-item-radius: 10px;  /* rounding for each row */
  }

  .nav-links {
    position: fixed;
    left: 0;
    right: 0;

    /* raise the opened menu a bit above the nav */
    top: calc(var(--nav-height) - var(--mobile-nav-rise));

    /* translucent blurred panel */
    background: rgba(var(--card-bg-rgb), 0.98);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    /* layout */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;   /* keep content flow natural (not vertically centered) */
    padding: 1.25rem;
    gap: var(--mobile-gap);
    border-radius: 0 0 18px 18px;

    /* start hidden above the visible top (accounting for the rise) */
    transform: translateY(calc(-100% - var(--mobile-nav-rise)));
    opacity: 0;
    visibility: hidden;
    transition: transform var(--nav-transition), opacity var(--nav-transition), visibility 0s linear calc(var(--nav-transition) * 0.5);

    /* make it appear taller: reduce how much is subtracted from 100vh */
    max-height: calc(100vh - (var(--nav-height) - var(--mobile-nav-extra) - var(--mobile-nav-rise)));
    min-height: calc(40vh); /* ensure a minimum visual presence on short screens */
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 24px 70px rgba(0,0,0,0.14);

    /* slight padding tuning when large rise/extra is used */
    padding-top: calc(1.25rem + var(--mobile-nav-rise) * 0.25);
    padding-bottom: calc(1.25rem + min(40px, var(--mobile-nav-extra) * 0.02));
  }

  /* visible state */
  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }

  /* each link: roomy, touch-friendly row */
  .nav-links a {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: var(--mobile-item-pad) 1rem;
    min-height: 48px;                    /* good tap target */
    border-radius: var(--mobile-item-radius);
    transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
    text-decoration: none;
    box-sizing: border-box;
  }

  /* subtle hover + focus styles (visual separation on interaction) */
  .nav-links a:hover,
  .nav-links a:focus {
    background: rgba(var(--card-bg-rgb), 0.04);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  }

  /* ensure keyboard focus is visible and accessible */
  .nav-links a:focus-visible {
    outline: 3px solid rgba(0,0,0,0.06);
    outline-offset: 4px;
  }

  /* hamburger remains visible on mobile */
  .hamburger { display: flex; }

  /* user menu (stacked) spacing */
  .user-menu {
    flex-direction: column;
    align-items: stretch;
    padding: .9rem;
    gap: calc(var(--mobile-gap) * 0.9);
  }

  /* nicer scrollbar for the menu panel (webkit) */
  .nav-links::-webkit-scrollbar { width: 10px; }
  .nav-links::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.08);
    border-radius: 10px;
  }
  .nav-links::-webkit-scrollbar-track { background: transparent; }

  /* scale gap slightly if you left --mobile-nav-extra very large */
  .nav-links { gap: calc(var(--mobile-gap) + min(0.8rem, var(--mobile-nav-extra) * 0.0006)); }

  /* pointer coarse devices: bigger hit area */
  @media (pointer: coarse) {
    .nav-links a { min-height: 56px; padding: 1rem 1rem; }
  }

  /* Respect reduced motion: don't translate on show/hide or hover */
  @media (prefers-reduced-motion: reduce) {
    .nav-links { transition: none; transform: none !important; opacity: 1 !important; visibility: visible !important; }
    .nav-links a { transition: none; transform: none !important; }
    .nav-links::-webkit-scrollbar { display: none; }
  }
}
@media (max-width:600px){

  /* Mobile readability tweaks: ensure blue username remains visible & slightly larger */
  .user-name{
    text-align:center;
    padding:.45rem 0;
    font-weight:800 !important;
    font-size:1.0rem !important;
    color: var(--primary) !important;
    -webkit-text-stroke: 0.28px rgba(0,0,0,0.09);
    text-shadow: 0 1px 0 rgba(255,255,255,0.02);
  }
}

/* Tablet tweaks */
@media (max-width:1200px){
  .nav-container{ padding:0 1.25rem; }
  .nav-links a{ font-size:.92rem; padding:.45rem .9rem; }
  .auth-btn{ padding:.45rem .95rem; min-width:68px; }
}

/* Small desktop */
@media (max-width:1400px){
  .nav-container{ max-width:100%; padding:0 1.5rem; }
}

/* ------------------------------
   Dark mode — default (mobile + general)
   ------------------------------ */
@media (prefers-color-scheme: dark){
  :root{ --card-bg-rgb: 18,20,28; } /* darker canvas */
  nav{ background: rgba(var(--card-bg-rgb),0.94); border-bottom-color: rgba(255,255,255,0.06); }
  nav.scrolled{ background: rgba(var(--card-bg-rgb),0.98); }

  /* Buttons: keep them highly visible for mobile/readability */
  .nav-links a{
    color: var(--text-inverse);                /* white text on dark mobile by default */
    border: 1px solid rgba(255,255,255,0.03);
  }
  .nav-links a::before{ opacity: var(--btn-tint-opacity-dark); }
  .nav-links a::after{ opacity:0.98; }

  .nav-links .legal-nav a{ color: rgba(255,255,255,0.78); }
  .nav-links a:hover{ color: var(--text-inverse); }
  .nav-links .premium-link{ box-shadow: 0 8px 28px rgba(217,119,6,0.12); color:#fff; }

  .user-menu{ background: rgba(var(--card-bg-rgb),0.92); border-color: rgba(255,255,255,0.04); }

  /* Ensure username stays blue even if other dark-mode rules try to change it */
  .user-name{ 
    color: var(--primary) !important; 
    -webkit-text-stroke: 0.25px rgba(255,255,255,0.1);
    text-shadow: 0 1px 0 rgba(0,0,0,0.5);
  }
}

/* ------------------------------
   MOBILE DARK-MODE COLOR OVERRIDE
   (Make mobile nav labels colored/brand-blue instead of plain white)
   Applies to dark mode and screen widths < 992px
   ------------------------------ */
@media (prefers-color-scheme: dark) and (max-width: 991px) {
  /* colored labels for better brand consistency on mobile */
  .nav-links a {
    color: var(--primary);                     /* brand blue on mobile dark-mode */
    border: 1px solid rgba(255,255,255,0.03);
  }

  /* make tint a touch stronger so the colored text sits on a subtle surface */
  .nav-links a::before {
    opacity: 0.28;
  }

  /* legal links: slightly muted blue for hierarchy */
  .nav-links .legal-nav a {
    color: rgba(37,99,235,0.85);              /* slightly muted brand-blue */
  }

  /* premium link keeps strong contrast */
  .nav-links .premium-link {
    color: #fff; /* keep premium readable */
  }

  /* hover/focus on mobile still show white for clear contrast */
  .nav-links a:hover,
  .nav-links a:focus {
    color: var(--text-inverse);
  }

  /* Make sure username remains blue on mobile dark */
  .user-name { 
    color: var(--primary) !important; 
    -webkit-text-stroke: 0.28px rgba(255,255,255,0.1);
    text-shadow: 0 1px 0 rgba(0,0,0,0.5);
  }
}

/* ------------------------------
   Desktop dark-mode override
   (Make letters darker on desktop while keeping professional tint)
   Applies only to screens >= 992px
   ------------------------------ */
@media (prefers-color-scheme: dark) and (min-width: 992px){
  .nav-links a{
    color: var(--desktop-dark-text);                 /* near-black letters like light mode */
    background: rgba(255,255,255,0.01);              /* subtle surface so tint reads through */
  }
  .nav-links a::before{ opacity: var(--btn-tint-opacity-desktop-dark); } /* weaker tint so text remains dominant */
  .nav-links a::after{ opacity: .98; }

  .nav-links .legal-nav a{ color: var(--desktop-dark-text); }
  .nav-links .premium-link{ color: var(--desktop-dark-text) !important; /* premium can be inverted visually */ }
  .nav-links a:hover{ color: var(--text-inverse); } /* on hover we still show white text for contrast */

  /* Desktop: ensure username remains blue even in desktop dark override */
  .user-name { 
    color: var(--primary) !important; 
    -webkit-text-stroke: 0.22px rgba(0,0,0,0.08);
    text-shadow: 0 1px 0 rgba(255,255,255,0.05);
  }
}

/* ------------------------------
   Accessibility / contrast helpers
   ------------------------------ */
@media (prefers-contrast: high){
  nav{ border-bottom-width:2px; }
  .nav-links a{ border:1px solid transparent; }
  .nav-links a:hover, .nav-links a.active{ border-color: var(--primary); }
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce){
  nav, .nav-links a, .auth-btn, .hamburger{ transition:none !important; }
  .nav-links a:hover, .nav-links a.active, .auth-btn:hover, .hamburger:hover{ transform:none !important; }
}

/* Print */
@media print{
  nav{ position: static; background:white; box-shadow:none; border-bottom:1px solid #ccc; }
  .nav-links, .auth-container, .hamburger{ display:none; }
}
/* Section Styles */
section {
  padding: 5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  color: var(--primary);
  position: relative;
  display: inline-block;
  padding-bottom: 0.5rem;
}

.section-header h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* Subsection styling */
.subsection {
  margin-bottom: 4rem;
}

.subsection:last-child {
  margin-bottom: 0;
}

.subsection h3 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
  position: relative;
  padding-bottom: 0.5rem;
}

.subsection h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* Footer Styles */
footer {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  text-align: center;
  padding: 3rem 1rem;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23ffffff' fill-opacity='0.1' d='M0,128L48,117.3C96,107,192,85,288,112C384,139,480,213,576,224C672,235,768,181,864,160C960,139,1056,149,1152,165.3C1248,181,1344,203,1392,213.3L1440,224L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

footer p {
  position: relative;
  z-index: 1;
}

/* Components Styles */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  position: relative;
  transform: translateY(0);
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px var(--shadow-color);
}

.card-image {
  height: 180px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  padding: 1rem;
}

.card-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-content {
  padding: 1.5rem;
}

.card h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* List Styles */
.styled-list {
  list-style: none;
  max-width: 800px;
  margin: 0 auto;
}

.styled-list li {
  padding: 1rem 1.5rem 1rem 3rem;
  margin-bottom: 1rem;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 5px 15px var(--shadow-color);
  position: relative;
  transition: var(--transition);
}

.styled-list li:hover {
  transform: translateX(10px);
}

.styled-list li::before {
  content: '\f058';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.2rem;
}

/* Button Styles */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 500;
  text-align: center;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.btn-secondary {
  background-color: var(--primary);
  color: white;
}

.btn-secondary:hover {
  background-color: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}



/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 8rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  border: none;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px);
  background: var(--primary);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1001;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.dark-mode-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--dark);
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.2);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.submit-btn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  display: block;
  width: 100%;
}

.submit-btn:hover {
  background-color: var(--primary);
  transform: translateY(-2px);
}

.submit-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Grid Styles */
.partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}


/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Security Message Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Security badge styling */
.exercise-description small {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  backdrop-filter: blur(5px);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Interactive Exercise Styles */
.interactive-exercise-btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, var(--success) 0%, #28a745 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: 0.5rem;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.interactive-exercise-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.exercise-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 3000;
  padding: 2rem;
  backdrop-filter: blur(5px);
}

.exercise-modal {
  background: var(--card-bg);
  border-radius: 12px;
  max-width: 800px;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease-out;
}

.exercise-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #eee;
  position: relative;
  background: var(--primary);
  color: white;
  border-radius: 12px 12px 0 0;
}

.exercise-header h3 {
  color: #FFD700 !important; /* Rich gold */
  margin: 0;
  font-size: 1.5rem !important;
  font-weight: 700;
  text-align: center;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  padding: 0.5rem 0;
}

/* For the PDF header close button specifically */
.pdf-header .close-exercise {
  position: relative; /* Change from absolute to relative */
  top: auto;
  right: auto;
  background: #dc3545 !important;
  border: none;
  color: white !important;
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  margin-left: 10px; /* Space from zoom controls */
  order: 3; /* Ensure it's at the end */
}

.pdf-header .close-exercise:hover {
  background: #c82333 !important;
  transform: scale(1.1);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  margin: 1rem 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.score-display {
  font-weight: 600;
  font-size: 1.1rem;
}

.exercise-content {
  padding: 2rem;
  max-height: 70vh;
  overflow-y: auto;
  flex: 1;
  padding-left: 1.5rem; /* Ensure consistent padding */
  padding-right: 1.5rem; /* Ensure consistent padding */
  box-sizing: border-box; /* Include padding in width calculation */
}

/* ===== ENHANCED EXERCISE FOOTER BUTTONS ===== */
.exercise-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  border-radius: 0 0 12px 12px;
  margin-top: auto; /* Add this - pushes footer to bottom */
  min-height: 0px; /* Add this - ensures enough space */
}

.exercise-footer .btn-group {
  display: flex;
  gap: 1rem;
}

/* Improved button styles */
.prev-exercise, .submit-answer, .next-exercise {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.submit-answer {
  background: var(--accent);
  color: white;
}

.submit-answer:hover:not(:disabled) {
  background: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.prev-exercise {
  background: var(--primary);
  color: white;
  opacity: 0.9;
}

.prev-exercise:hover:not(:disabled) {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.next-exercise {
  background: var(--success);
  color: white;
}

.next-exercise:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Disabled state */
.prev-exercise:disabled, 
.submit-answer:disabled, 
.next-exercise:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

/* Exercise structure */
.exercise {
  margin-bottom: 2rem;
}

.exercise-question {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--primary);
  line-height: 1.5;
}

.exercise-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option-label {
  display: flex;
  align-items: center;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-color);
}

.option-label:hover {
  border-color: var(--primary);
  background: rgba(0, 51, 102, 0.05);
  transform: translateX(5px);
}

.option-label input {
  margin-right: 1rem;
  transform: scale(1.1);
}

.option-text {
  flex: 1;
}

.writing-answer {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  background: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
}

.writing-answer:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.exercise-feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  animation: slideDown 0.3s ease-out;
}

.feedback.correct {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.feedback.incorrect {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
}

.feedback.info {
  background: rgba(0, 51, 102, 0.1);
  border: 1px solid var(--primary);
  color: var(--primary);
}

.explanation {
  margin-top: 0.5rem;
  font-style: italic;
  color: inherit;
  opacity: 0.9;
}

.model-answer {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(0, 51, 102, 0.05);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
  animation: slideDown 0.3s ease-out;
}

.completion-screen {
  text-align: center;
  padding: 2rem;
}

.completion-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 1s ease-in-out;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.score-summary {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1rem 0;
  color: var(--primary);
}

.performance-message {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-color);
}

/* ===== SPLIT SCREEN LAYOUT FOR PDF + EXERCISES ===== */
.split-screen {
  max-width: 99vw !important;  /* Increased from 98vw */
  width: 99vw !important;      /* Increased from 98vw */
  height: 90vh !important;
  max-height: 90vh !important;
  margin: 0.5rem 0 0.5rem 0 !important;  /* No left margin */
  animation: none !important;
  position: relative;
  left: -30px;  /* Pulls it even further left */
}

.split-screen-container {
  display: flex;
  height: 100%;
  gap: 1.5rem;
  min-height: 0;
}

/* FIX: Allow native touch scrolling and text selection inside PDF container */
.pdf-section {
  flex: 1.3;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;            /* keep container clipping */
  position: relative;
  -webkit-touch-callout: default;  /* allow long-press menus on iOS */
  -webkit-user-select: auto;       /* allow selection inside iframe / selectable areas */
  -khtml-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
  touch-action: pan-y;        /* allow vertical pan gestures (important for iOS) */
  box-shadow: var(--box-shadow);
}


.pdf-header {
  padding: 1rem;
  background: var(--primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  position: relative; /* Add this */
  top: 0px; /* Adjust as needed */
}

.pdf-header h3 {
  color: white;
  margin: 0;
  font-size: 1.1rem;
  flex: 1; /* Add this to allow space for controls */
}

/* Add this for the controls container */
.pdf-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Space between restart and X button */
  position: absolute; /* Position them together */
  right: 1rem; /* Align to right */
  top: 50%;
  transform: translateY(-50%);
}

/* Adjust the close button */
.pdf-header .close-exercise {
  position: relative !important; /* Change from absolute to relative */
  top: auto !important;
  right: auto !important;
  margin: 0 !important;
  order: 2; /* Make it second in flex order */
}
/* PDF viewer scroll fixes */
.pdf-viewer {
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  width: 100%;
}

/* FIX: Responsive iframe — allow internal scrolling on mobile and remove forced min-width */
#pdfIframe {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;               /* prevents horizontal overflow on small screens */
  border: none;
  box-sizing: border-box;
  overflow: auto;             /* allow iframe content to scroll if possible */
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
  pointer-events: auto;       /* ensure interaction */
  visibility: visible !important;
}

/* Keep hidden scrollbar styling if desired, but not at expense of scrolling */
#pdfIframe::-webkit-scrollbar { display: none; }


/* FIX: Unified, scrollable PDF container (mobile-friendly) */
.pdf-viewer {
  display: flex;
  flex-direction: column;
  flex: 1;                 /* fills available height */
  min-height: 0;           /* important for flexbox children to allow scrolling */
  position: relative;
  width: 100%;
  background: #f5f5f5;
  box-sizing: border-box;
}

.pdf-iframe-container {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;                 /* vertical scroll for multi-page PDFs */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;/* momentum scrolling on iOS */
  touch-action: pan-y;
  position: relative;
  background: white;
  box-sizing: border-box;
}

/* --------------------------------- DESKTOP: "x" and "restart" Buttons positions START ------------------------------ */
@media (min-width: 769px) {
  /* Method A: Adjust the PDF header itself */
  .pdf-header {
    padding-top: 1.5rem !important; /* Add more top padding */
    padding-bottom: 0.8rem !important;
  }
  
  /* Method B: Move the controls container */
  .pdf-controls {
    margin-top: -5px !important; /* Push down */
    margin-left: 6px !important;
    position: relative !important;
  }
  
  /* Method C: If using flex, adjust alignment */
  .pdf-header {
    align-items: flex-start !important; /* Align items to top */
    padding-top: 1.8rem !important;
  }
  
  .pdf-controls {
    align-self: flex-end !important; /* Push to bottom of header */
    margin-bottom: -5px !important;
  }
}
/* --------------------------------- DESKTOP: "x" and "restart" Buttons positions END ------------------------------ */

.pdf-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  visibility: visible !important;
}



.exercises-section {
  flex: 0.8;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  min-width: 400px;
  max-width: 600px;
  box-shadow: var(--box-shadow);
  height: 100%; /* Add this */
  min-height: 92vh; /* Add this - increases the height */
}

.split-screen .exercise-header {
  border-radius: 0;
  padding: 1rem;
  flex-shrink: 0;
}

.split-screen .exercise-content {
  flex: 1;
  overflow-y: auto;
  max-height: none;
}

.split-screen .exercise-footer {
  border-radius: 0;
  padding: 1rem;
  flex-shrink: 0;
}

/* PDF Controls */
.pdf-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}



/* Exercise specific styles */
.tf-statement {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: var(--bg-color);
}

.statement-text {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--dark);
}

.tf-options {
  display: flex;
  gap: 1rem;
}

.tf-options .option-label {
  flex: 1;
}

.fill-blank-sentence {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.blank-input, .blank-select {
  padding: 0.5rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: white;
  min-width: 120px;
  margin: 0 0.3rem;
}

.matching-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%; /* Add this */
  overflow: hidden; /* Add this */
}

.matching-item {
  display: flex;
  align-items: center;
  gap: 0.8rem; /* Reduced from 1rem */
  padding: 0.8rem; /* Reduced from 1rem */
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  max-width: 100%; /* Add this */
}

.matching-word {
  font-weight: 600;
  min-width: 120px;
  color: var(--primary);
}

.matching-select {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: white;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 250px; /* Add minimum width */
  margin-right: 1rem; /* Add right margin to push it left and create more space on right */
  width: 100%; /* Make it take full available width */
}

.sentence-rearrangement {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.rearrangement-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.rearrangement-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Print prevention */
@media print {
  .pdf-section,
  .pdf-viewer,
  .pdf-viewer iframe,
  .split-screen .pdf-section {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Enhanced responsive design */
@media (max-width: 1200px) {
  .split-screen-container {
    gap: 1rem;
  }
  
  .exercises-section {
    min-width: 350px;
  }
}

@media (max-width: 1024px) {
  .split-screen-container {
    flex-direction: column;
    height: auto;
    max-height: 90vh;
  }
  
  .pdf-section,
  .exercises-section {
    min-width: unset;
    width: 100%;
    flex: none;
  }
  
  .pdf-section {
    height: 50vh;
  }
  
  .exercises-section {
    height: 40vh;
  }
  
  .split-screen {
    height: 95vh !important;
  }
}

@media (max-width: 768px) {
  .pdf-watermark {
    font-size: 2.5rem;
  }
  
  .split-screen {
    padding: 0.5rem;
    height: 97vh !important;
  }
  
  .pdf-header,
  .exercise-header,
  .exercise-footer {
    padding: 0.75rem;
  }
  
  .exercise-content {
    padding: 1rem;
  }
  
  .exercise-footer {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .exercise-footer .btn-group {
    width: 100%;
    justify-content: space-between;
  }
  
  .prev-exercise,
  .submit-answer,
  .next-exercise {
    min-width: auto;
    flex: 1;
  }
  
  .matching-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .matching-word {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .pdf-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .exercise-question {
    font-size: 1.1rem;
  }
  
  .option-label {
    padding: 0.75rem;
  }
  
  .tf-options {
    flex-direction: column;
  }
}

/* High DPI displays optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .pdf-viewer iframe {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}
/* Developer Credit Styles */
.developer-credit {
  margin: 1rem 0;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  text-align: center;
}

.developer-credit p {
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  opacity: 0.9;
  line-height: 1.3;
}

.developer-social-links {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
}

.developer-social-links a {
  color: white;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  width: 32px;
  height: 32px;
  position: relative;
  z-index: 1;
}

.developer-social-links a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.developer-social-links a:active {
  transform: translateY(0);
}
/* New header layout */
/* ===== ULTRA-COMPACT CONSOLE HEADER ===== */
.sections-overview .exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.8rem;
  background: var(--primary);
  color: white;
  border-radius: 8px 8px 0 0;
  min-height: 35px;
  gap: 0.5rem; /* Reduced gap */
}

.sections-overview .exercise-header h3 {
  color: #FFD700 !important;
  margin: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: auto; /* Add this to push progress info to right */
}


.sections-overview .progress-info {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  /* Remove any restart button inside */
}

/* Add this to hide any restart button in progress-info */
.sections-overview .progress-info .restart-pdf-btn {
  display: none !important;
}

/*---------------------------------------- PROFESSIONAL OVERALL-PROGRESS START -----------------------------------------------*/
.sections-overview .overall-progress {
  /* Modern color palette - Ocean Blue to Deep Purple gradient */
  --c1: #4A6BFF;      /* Electric Blue */
  --c2: #7B42F6;      /* Vibrant Purple */
  --c3: #FF4A8A;      /* Pink accent */
  --glow: rgba(123, 66, 246, 0.25);
  --pad: .2rem .9rem;
  
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: var(--pad);
  font-weight: 700;
  font-size: .85rem;
  line-height: 1.1;
  color: #FFFFFF;
  
  /* Advanced gradient with multiple stops */
  background: linear-gradient(90deg, 
    var(--c1) 0%, 
    color-mix(in srgb, var(--c1) 60%, var(--c2) 40%) 25%,
    var(--c2) 50%,
    color-mix(in srgb, var(--c2) 60%, var(--c3) 40%) 75%,
    var(--c3) 100%
  );
  
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  min-height: 42px;
  min-width: fit-content;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  
  /* Professional multi-layer shadow */
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.1),
    0 10px 30px rgba(74, 107, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 8px rgba(0, 0, 0, 0.2);
  
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  backdrop-filter: blur(10px);
}

/* Modern badge with 3D effect */
.sections-overview .overall-progress .badge {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 4px;
  background: linear-gradient(145deg, 
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.6) 100%
  );
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
  transform: perspective(100px) rotateX(15deg);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { opacity: 0.9; transform: perspective(100px) rotateX(15deg) scale(1); }
  50% { opacity: 1; transform: perspective(100px) rotateX(15deg) scale(1.1); }
}

/* Professional sheen effect */
.sections-overview .overall-progress .sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, 
    transparent 10%, 
    rgba(255, 255, 255, 0.3) 45%, 
    rgba(255, 255, 255, 0.1) 60%, 
    transparent 90%
  );
  transform: translateX(-150%) skewX(-15deg);
  will-change: transform;
  transition: transform 1.2s cubic-bezier(0.215, 0.61, 0.355, 1);
  mix-blend-mode: overlay;
  opacity: 0.8;
}

/* Dynamic glow layer */
.sections-overview .overall-progress::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at center,
    rgba(123, 66, 246, 0.3) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

/* Outer glow effect */
.sections-overview .overall-progress::after {
  content: "";
  position: absolute;
  left: -5px;
  top: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 999px;
  background: radial-gradient(
    circle at center,
    var(--glow) 0%,
    transparent 70%
  );
  filter: blur(15px);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -2;
  pointer-events: none;
}

/* PROFESSIONAL HOVER EFFECT */
.sections-overview .overall-progress:hover,
.sections-overview .overall-progress:focus {
  transform: translateY(-3px) scale(1.02);
  
  /* Enhanced gradient on hover */
  background: linear-gradient(90deg, 
    color-mix(in srgb, var(--c1) 90%, white 10%) 0%,
    color-mix(in srgb, var(--c1) 50%, var(--c2) 50%) 25%,
    color-mix(in srgb, var(--c2) 90%, white 10%) 50%,
    color-mix(in srgb, var(--c2) 50%, var(--c3) 50%) 75%,
    color-mix(in srgb, var(--c3) 90%, white 10%) 100%
  );
  
  box-shadow:
    0 8px 25px rgba(74, 107, 255, 0.3),
    0 15px 40px rgba(123, 66, 246, 0.25),
    0 0 60px rgba(255, 74, 138, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 10px rgba(0, 0, 0, 0.3);
  
  border-color: rgba(255, 255, 255, 0.4);
  animation: buttonFloat 3s ease-in-out infinite;
}

@keyframes buttonFloat {
  0%, 100% { transform: translateY(-3px) scale(1.02); }
  50% { transform: translateY(-5px) scale(1.02); }
}

/* Sheen animation on hover */
.sections-overview .overall-progress:hover .sheen,
.sections-overview .overall-progress:focus .sheen {
  transform: translateX(150%) skewX(-15deg);
  transition-duration: 0.8s;
  opacity: 1;
}

/* Glow effects on hover */
.sections-overview .overall-progress:hover::before,
.sections-overview .overall-progress:focus::before {
  opacity: 0.6;
}

.sections-overview .overall-progress:hover::after,
.sections-overview .overall-progress:focus::after {
  opacity: 0.8;
}

/* PROFESSIONAL ACTIVE STATE */
.sections-overview .overall-progress:active {
  transform: translateY(0) scale(0.98);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  
  box-shadow:
    0 2px 8px rgba(74, 107, 255, 0.2),
    0 0 20px rgba(123, 66, 246, 0.15),
    inset 0 3px 12px rgba(0, 0, 0, 0.25);
}

/* Ripple effect - enhanced */
.sections-overview .overall-progress .ripple {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, 
    rgba(255, 255, 255, 0.3) 0%,
    transparent 70%
  );
  opacity: 0;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), 
              opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sections-overview .overall-progress:active .ripple {
  transform: translate(-50%, -50%) scale(12);
  opacity: 0.4;
  transition-duration: 0.4s;
}

/* Accessibility focus */
.sections-overview .overall-progress:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 4px;
}

/* Text styling */
.sections-overview .overall-progress .progress-text {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Status indicator dot */
.sections-overview .overall-progress .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(145deg, #34D399, #10B981);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
}

/*---------------------------------------- PROFESSIONAL OVERALL-PROGRESS END -----------------------------------------------*/

/*---------------------------------------- PROFESSIONAL PROGRESS-BAR START -----------------------------------------------*/
.sections-overview .progress-bar {
  width: 140px;
  height: 18px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 0.4rem;
  
  /* Professional 3D inset effect */
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 -1px 2px rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.1);
  
  position: relative;
}

/* Outer glow container */
.sections-overview .progress-bar::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(90deg, 
    rgba(74, 107, 255, 0.3),
    rgba(123, 66, 246, 0.3)
  );
  filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.sections-overview .progress-bar:hover::before {
  opacity: 0.6;
}

/* Modern gradient fill */
.sections-overview .progress-bar .progress-fill {
  height: 100%;
  border-radius: 12px;
  
  /* Neon gradient with multiple stops */
  background: linear-gradient(90deg,
    #00FFCC 0%,        /* Cyan */
    #00FF9D 25%,       /* Bright Green */
    #00FF6A 50%,       /* Neon Green */
    #00FFCC 75%,       /* Back to Cyan */
    #00FF9D 100%
  );
  
  background-size: 200% 100%;
  position: relative;
  
  /* Glow effects */
  box-shadow:
    0 0 15px rgba(0, 255, 204, 0.7),
    0 0 30px rgba(0, 255, 157, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s ease;
  
  /* Animation for gradient movement */
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Shine overlay */
.sections-overview .progress-bar .progress-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 20%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.3) 80%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: shine 2s ease-in-out infinite;
  mix-blend-mode: overlay;
}

@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* Particle effect dots */
.sections-overview .progress-bar .progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.4) 2px, transparent 2px),
    radial-gradient(circle at 60% 30%, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
    radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.3) 1px, transparent 1px);
  background-size: 20px 20px;
  animation: particles 20s linear infinite;
  mix-blend-mode: overlay;
  opacity: 0.5;
}

@keyframes particles {
  0% { background-position: 0 0, 10px 10px, 20px 20px; }
  100% { background-position: 40px 40px, 50px 50px, 60px 60px; }
}

/* Percentage text inside progress bar */
.sections-overview .progress-bar .percentage {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.7);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 1;
}

/* Progress bar glow on completion */
.sections-overview .progress-bar.complete .progress-fill {
  animation: completeGlow 2s ease-in-out infinite;
}

@keyframes completeGlow {
  0%, 100% { 
    box-shadow: 
      0 0 15px rgba(0, 255, 204, 0.7),
      0 0 30px rgba(0, 255, 157, 0.5);
  }
  50% { 
    box-shadow: 
      0 0 25px rgba(0, 255, 204, 0.9),
      0 0 50px rgba(0, 255, 157, 0.7),
      0 0 75px rgba(0, 255, 170, 0.5);
  }
}


/* ===== MOBILE RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  /* Mobile Progress Container */
  .sections-overview .overall-progress {
    --mobile-shift-y: -6px;
    --mobile-shift-x: 0px;
    
    padding: 0.15rem 0.7rem;
    min-height: 36px;
    font-size: 0.75rem;
    gap: 0.4rem;
    transform: translate(var(--mobile-shift-x), var(--mobile-shift-y));
    
    /* Scale down shadows for mobile */
    box-shadow:
      0 3px 6px rgba(0, 0, 0, 0.15),
      0 6px 20px rgba(74, 107, 255, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  
  /* Mobile Progress Bar */
  .sections-overview .progress-bar {
    width: 110px;
    height: 16px;
    margin-left: 0.3rem;
    margin-top: 0.02rem;
    transform: translateY(calc(var(--mobile-shift-y) * 0.8));
    
    /* Simplify animations on mobile for performance */
    .progress-fill {
      animation: gradientShift 4s ease-in-out infinite;
    }
  }
  
  /* Small phone adjustments */
  @media (max-width: 420px) {
    .sections-overview .overall-progress {
      padding: 0.12rem 0.6rem;
      min-height: 32px;
      font-size: 0.7rem;
      gap: 0.3rem;
    }
    
    .sections-overview .progress-bar {
      width: 90px;
      height: 14px;
      
      /* Disable heavy animations on very small devices */
      .progress-fill::after,
      .progress-fill::before {
        animation: none;
      }
    }
  }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
@media (prefers-color-scheme: dark) {
  .sections-overview .overall-progress {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow:
      0 4px 6px rgba(0, 0, 0, 0.3),
      0 10px 30px rgba(74, 107, 255, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      inset 0 -2px 8px rgba(0, 0, 0, 0.4);
  }
  
  .sections-overview .progress-bar {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 
      inset 0 2px 4px rgba(0, 0, 0, 0.5),
      inset 0 -1px 2px rgba(255, 255, 255, 0.05);
  }
  
  .sections-overview .progress-bar .percentage {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
}

/* ===== REDUCED MOTION PREFERENCES ===== */
@media (prefers-reduced-motion: reduce) {
  .sections-overview .overall-progress,
  .sections-overview .overall-progress .sheen,
  .sections-overview .overall-progress::before,
  .sections-overview .overall-progress::after,
  .sections-overview .progress-bar .progress-fill,
  .sections-overview .progress-bar .progress-fill::before,
  .sections-overview .progress-bar .progress-fill::after {
    animation: none !important;
    transition: none !important;
  }
  
  .sections-overview .overall-progress:hover,
  .sections-overview .overall-progress:focus {
    animation: none !important;
  }
}
/*---------------------------------------- PROFESSIONAL PROGRESS-BAR END -----------------------------------------------*/

/* ===== COMPACT EXERCISE HEADER (when inside an exercise) ===== */
.exercises-section .exercise-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background: var(--primary);
  color: white;
  border-radius: 8px 8px 0 0;
  min-height: 35px;
}

.exercises-section .header-top {
  display: flex;
  justify-content: center;
  align-items: center;
}

.exercises-section .exercise-header .header-top .exercise-title {
  color: #FFD700 !important;
  margin: 0;
  font-size: 0.9rem !important;
  font-weight: 700;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.exercises-section .header-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.exercises-section .progress-score-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* ===== EXERCISE COUNTER + SECTION SCORE — pill badges ===== */
.exercises-section .exercise-counter,
.exercises-section .score-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.56rem;   /* ← controls height & horizontal padding */
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  border-radius: 999px;       /* pill shape */
  box-shadow: 0 6px 18px rgba(2,6,23,0.10);
  white-space: nowrap;
}

/* ---------------------------------------------- Exercise and Section Score design START ---------------------------------------- */

/* CONTAINER FOR POSITIONING CONTROL */
/* Adjust these values to move the ENTIRE button group */
.exercises-section .progress-score-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  position: relative;
  z-index: 100;
  margin-left: 7px

}

/* Base button styles - keeping original colors but cleaner design */
.exercises-section .exercise-counter,
.exercises-section .score-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  border-radius: 999px; /* Perfect pill shape */
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.02em;
  min-width: 110px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  
  /* Clean solid background without rectangular effects */
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* EXERCISE COUNTER - Purple theme */
.exercises-section .exercise-counter {
  background: linear-gradient(135deg, #ab05f3 0%, #8a09ed 70%, #6a00ff 100%);
  border-color: rgba(171, 5, 243, 0.4);
  
  /* Fixed subtle glow animation - no glitches */
  animation: exerciseGlow 6s ease-in-out infinite;
}

/* ===== INDIVIDUAL BUTTON POSITIONING ===== */
/* Move EXERCISE button individually on DESKTOP: */
/* .exercises-section .exercise-counter {
  position: relative;
  top: -5px; */ /* Move UP 5px */
  /* top: 5px; */ /* Move DOWN 5px */
  /* left: -10px; */ /* Move LEFT 10px */
  /* right: 10px; */ /* Move RIGHT 10px */
/* } */

/* Fixed smooth glow animation */
@keyframes exerciseGlow {
  0%, 100% { 
    box-shadow: 
      0 4px 12px rgba(171, 5, 243, 0.2);
  }
  50% { 
    box-shadow: 
      0 6px 20px rgba(171, 5, 243, 0.35);
  }
}

/* SCORE DISPLAY - Green theme */
.exercises-section .score-display {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 70%, #0d8f3d 100%);
  border-color: rgba(34, 197, 94, 0.4);
  
  /* Fixed subtle pulse animation - no glitches */
  animation: scorePulse 7s ease-in-out infinite;
}

/* Move SCORE button individually on DESKTOP: */
/* .exercises-section .score-display {
  position: relative;
  top: -5px; */ /* Move UP 5px */
  /* top: 5px; */ /* Move DOWN 5px */
  /* left: -10px; */ /* Move LEFT 10px */
  /* right: 10px; */ /* Move RIGHT 10px */
/* } */

/* Fixed smooth pulse animation */
@keyframes scorePulse {
  0%, 100% { 
    box-shadow: 
      0 4px 12px rgba(34, 197, 94, 0.2);
  }
  50% { 
    box-shadow: 
      0 6px 20px rgba(34, 197, 94, 0.35);
  }
}

/* Fixed hover effects without animation glitches */
.exercises-section .exercise-counter:hover,
.exercises-section .score-display:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  animation-play-state: paused; /* Pause base animation on hover */
}

.exercises-section .exercise-counter:hover {
  box-shadow: 
    0 8px 25px rgba(171, 5, 243, 0.4);
}

.exercises-section .score-display:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 25px rgba(34, 197, 94, 0.4);
}

/* Active state */
.exercises-section .exercise-counter:active,
.exercises-section .score-display:active {
  transform: translateY(0);
  filter: brightness(0.95);
  transition-duration: 0.1s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Clean shine effect on hover - FIXED */
.exercises-section .exercise-counter::before,
.exercises-section .score-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transform: skewX(-15deg);
  transition: left 0.7s ease;
  z-index: 1;
}

.exercises-section .exercise-counter:hover::before,
.exercises-section .score-display:hover::before {
  left: 100%;
}

/* Score value */
.exercises-section .score-display #current-score {
  font-weight: 900;
  font-size: 0.9em;
  margin-left: 3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
}

/* ===== MOBILE POSITIONING CONTROLS ===== */
@media (max-width: 768px) {
  .exercises-section .progress-score-container {
    /* ===== MOBILE POSITIONING FOR BUTTON GROUP ===== */
    /* To move UP/DOWN on MOBILE: */
    /* margin-top: -10px; */ /* Move UP 10px on mobile */
    /* margin-top: 10px; */ /* Move DOWN 10px on mobile */
    
    /* To move LEFT/RIGHT on MOBILE: */
    /* margin-left: -15px; */ /* Move LEFT 15px on mobile */
    /* margin-right: 15px; */ /* Move RIGHT 15px on mobile */
    
    /* Mobile-specific adjustments */
    gap: 0.6rem;
    justify-content: center; /* Center buttons on mobile */
    margin-top: 5px; /* Default small spacing */
  }
  
  .exercises-section .exercise-counter,
  .exercises-section .score-display {
    /* Less responsive scaling on mobile */
    padding: 0.3rem 0.8rem !important;
    font-size: 0.78rem !important;
    min-width: 100px !important;
    
    /* Slower, simpler animations on mobile to prevent glitches */
    animation-duration: 8s !important;
    
    left:50px;
  }
  
  /* Slower animations on mobile to prevent glitches */
  .exercises-section .exercise-counter {
    animation: exerciseGlow 8s ease-in-out infinite !important;
  }
  
  .exercises-section .score-display {
    animation: scorePulse 9s ease-in-out infinite !important;
  }
  
  /* Less movement on hover for mobile */
  .exercises-section .exercise-counter:hover,
  .exercises-section .score-display:hover {
    transform: translateY(-1px);
  }
  
  /* Simpler hover effects on mobile */
  .exercises-section .exercise-counter:hover::before,
  .exercises-section .score-display:hover::before {
    transition: none; /* Disable shine effect on mobile if needed */
  }
}

/* ===== TABLET POSITIONING (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .exercises-section .progress-score-container {
    /* Tablet-specific positioning if needed */
    /* margin-top: -5px; */
    /* margin-right: 15px; */
  }
  
  .exercises-section .exercise-counter,
  .exercises-section .score-display {
    min-width: 105px;
    font-size: 0.8rem;
  }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  .exercises-section .exercise-counter {
    background: linear-gradient(135deg, #b91ff3 0%, #8a09ed 70%, #6a00ff 100%);
    border-color: rgba(185, 31, 243, 0.5);
  }
  
  .exercises-section .score-display {
    background: linear-gradient(135deg, #22d96c 0%, #16a34a 70%, #0d8f3d 100%);
    border-color: rgba(34, 217, 108, 0.5);
  }
  
  /* Slightly stronger glow in dark mode */
  .exercises-section .exercise-counter {
    animation: exerciseGlow 5s ease-in-out infinite;
  }
  
  .exercises-section .score-display {
    animation: scorePulse 6s ease-in-out infinite;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .exercises-section .exercise-counter,
  .exercises-section .score-display,
  .exercises-section .exercise-counter:hover,
  .exercises-section .score-display:hover {
    animation: none !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
  }
  
  .exercises-section .exercise-counter:hover,
  .exercises-section .score-display:hover {
    transform: none !important;
    opacity: 0.9 !important;
  }
  
  .exercises-section .exercise-counter::before,
  .exercises-section .score-display::before {
    display: none !important;
  }
}

/* ===== QUICK POSITIONING CLASSES (OPTIONAL) ===== */
/* Add these classes to your HTML for quick adjustments */
.progress-score-container.move-up {
  margin-top: -10px !important;
}
.progress-score-container.move-down {
  margin-top: 10px !important;
}
.progress-score-container.move-left {
  margin-left: -15px !important;
  margin-right: 0 !important;
}
.progress-score-container.move-right {
  margin-right: 15px !important;
  margin-left: 0 !important;
}

/* Individual button quick positioning */
.exercise-counter.move-up {
  position: relative !important;
  top: -5px !important;
}
.exercise-counter.move-down {
  position: relative !important;
  top: 5px !important;
}
.score-display.move-left {
  position: relative !important;
  left: -10px !important;
}
.score-display.move-right {
  position: relative !important;
  right: -10px !important;
}

/* Positioning helper for testing */
.exercises-section .progress-score-container.position-helper::after {
  content: 'Position Helper - Remove this class';
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 10px;
  color: #666;
  background: #f0f0f0;
  padding: 2px 5px;
  border-radius: 3px;
  z-index: 1000;
}
/* ---------------------------------------------- Exercise and Section Score design END ---------------------------------------- */

/* spacing between badges */
.exercises-section .exercise-counter + .score-display { margin-left: 0.35rem; }


/* ===========================================
   FIXED CONSOLE BUTTON - MOBILE HEIGHT & LAYOUT
   - Proper height matching Exercise & Score buttons
   - Fixed layout spacing issues
   - No left-shift of adjacent buttons
   =========================================== */

/* ===== DESKTOP: Perfect Console Button (keep existing) ===== */
.exercises-section .return-to-console.console-btn {
  /* EXACT SAME SIZE as Exercise & Score buttons */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.85rem !important;
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  min-height: 32px !important;
  line-height: 1.2 !important;
  
  /* Same pill shape as other buttons */
  border-radius: 999px !important;
  box-shadow: 0 6px 18px rgba(2,6,23,0.10) !important;
  
  /* Vibrant gradient coloring */
  background: linear-gradient(135deg, 
    #4A6BFF 0%,
    #7B42F6 33%,
    #FF4A8A 66%,
    #FF8C40 100%
  );
  
  color: white !important;
  border: none !important;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Icon inside button */
.exercises-section .return-to-console.console-btn i {
  font-size: 0.85rem !important;
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.3rem;
}

/* Hover effects */
.exercises-section .return-to-console.console-btn:hover,
.exercises-section .return-to-console.console-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(74, 107, 255, 0.25) !important;
}

/* ===== MOBILE: FIXED HEIGHT & PROPER LAYOUT ===== */
@media (max-width: 768px) {
  /* MAIN FIX: Ensure header-bottom has proper layout control */
  .exercises-section .header-bottom {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    margin-top: 0.3rem !important;
    position: relative;
    min-height: 32px !important; /* Set minimum height for the row */
  }
  
  /* CONSOLE BUTTON: PROPER HEIGHT that matches Exercise & Score */
  .exercises-section .return-to-console.console-btn {
    /* FIXED: Proper height matching Exercise & Score */
    min-height: 20px !important;
    height: 20px !important; /* Explicit height to match */
    padding: 0.25rem 0.7rem !important; /* Adequate padding for height */
    font-size: 0.68rem !important;
    line-height: 1 !important;
    
    /* Position: Left side, doesn't affect other elements */
    order: 1 !important;
    flex-shrink: 0; /* Don't shrink */
    margin-right: -8rem !important;
    margin-top: 0rem !important;
    
    /* Proper visual styling */
    box-shadow: 0 4px 10px rgba(74, 107, 255, 0.15) !important;
    background: linear-gradient(135deg, #4A6BFF 0%, #7B42F6 60%, #FF4A8A 100%);
    
    /* Ensure it doesn't push other elements */
    max-width: 120px; /* Limit width */
  }
  
  /* Icon adjustment */
  .exercises-section .return-to-console.console-btn i {
    font-size: 0.75rem !important;
    margin-right: 0.3rem !important;
  }
  
  /* PROGRESS SCORE CONTAINER: Right side, fixed positioning */
  .exercises-section .progress-score-container {
    order: 2 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important; /* Proper spacing between Exercise & Score */
    flex-shrink: 0; /* Don't shrink */
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0.5rem !important; /* Add space from console button */
    
    /* Prevent left shift - ensure it stays on right */
    position: relative;
    right: 0;
    justify-self: flex-end;
  }
  
  /* Exercise Counter - original size preserved */
  .exercises-section .exercise-counter {
    font-size: 0.68rem !important;
    padding: 0.22rem 0.55rem !important;
    min-height: 28px !important; /* Match console button height */
    height: 28px !important;
    line-height: 1 !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  /* Score Display - original size preserved */
  .exercises-section .score-display {
    font-size: 0.68rem !important;
    padding: 0.22rem 0.55rem !important;
    min-height: 28px !important; /* Match console button height */
    height: 28px !important;
    line-height: 1 !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  /* Add visual separator if needed */
  .exercises-section .progress-score-container::before {
    content: '';
    position: absolute;
    left: -0.2rem;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 1px;
    background: rgba(0, 0, 0, 0.1);
    display: none; /* Hidden by default, can enable if needed */
  }
}

/* ===== SMALL PHONES: Maintain proportions ===== */
@media (max-width: 480px) {
  .exercises-section .header-bottom {
    gap: 0.25rem !important;
    min-height: 28px !important;
  }
  
  /* Console button - maintain proper height */
  .exercises-section .return-to-console.console-btn {
    min-height: 26px !important;
    height: 26px !important;
    padding: 0.2rem 0.6rem !important;
    font-size: 0.65rem !important;
    max-width: 110px;
  }
  
  /* Icon adjustment */
  .exercises-section .return-to-console.console-btn i {
    font-size: 0.7rem !important;
    margin-right: 0.25rem !important;
  }
  
  /* Adjust other buttons proportionally */
  .exercises-section .exercise-counter,
  .exercises-section .score-display {
    font-size: 0.65rem !important;
    padding: 0.2rem 0.5rem !important;
    min-height: 26px !important;
    height: 26px !important;
  }
  
  /* Reduce gap between Exercise and Score */
  .exercises-section .progress-score-container {
    gap: 0.25rem !important;
    padding-left: 0.4rem !important;
  }
}

/* ===== ULTRA SMALL PHONES: Compact but proportional ===== */
@media (max-width: 380px) {
  /* Optional: Hide text, show only icon */
  .exercises-section .return-to-console.console-btn span {
    display: inline !important; /* Keep text visible */
  }
  
  .exercises-section .return-to-console.console-btn {
    padding: 0.18rem 0.5rem !important;
    font-size: 0.62rem !important;
    max-width: 100px;
  }
  
  .exercises-section .return-to-console.console-btn i {
    font-size: 0.65rem !important;
    margin-right: 0.2rem !important;
  }
  
  .exercises-section .exercise-counter,
  .exercises-section .score-display {
    font-size: 0.62rem !important;
    padding: 0.18rem 0.45rem !important;
  }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  .exercises-section .return-to-console.console-btn {
    background: linear-gradient(135deg, 
      #5A7BFF 0%,
      #8B52FF 33%,
      #FF5A9A 66%,
      #FFB347 100%
    );
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3) !important;
  }
}

/* ===== LAYOUT DEBUGGING HELPERS (remove in production) ===== */
/*
.exercises-section .header-bottom {
  border: 1px dashed red;
}
.exercises-section .return-to-console.console-btn {
  border: 1px solid blue;
}
.exercises-section .progress-score-container {
  border: 1px solid green;
}
*/


/* ===== ULTRA-MINIMAL MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
  /* Console Header - Ultra Minimal */
  .sections-overview .exercise-header {
    padding: 0.15rem 0.4rem !important;
    gap: 0.3rem !important;
    min-height: 28px !important;
    flex-wrap: nowrap;
  }
  
  .sections-overview .exercise-header h3 {
    font-size: 0.7rem !important;
    display: none; /* Hide "Interactive Exercises" text on mobile */
  }
  
  .sections-overview .header-controls {
    gap: 0.3rem !important;
    margin-left: 0 !important;
    flex: 1;
    justify-content: space-between;
  }

  .sections-overview .restart-pdf-btn.return-btn-top span {
    display: none; /* Hide "Restart PDF" text, keep only icon */
  }
  
  .sections-overview .progress-info {
    gap: 0.1rem !important;
    flex: 1;
    justify-content: flex-end;
  }
  
  .sections-overview .overall-progress {
    font-size: 0.6rem !important;
    margin-right: 0.05rem !important;
  }
  
  .sections-overview .progress-bar {
    width: 40px !important;
    height: 3px !important;
    margin-left: 0.05rem !important;
  }
  
  /* Exercise Header - Ultra Minimal */
  .exercises-section .exercise-header {
    padding: 0.15rem 0.4rem !important;
    min-height: 50px !important;
    gap: 0.15rem !important;
  }
  
  .exercises-section .exercise-header .header-top .exercise-title {
    font-size: 0.75rem !important;
    line-height: 1.2;
  }
  
  .exercises-section .header-bottom {
    gap: 0.3rem !important;
    flex-wrap: wrap;
  }
  
  .exercises-section .progress-score-container {
    gap: 0.4rem !important;
    order: 2;
    width: 100%;
    justify-content: center;
    margin-top: 0.1rem;
  }
  
  .exercises-section .exercise-counter,
  .exercises-section .score-display {
    font-size: 0.65rem !important;
  }
  
  .exercises-section .return-to-console.console-btn {
    padding: 0.1rem 0.3rem !important;
    font-size: 0.6rem !important;
    min-height: 20px !important;
    order: 1;
    margin: 0 auto;
  }
  
  .exercises-section .return-to-console.console-btn span {
    display: none; /* Hide "Return to Console" text, keep only icon */
  }
  
  .exercises-section .progress-bar-container {
    margin-top: 0.1rem !important;
    order: 3;
  }
  
  .exercises-section .progress-bar {
    height: 3px !important;
  }
}

@media (max-width: 480px) {
  /* Extra small devices - even more minimal */
  .sections-overview .exercise-header {
    min-height: 25px !important;
    padding: 0.1rem 0.3rem !important;
  }
  
  .exercises-section .exercise-header {
    min-height: 45px !important;
    padding: 0.1rem 0.3rem !important;
  }
  
  .sections-overview .restart-pdf-btn.return-btn-top,
  .exercises-section .return-to-console.console-btn {
    min-height: 18px !important;
    padding: 0.08rem 0.25rem !important;
    font-size: 0.55rem !important;
  }
/*------------------------------Overal Progress BAR (MOBILE) START-----------------------------------*/
  .sections-overview .overview-bar {
    width: 80px !important;
    height: 9px !important;
    min-width: 64px !important;
    box-sizing: border-box !important;
}
/*------------------------------Overal Progress BAR (MOBILE) END-----------------------------------*/
  
  .exercises-section .exercise-counter,
  .exercises-section .score-display {
    font-size: 0.6rem !important;
  }
}
/* Ensure SVG icons are properly sized */
.developer-social-links svg {
  display: block;
  width: 14px;
  height: 14px;
}

@media (max-width: 768px) {
  .developer-credit p {
    font-size: 0.75rem;
  }
  
  .developer-social-links a {
    width: 28px;
    height: 28px;
    padding: 0.4rem;
  }
  
  .developer-social-links svg {
    width: 12px;
    height: 12px;
  }
}
/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* =========================
   MOBILE EXERCISE INTERFACE - ULTIMATE PDF FIX
   ========================= */

/* ---------- Mobile & small tablets ---------- */
@media (max-width: 768px) {
  /* fullscreen container */
  .exercise-container {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-color);
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* root split layout - OPTIMIZED POSITIONING */
  .split-screen,
  .split-screen-container {
    display: flex;
    flex-direction: column;
    height: 95vh !important;
    min-height: 0;
    gap: 0;
    margin: 0;
    padding: 0;
    border-radius: 0;
    left: auto !important;
    transform: translate(-15px, -19px) !important;
    overflow: visible;
    box-sizing: border-box;
  }

  /* PDF section - MAXIMIZED HEIGHT */
  .pdf-section {
    flex: 0 0 50vh;
    min-height: 45vh;
    max-height: 60vh;
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;
    position: relative;
  }

  /* PDF Header - ULTRA COMPACT */
  .pdf-header {
    padding: 0.25rem 0.4rem !important;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    box-sizing: border-box;
    background: var(--primary);
    position: relative;
    z-index: 10;
  }

  .pdf-header h3 {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45%;
    margin: 0;
    color: white;
    font-weight: 600;
  }

  .pdf-controls {
    gap: 0.15rem;
    display: flex;
    align-items: center;
  }

 @media (max-width: 768px) {
  /* PROFESSIONAL ZOOM/CLOSE BUTTONS - X SHOULD BE RED */
  .pdf-controls .zoom-btn {
    /* Keep zoom button as is (white) */
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--primary) !important;
  }
  
  .pdf-header .close-exercise {
    width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    font-size: 0.9rem !important; /* Slightly larger X */
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    border-radius: 50% !important; /* ← CHANGED TO 50% FOR ROUND SHAPE */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    margin-left: 5px !important;  
    
    /* MAKE IT RED like desktop */
    background: #dc3545 !important; /* ← RED background */
    border: 1.5px solid #c82333 !important; /* ← Darker red border */
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3) !important; /* Red shadow */
    color: white !important; /* ← White X */
    font-weight: 700 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
  }

  .pdf-header .close-exercise:hover {
    background: #c82333 !important; /* Darker red on hover */
    border-color: #b21f2d !important;
    transform: scale(1.08) !important;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4) !important;
  }
}

  /* CRITICAL PDF SCROLLING FIX - SIMPLIFIED APPROACH */
  .pdf-viewer {
    height: calc(50vh - 28px);
    min-height: 140px;
    overflow: hidden !important;
    box-sizing: border-box;
    position: relative;
    background: #f8f8f8;
  }

  .pdf-iframe-container {
    width: 100%;
    height: 100%;
    overflow: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box;
    position: relative;
    background: white;
    /* REMOVE ALL SECURITY BLOCKING - IT'S PREVENTING SCROLLING */
  }

  /* PDF IFRAME - SIMPLIFIED FOR SCROLLING */
 /* FIX: Do not force huge min-height — let the iframe/container scroll naturally */
#pdfIframe {
  width: 100% !important;
  height: 100% !important;   /* allow iframe to fill its scrollable container */
  min-height: 0 !important;  /* do NOT force an arbitrary huge height */
  border: none;
  display: block;
  box-sizing: border-box;

  overflow: auto !important;
  -webkit-overflow-scrolling: touch !important;
  pointer-events: auto !important;
  touch-action: pan-y !important;
}


  /* REMOVE THE SECURITY OVERLAY - IT'S BLOCKING SCROLLING */
  /* .pdf-iframe-container::after {
    display: none !important;
  } */

  /* Sections overview - COMPACT HEADER */
  .sections-overview .exercise-header {
    padding: 0.15rem 0.4rem;
    min-height: 32px;
    gap: 0.08rem;
    box-sizing: border-box;
    background: var(--primary);
  }

  .sections-overview .exercise-header h3 {
    font-size: 0.75rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #FFD700;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  }

  .sections-grid { 
    padding: 0.5rem; 
    gap: 0.5rem; 
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-btn { 
    padding: 0.8rem; 
    min-height: 60px; 
    box-sizing: border-box; 
  }

  .section-icon i:first-child { 
    font-size: 1.2rem; 
    width: 35px; 
    height: 35px; 
  }

  .section-info h4 { 
    font-size: 0.9rem; 
    margin-bottom: 0.3rem; 
  }
  .section-info p  { 
    font-size: 0.75rem; 
    margin-bottom: 0.5rem; 
    line-height: 1.2; 
  }

  /* Exercises section */
  .exercises-section {
    flex: 1 1 auto;
    min-width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-sizing: border-box;
    border-radius: 0;
    overflow: hidden;
  }

  /* Exercises Header - COMPACT */
  .exercises-section .exercise-header {
    padding: 0.15rem 0.4rem;
    min-height: 38px;
    gap: 0.08rem;
    box-sizing: border-box;
    background: var(--primary);
  }

  .exercise-title { 
    font-size: 0.75rem;
    line-height: 1.1; 
    margin: 0; 
    color: #FFD700; 
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  }

  /* Exercise content area */
  .exercise-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0.7rem;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    background: var(--bg-color);
  }

  /* ULTRA COMPACT EXERCISE FOOTER */
  .exercise-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.25rem 0.35rem !important;
    background: var(--card-bg);
    border-top: 1px solid #e0e0e0;
    z-index: 20;
    align-items: stretch;
    box-sizing: border-box;
    visibility: visible;
    opacity: 1;
    min-height: 42px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  }

  .exercise-footer .btn-group {
    width: 100%;
    display: flex;
    gap: 0.2rem;
    align-items: center;
  }

  /* COMPACT BUTTONS */
  .prev-exercise,
  .submit-answer,
  .next-exercise {
    min-height: 26px !important;
    height: 26px !important;
    font-size: 0.72rem !important;
    flex: 1 1 auto;
    margin: 0;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    opacity: 1;
    visibility: visible;
    box-sizing: border-box;
    padding: 0.22rem 0.45rem !important;
    min-width: 44px !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }

  .submit-answer { 
    background: var(--accent); 
    color: #fff; 
  }
  .prev-exercise  { 
    background: var(--primary); 
    color: #fff; 
  }
  .next-exercise  { 
    background: var(--success); 
    color: #fff; 
  }

  .next-exercise.stacked {
    width: 100% !important;
    margin-top: 0.08rem !important;
  }

  /* Exercise content styles */
  .exercise-options { gap: 0.5rem; }
  .option-label { min-height: 38px; padding: 0.5rem; margin: 0; box-sizing: border-box; }
  .option-label input { transform: scale(1.1); margin-right: 0.5rem; }

  .true-false-exercise .exercise-options { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .true-false-exercise .option-label { min-height: 40px; }

  .writing-answer, .blank-input {
    min-height: 38px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
  }
  .writing-answer { min-height: 90px; }

  /* Matching exercise */
  .matching-container { gap: 0.5rem; }
  .matching-item { gap: 0.3rem; padding: 0.5rem; box-sizing: border-box; }
  .matching-word { font-size: 0.8rem; }
  .matching-select { font-size: 0.8rem; }

  /* Accessibility */
  button:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* Smooth scrolling */
  .pdf-iframe-container,
  .exercise-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Zoom level display */
  .zoom-level {
    font-size: 0.7rem !important;
    min-width: 40px !important;
    text-align: center;
    padding: 0 !important;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  }
}

/* ---------- Extra small phones: further compaction ---------- */
@media (max-width: 480px) {
  .pdf-section { 
    flex: 0 0 48vh;
    min-height: 45vh; 
  }
  .exercises-section { height: auto; }

  .pdf-header h3 { 
    font-size: 0.7rem;
    max-width: 40%; 
  }
  .sections-overview .exercise-header h3 { 
    font-size: 0.7rem;
  }
  .exercise-title { 
    font-size: 0.7rem;
  }

  /* Hide non-essential labels */
  .restart-pdf-btn.return-btn-top span,
  .return-to-console.console-btn span { 
    display: none !important; 
  }

  .restart-pdf-btn.return-btn-top,
  .return-to-console.console-btn { 
    padding: 0.15rem !important;
    min-width: 26px !important;
  }

  /* Single column layout for very small screens */
  .true-false-exercise .exercise-options { 
    grid-template-columns: 1fr; 
    gap: 0.3rem; 
  }

  /* Ultra compact footer buttons */
  .prev-exercise,
  .submit-answer,
  .next-exercise {
    min-height: 28px !important;
    height: 28px !important;
    font-size: 0.7rem !important;
  }

  /* Hide button text, keep only icons */
  .prev-exercise .fa-arrow-left + span,
  .submit-answer .fa-check + span,
  .next-exercise .fa-arrow-right + span { 
    display: none !important; 
  }
}

/* ---------- Ultra tiny phones: icons-only footer ---------- */
@media (max-width: 420px) {
  /* Remove all text from footer buttons */
  .prev-exercise > span,
  .submit-answer > span,
  .next-exercise > span {
    display: none !important;
  }

  /* Optimize icons for tiny screens */
  .prev-exercise i,
  .submit-answer i,
  .next-exercise i {
    margin: 0 !important;
    font-size: 0.95rem !important;
  }

  /* Maintain touch targets */
  .prev-exercise,
  .submit-answer,
  .next-exercise { 
    min-width: 42px !important;
  }
}

/* End of enhanced mobile CSS */
/* ===== ENHANCED AUDIO PLAYER STYLES ===== */
.media-player-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(220, 53, 69, 0.05);
  border: 2px solid rgba(220, 53, 69, 0.2);
  border-radius: 12px;
  text-align: center;
}

.media-player-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
  min-width: 160px;
  justify-content: center;
  margin-bottom: 1rem;
}

.media-player-btn:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.media-player-btn:active {
  transform: translateY(0);
}

.media-player-btn.playing {
  background: #28a745;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.media-player-btn.playing:hover {
  background: #218838;
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.media-player-section .media-player-btn i {
  font-size: 1.1rem;
}

/* Audio controls container */
.audio-controls-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
}

.seek-btn {
  background: rgba(220, 53, 69, 0.1);
  border: 2px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.seek-btn:hover {
  background: #dc3545;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

.seek-btn:active {
  transform: scale(0.95);
}

/* Audio progress container */
.audio-progress-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audio-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.audio-progress-bar:hover {
  height: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.audio-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #dc3545, #e35d6a);
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 4px;
  position: relative;
}

.audio-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #dc3545;
  border-radius: 50%;
  transform: translate(50%, -25%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.audio-progress-bar:hover .audio-progress-fill::after {
  opacity: 1;
}

.audio-time-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.audio-current-time {
  color: #dc3545;
  font-weight: 600;
}

.audio-time-separator {
  margin: 0 0.2rem;
  opacity: 0.6;
}

.audio-duration {
  opacity: 0.8;
}

/* Mobile optimization for media buttons */
@media (max-width: 768px) {
  .media-player-section {
    padding: 0.8rem;
    margin: 1rem 0;
  }
  
  .media-player-btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
    min-width: auto;
  }
  
  .media-player-btn i {
    font-size: 1rem;
  }
  
  .audio-controls-container {
    max-width: 100%;
  }
  
  .audio-controls {
    gap: 0.5rem;
  }
  
  .seek-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  
  .audio-progress-bar {
    height: 6px;
  }
  
  .audio-progress-bar:hover {
    height: 8px;
  }
  
  .audio-time-display {
    font-size: 0.75rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .media-player-section {
    padding: 0.6rem;
  }
  
  .media-player-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
  }
  
  .audio-controls {
    gap: 0.3rem;
  }
  
  .seek-btn {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  
  .audio-time-display {
    font-size: 0.7rem;
  }
}

/* Dark mode support */
.dark-mode .media-player-section {
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
}

.dark-mode .audio-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

.dark-mode .audio-time-display {
  color: #ccc;
}

.dark-mode .seek-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

.dark-mode .seek-btn:hover {
  background: #dc3545;
  color: white;
}

/* Video button click prevention */
.video-player-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.video-player-btn:disabled:hover {
  transform: none !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
}

/* Accessibility improvements */
.seek-btn:focus-visible,
.audio-progress-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* ===== ENHANCED PROFESSIONAL RESOURCE BUTTONS ===== */

/* Container: row layout, wraps on tiny screens */
.compact-resource-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 8px;
  margin: 1rem 0;
}

/* Enhanced compact button base */
.resource-compact {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-width: 110px;
  max-width: 240px;
  height: 48px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: white;
  color: #333;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  text-align: center;
  justify-content: center;
}

/* Icon and title */
.resource-compact .rc-icon {
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

/* Title short */
.resource-compact .rc-title {
  font-size: 14px;
  color: inherit;
  font-weight: 600;
  transition: color 0.3s ease;
}

/* ===== VIBRANT PROFESSIONAL COLOR PALETTE ===== */

/* Course Book - Vibrant Blue */
.resource-compact.book {
  background: linear-gradient(135deg, #2A7FFF 0%, #0066FF 100%);
  color: white;
  border-color: rgba(42, 127, 255, 0.3);
  box-shadow: 0 8px 25px rgba(42, 127, 255, 0.2);
}

.resource-compact.book .rc-icon {
  background: rgba(255, 255, 255, 0.25);
}

/* Teacher's Book - Vibrant Green */
.resource-compact.teacher {
  background: linear-gradient(135deg, #28C76F 0%, #20B2AA 100%);
  color: white;
  border-color: rgba(40, 199, 111, 0.3);
  box-shadow: 0 8px 25px rgba(40, 199, 111, 0.2);
}

.resource-compact.teacher .rc-icon {
  background: rgba(255, 255, 255, 0.25);
}

/* Audio - Vibrant Purple */
.resource-compact.audio {
  background: linear-gradient(135deg, #9C27B0 0%, #673AB7 100%);
  color: white;
  border-color: rgba(156, 39, 176, 0.3);
  box-shadow: 0 8px 25px rgba(156, 39, 176, 0.2);
}

.resource-compact.audio .rc-icon {
  background: rgba(255, 255, 255, 0.25);
}

/* Video - Vibrant Red/Orange */
.resource-compact.video {
  background: linear-gradient(135deg, #FF4757 0%, #FF6B00 100%);
  color: white;
  border-color: rgba(255, 71, 87, 0.3);
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.2);
}

.resource-compact.video .rc-icon {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== ENHANCED HOVER EFFECTS ===== */
.resource-compact:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border-width: 2px;
}

/* Specific hover colors */
.resource-compact.book:hover {
  background: linear-gradient(135deg, #0066FF 0%, #2A7FFF 100%);
  border-color: rgba(42, 127, 255, 0.6);
  box-shadow: 0 15px 35px rgba(42, 127, 255, 0.3);
}

.resource-compact.teacher:hover {
  background: linear-gradient(135deg, #20B2AA 0%, #28C76F 100%);
  border-color: rgba(40, 199, 111, 0.6);
  box-shadow: 0 15px 35px rgba(40, 199, 111, 0.3);
}

.resource-compact.audio:hover {
  background: linear-gradient(135deg, #673AB7 0%, #9C27B0 100%);
  border-color: rgba(156, 39, 176, 0.6);
  box-shadow: 0 15px 35px rgba(156, 39, 176, 0.3);
}

.resource-compact.video:hover {
  background: linear-gradient(135deg, #FF6B00 0%, #FF4757 100%);
  border-color: rgba(255, 71, 87, 0.6);
  box-shadow: 0 15px 35px rgba(255, 71, 87, 0.3);
}

/* Icon hover animation */
.resource-compact:hover .rc-icon {
  transform: scale(1.2) rotate(5deg);
  background: rgba(255, 255, 255, 0.4);
}

/* Shine effect on hover */
.resource-compact::after {
  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 0.6s ease;
}

.resource-compact:hover::after {
  left: 100%;
}

/* ===== ACTIVE STATE STYLING ===== */
.resource-compact.active {
  transform: translateY(-3px) scale(1.03);
  border-width: 2px;
  z-index: 5;
}

/* Active state with stronger border and glow */
.resource-compact.book.active {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 30px rgba(42, 127, 255, 0.4), 0 0 0 3px rgba(42, 127, 255, 0.1);
}

.resource-compact.teacher.active {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 30px rgba(40, 199, 111, 0.4), 0 0 0 3px rgba(40, 199, 111, 0.1);
}

.resource-compact.audio.active {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 30px rgba(156, 39, 176, 0.4), 0 0 0 3px rgba(156, 39, 176, 0.1);
}

.resource-compact.video.active {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 30px rgba(255, 71, 87, 0.4), 0 0 0 3px rgba(255, 71, 87, 0.1);
}

/* Small orange bar under the active compact button */
.resource-compact.active::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 70%;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, #FF8C00 0%, #FFD700 100%);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
  z-index: 2;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .compact-resource-row {
    gap: 8px;
    padding: 15px 8px;
    justify-content: center;
  }
  
  .resource-compact {
    padding: 12px 14px;
    min-width: 100px;
    height: 52px;
    font-size: 14px;
    gap: 8px;
  }
  
  .resource-compact .rc-icon {
    font-size: 18px;
    width: 28px;
    height: 28px;
  }
  
  .resource-compact .rc-title {
    font-size: 13px;
  }
  
  .resource-compact.active::before {
    bottom: -6px;
    height: 3px;
  }
}

@media (max-width: 480px) {
  .compact-resource-row {
    gap: 6px;
    padding: 12px 6px;
  }
  
  .resource-compact {
    padding: 10px 12px;
    min-width: 90px;
    height: 4px;
    font-size: 13px;
    gap: 6px;
  }
  
  .resource-compact .rc-icon {
    font-size: 16px;
    width: 26px;
    height: 26px;
  }
  
  .resource-compact .rc-title {
    font-size: 12px;
  }
}

/* Dark mode support */
.dark-mode .resource-compact {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.dark-mode .resource-compact.book {
  background: linear-gradient(135deg, #1E88E5 0%, #0D47A1 100%);
}

.dark-mode .resource-compact.teacher {
  background: linear-gradient(135deg, #00C853 0%, #1B5E20 100%);
}

.dark-mode .resource-compact.audio {
  background: linear-gradient(135deg, #7B1FA2 0%, #4A148C 100%);
}

.dark-mode .resource-compact.video {
  background: linear-gradient(135deg, #FF3D00 0%, #BF360C 100%);
}

/* Focus states for accessibility */
.resource-compact:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Active state styling: stronger and orange underline indicator */
.resource-compact.active {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 36px rgba(8,12,16,0.16);
  z-index: 3;
}

/* Small orange bar under the active compact button */
.resource-compact.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -6px;               /* visible gap under the compact row */
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg,#ff8a00 0%, #ff5c00 100%);
  box-shadow: 0 6px 18px rgba(255,106,0,0.18);
}

/* Accessibility focus */
.resource-compact:focus { outline: none; box-shadow: 0 0 0 4px rgba(255,138,50,0.07); }

/* Responsive: on tiny screens, shrink and allow 2 per row */
@media (max-width: 420px) {
  .compact-resource-row { gap: 8px; }
  .resource-compact { min-width: 44%; padding: 8px 10px; font-size: 13px; height: 44px; }
  .resource-compact.active::after { left: 8px; right: 8px; bottom: -5px; height: 3px; }
}

/* Ensure anchors used as buttons behave the same */
a.resource-compact { text-decoration: none; display: inline-flex; }

/* ===== MOBILE MODAL FIXES ===== */
@media (max-width: 768px) {
  /* Payment Modal Mobile Fix */
  .auth-modal-content {
    max-width: 95vw !important;
    width: 95vw !important;
    max-height: 90vh !important;
    margin: 2vh auto !important;
    padding: 1rem !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
    position: relative !important;
  }

  .payment-plans {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding: 0.5rem !important;
  }

  .payment-plan {
    min-height: auto !important;
    margin-bottom: 1rem !important;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
  }

  /* Close button positioning for all modals */
  .close-modal {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 36px !important;
    height: 36px !important;
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    font-size: 1.2rem !important;
    z-index: 1000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
  }

  /* Auth Modal Specific Fixes */
  .auth-modal .modal-content {
    max-width: 95vw !important;
    width: 95vw !important;
    padding: 1.5rem !important;
    margin: 5vh auto !important;
  }

  /* Fix password field line indicator */
  .password-strength {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
  }

  .password-strength-bar {
    width: 100% !important;
    height: 4px !important;
    background: #e0e0e0 !important;
    border-radius: 2px !important;
    overflow: hidden !important;
    position: relative !important;
  }

  .password-strength-fill {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    transition: width 0.3s ease !important;
  }

  /* Form input fixes */
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 0.8rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Profile Modal Fix */
  #profileModal .auth-modal-content {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
  }

  #profileModal .form-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.8rem !important;
    margin-top: 1.5rem !important;
  }

  #profileModal .submit-btn,
  #profileModal .cancel-btn,
  #profileModal .delete-btn {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Auth tabs */
  .auth-tabs {
    display: flex !important;
    gap: 0.5rem !important;
    margin-bottom: 1.5rem !important;
    border-bottom: 2px solid #eee !important;
  }

  .auth-tab {
    flex: 1 !important;
    padding: 0.8rem 0.5rem !important;
    font-size: 0.9rem !important;
    text-align: center !important;
  }

  /* Modal header */
  .modal-header {
    margin-bottom: 1.5rem !important;
    text-align: center !important;
  }

  .modal-header h2 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  .modal-header p {
    font-size: 0.9rem !important;
    color: #666 !important;
  }

  /* Prevent body scroll when modal is open */
  body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .auth-modal-content {
    padding: 1rem !important;
    margin: 1vh auto !important;
    max-height: 98vh !important;
  }

  .payment-plan {
    padding: 1rem !important;
    margin-bottom: 0.8rem !important;
  }

  .close-modal {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
  }

  .auth-tab {
    font-size: 0.85rem !important;
    padding: 0.7rem 0.3rem !important;
  }

  .modal-header h2 {
    font-size: 1.3rem !important;
  }

  .modal-header p {
    font-size: 0.85rem !important;
  }
}

/* Ensure modals are visible on mobile */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal[aria-hidden="false"] {
  display: block !important;
}

/* Dark mode adjustments for mobile modals */
.dark-mode .close-modal {
  background: #c82333 !important;
  color: white !important;
}

.dark-mode .auth-modal-content {
  background: var(--card-bg) !important;
  color: var(--text-color) !important;
}

/* Input focus states for mobile */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.2) !important;
}

/* Fix for iOS input zoom */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important;
    transform: none !important;
  }
}
/* ===== FIX FOR MOBILE HORIZONTAL LAYOUT ===== */
/* This fixes the vertical stacking issue on mobile */
@media (max-width: 768px) {
  /* FIX 1: Prevent vertical wrapping and make buttons fit without scrolling */
  .compact-resource-row {
    flex-wrap: nowrap !important; /* FORCE no wrapping */
    overflow-x: visible !important; /* No scrolling needed */
    overflow-y: hidden !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: auto !important;
    padding-bottom: 12px !important; /* Reduced for better alignment */
    justify-content: space-between !important; /* Distribute buttons evenly */
    gap: 4px !important;
  }
  
  /* FIX 2: Make buttons compact and well-proportioned */
  .resource-compact {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 23% !important; /* Slightly reduced for better spacing */
    width: auto !important;
    height: 44px !important; /* Slightly taller for better text fit */
    padding: 6px 4px !important;
    margin: 0 !important;
    font-size: 10px !important;
    text-align: center !important;
    gap: 3px !important; /* Reduced gap between icon and text */
    display: flex !important;
    flex-direction: column !important; /* Stack icon and text vertically */
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* FIX 3: Adjust icon size and positioning */
  .resource-compact .rc-icon {
    font-size: 12px !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 auto 2px !important; /* Center with small bottom margin */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important; /* Prevent icon from shrinking */
  }
  
  /* FIX 4: Adjust title for better text handling */
  .resource-compact .rc-title {
    font-size: 10px !important;
    line-height: 1.1 !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    word-break: break-word !important; /* Allow text to break naturally */
    hyphens: auto !important; /* Add hyphenation for long words */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-height: 2.2em !important; /* Limit to 2 lines max */
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; /* Limit to 2 lines */
    -webkit-box-orient: vertical !important;
  }
  
  /* FIX 5: Center the active indicator perfectly */
  .resource-compact.active::after {
    left: 50% !important; /* Center horizontally */
    right: auto !important; /* Remove right positioning */
    bottom: -6px !important;
    height: 3px !important;
    width: 60% !important; /* Fixed width for centered appearance */
    transform: translateX(-50%) !important; /* Perfect centering */
    border-radius: 2px !important;
    background: linear-gradient(90deg, #ff8a00 0%, #ff5c00 100%) !important;
    box-shadow: 0 2px 6px rgba(255, 106, 0, 0.3) !important;
  }
  
  /* FIX 6: Ensure buttons are properly spaced and visible */
  .books-tabs.compact-resource-row {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
  }
  
  /* FIX 7: Specific adjustment for "Teacher's Book" button */
  .resource-compact.teacher .rc-title {
    font-size: 9px !important; /* Slightly smaller for the long text */
    line-height: 1.2 !important;
    letter-spacing: -0.2px !important; /* Tighter letter spacing */
  }
  
  /* FIX 8: Adjust icon spacing specifically for audio/video */
  .resource-compact.audio .rc-icon,
  .resource-compact.video .rc-icon {
    margin-bottom: 3px !important; /* Slightly more space between icon and text */
    font-size: 13px !important; /* Slightly larger icons for audio/video */
  }
}

/* ===== OPTIMIZATION FOR SMALLER PHONES ===== */
@media (max-width: 480px) {
  .compact-resource-row {
    gap: 3px !important;
    padding: 6px 2px 10px !important;
  }
  
  .resource-compact {
    height: 42px !important;
    padding: 5px 3px !important;
    font-size: 9px !important;
    gap: 2px !important;
    max-width: 23% !important;
  }
  
  .resource-compact .rc-icon {
    font-size: 11px !important;
    width: 18px !important;
    height: 18px !important;
    margin-bottom: 2px !important;
  }
  
  .resource-compact .rc-title {
    font-size: 9px !important;
    line-height: 1.1 !important;
    max-height: 2em !important;
  }
  
  /* Adjust "Teacher's Book" for smaller screens */
  .resource-compact.teacher .rc-title {
    font-size: 8.5px !important;
    line-height: 1.1 !important;
  }
  
  .resource-compact.active::after {
    width: 55% !important; /* Slightly thinner on small screens */
    bottom: -5px !important;
  }
}

/* ===== OPTIMIZATION FOR VERY SMALL PHONES ===== */
@media (max-width: 360px) {
  /* For very small screens, adjust to single line with ellipsis */
  .resource-compact {
    height: 38px !important;
    padding: 4px 2px !important;
    font-size: 8px !important;
    gap: 1px !important;
    max-width: 23% !important;
  }
  
  /* Single line text with ellipsis for very small screens */
  .resource-compact .rc-title {
    font-size: 8px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    max-height: 1em !important; /* Single line */
    -webkit-line-clamp: 1 !important; /* Single line */
  }
  
  /* Adjust "Teacher's Book" for single line */
  .resource-compact.teacher .rc-title {
    font-size: 7.5px !important;
    letter-spacing: -0.3px !important;
  }
  
  .resource-compact .rc-icon {
    font-size: 10px !important;
    width: 16px !important;
    height: 16px !important;
    margin-bottom: 1px !important;
  }
  
  /* Larger icons for audio/video on very small screens */
  .resource-compact.audio .rc-icon,
  .resource-compact.video .rc-icon {
    font-size: 11px !important;
    width: 18px !important;
    height: 18px !important;
  }
  
  .resource-compact.active::after {
    width: 50% !important;
    bottom: -4px !important;
    height: 2px !important;
  }
}

/* ===== FIX FOR SPECIFIC TEXT WRAPPING ISSUES ===== */
/* Ensure all text fits properly within buttons */
@media (max-width: 768px) {
  /* Force specific text breaks for "Teacher's Book" */
  .resource-compact.teacher .rc-title {
    display: block !important;
  }
  
}

/* ===== IMPROVE VISUAL HIERARCHY ===== */
/* Make active button more prominent */
.resource-compact.active {
  border: 1px solid rgba(255, 138, 0, 0.4) !important;
  background: linear-gradient(135deg, 
    rgba(255, 138, 0, 0.1) 0%, 
    rgba(255, 92, 0, 0.05) 100%) !important;
}
/* ===== VARIABLES (professional palette) ===== */
:root {
  --professional-blue: #0d6efd; /* Bootstrap primary */
  --professional-blue-dark: #0b5ed7;
  --professional-red: #dc3545;  /* Bootstrap danger */
  --professional-red-dark: #c82333;
}

/* ===== MOBILE NAVBAR HEIGHT REDUCTION (TOP FOOTER) ===== */
@media (max-width: 768px) {
  /* Drastically reduce navbar height */
  nav {
    padding: 4px 1rem !important; /* Very minimal vertical padding */
    min-height: 40px !important;
  }

  .nav-container {
    min-height: 32px !important;
  }

  /* User menu - make it horizontal and super compact */
  #userMenu.user-menu {
    display: flex;
    align-items: center !important;
    gap: 6px !important; /* Small gap between buttons */
    padding: 4px 8px !important; /* Minimal padding */
    min-height: 36px !important;
    background: none !important; /* Remove background if any */
    border: none !important; /* Remove border if any */
    backdrop-filter: none !important; /* Remove blur effect */

    /* Lift the user menu slightly so it visually centers with the bottom footer */
    position: relative !important;
    transform: translateY(-6px) !important; /* adjust value if you want more/less lift */
  }

  /* User avatar - keep original size */
  .user-avatar {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    /* Keep original design */
  }

  /* User name - keep original style */
  .user-name {
    /* Keep original style */
    font-size: 14px !important;
    font-weight: 600 !important;
    color: white !important;
  }

  /* Profile and Logout buttons - professional colours (override grey) */
  .profile-btn, .logout-btn {
    padding: 0.4rem 0.8rem !important; /* Original padding */
    font-size: 0.9rem !important; /* Original font size */
    border-radius: 4px !important; /* Original border radius */
    font-weight: 500 !important; /* Original font weight */
    cursor: pointer !important;
    white-space: nowrap !important;
    display: inline-block !important;
    margin: 0 !important;
    height: auto !important;
    line-height: normal !important;
    flex-shrink: 0 !important;
    color: #fff !important;
    transition: transform .08s ease, box-shadow .08s ease, filter .08s ease !important;
  }

  /* Profile = blue */
  .profile-btn {
    background: var(--professional-blue) !important;
    border: 1px solid var(--professional-blue) !important;
  }
  .profile-btn:hover,
  .profile-btn:focus {
    background: var(--professional-blue-dark) !important;
    border-color: var(--professional-blue-dark) !important;
    filter: brightness(.96) !important;
  }

  /* Logout = red */
  .logout-btn {
    background: var(--professional-red) !important;
    border: 1px solid var(--professional-red) !important;
  }
  .logout-btn:hover,
  .logout-btn:focus {
    background: var(--professional-red-dark) !important;
    border-color: var(--professional-red-dark) !important;
    filter: brightness(.96) !important;
  }

  /* Arrange buttons horizontally: Avatar - Name - Profile - Logout */
  #userMenu.user-menu {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
}

/* ===== MOBILE FOOTER HEIGHT REDUCTION (BOTTOM FOOTER) ===== */
@media (max-width: 768px) {
  /* Drastically reduce footer height */
  footer {
    padding: 1rem 1rem !important; /* Much smaller padding */
    /* Make sure content aligns center vertically so both footers visually match */
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
  }

  .footer-content {
    padding: 0.3rem 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Compact developer credit */
  .developer-credit {
    margin: 0.5rem 0 !important;
    padding: 0.5rem !important;
  }

  /* Compact footer links */
  .footer-links {
    margin-top: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
  }

  .footer-links a {
    font-size: 0.8rem !important;
    margin: 0 0.3rem !important;
  }

  /* --- NEW: lift the RIGHT-MOST footer button slightly (only on mobile) --- */
  .footer-links a:last-child {
    position: relative !important;
    top: -1px !important; /* move UP 4px — tweak to taste (-2px .. -6px) */
  }
}

/* ===== EXTREME HEIGHT REDUCTION FOR SMALL PHONES ===== */
@media (max-width: 480px) {
  /* Ultra-compact navbar */
  nav {
    padding: 2px 0.8rem !important;
    min-height: 36px !important;
  }

  .nav-container {
    min-height: 30px !important;
  }

  #userMenu.user-menu {
    padding: 2px 4px !important;
    min-height: 32px !important;
    gap: 4px !important;
    transform: translateY(-4px) !important; /* slightly smaller lift for very small screens */
  }

  .user-avatar {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
  }

  .user-name {
    font-size: 13px !important;
    margin: 0 4px !important;
  }

  /* Keep original button designs but adjust padding slightly for mobile */
  .profile-btn, .logout-btn {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.85rem !important;
    color: #fff !important;
  }

  /* Ensure color overrides apply on very small screens too */
  .profile-btn {
    background: var(--professional-blue) !important;
    border: 1px solid var(--professional-blue) !important;
  }
  .logout-btn {
    background: var(--professional-red) !important;
    border: 1px solid var(--professional-red) !important;
  }

  /* Ultra-compact footer */
  footer {
    padding: 0.8rem 0.8rem !important;
  }

  .developer-credit {
    margin: 0.3rem 0 !important;
    padding: 0.4rem !important;
  }

  .developer-credit p {
    font-size: 0.75rem !important;
    margin-bottom: 0.4rem !important;
  }

  .footer-links a {
    font-size: 0.75rem !important;
  }

  /* --- NEW: slightly larger lift for the right-most footer button on tiny screens --- */
  .footer-links a:last-child {
    position: relative !important;
    top: -6px !important; /* a bit more lift for very small screens */
  }
}

/* ===== VERIFY BUTTONS KEEP ORIGINAL DESIGN BEHAVIOR (but with new colors) ===== */
.profile-btn:hover, .logout-btn:hover {
  opacity: 0.95 !important;
  transform: translateY(-1px) !important;
  /* minimal hover to keep it professional */
}
/* ===== AVATAR UPLOAD STYLES ===== */
.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border: 4px solid var(--card-bg);
  box-shadow: var(--box-shadow);
}

#avatarInitial {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
}

#avatarImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-upload-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: var(--transition);
}

.avatar-upload-btn:hover {
  background: var(--secondary);
  transform: translateY(-2px);
}

.avatar-remove-btn {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error);
  border: 1px solid rgba(220, 53, 69, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: var(--transition);
}

.avatar-remove-btn:hover {
  background: var(--error);
  color: white;
  transform: translateY(-2px);
}

.avatar-hint {
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.7;
  text-align: center;
  margin-top: 0.5rem;
}

/* Drag and drop states */
.avatar-upload.drag-over {
  border-color: var(--accent);
  background: rgba(255, 107, 0, 0.05);
}

/* Profile form grid */
.profile-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.readonly-note {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
  margin-top: 0.3rem;
}

.profile-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.cancel-btn {
  background: rgba(108, 117, 125, 0.1);
  color: var(--text-color);
  border: 1px solid rgba(108, 117, 125, 0.3);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.cancel-btn:hover {
  background: rgba(108, 117, 125, 0.2);
}

/* ===== PROFESSIONAL DANGER ZONE STYLES (LEFT-ALIGNED) ===== */
.profile-danger-zone {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.08) 0%, rgba(220, 53, 69, 0.03) 100%);
  border: 2px solid rgba(220, 53, 69, 0.15);
  border-radius: 12px;
  padding: 1.8rem;
  margin: 2.5rem 0 0 0;
  text-align: left; /* CHANGED FROM center TO left */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Add this to align everything to left */
}

/* Professional Delete Button - Left Aligned */
.delete-btn {
  background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
  color: white;
  border: none;
  padding: 0.9rem 1.8rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  width: auto; /* CHANGED FROM 100% TO auto */
  display: flex;
  align-items: center;
  justify-content: flex-start; /* CHANGED FROM center TO flex-start */
  gap: 0.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
  position: relative;
  overflow: hidden;
  font-size: 1rem;
  letter-spacing: 0.3px;
  margin-top: 0.5rem;
  align-self: flex-start; /* Force button to stay left-aligned */
}
.delete-btn {
  margin-left: 0 !important;
  padding-left: 1.2rem; /* Reduce left padding if button is too wide */
  justify-content: flex-start !important;
  left: 0 !important;
}
/* ===== FORCE USER NAME BLUE - ULTIMATE OVERRIDE ===== */
/* Add this to the VERY END of your style.css file */

.user-name,
#userName,
.auth-container .user-name,
.user-menu .user-name,
#userMenu .user-name {
  color: #2563eb !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 1px rgba(0,0,0,0.1) !important;
}

/* Mobile specific - even stronger */
@media (max-width: 992px) {
  .user-name,
  #userName,
  .auth-container .user-name,
  .user-menu .user-name,
  #userMenu .user-name {
    color: #2563eb !important;
    font-weight: 800 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
  }
}

/* Override any JavaScript-added styles */
.user-name[style*="color"],
#userName[style*="color"] {
  color: #2563eb !important;
}
/* ===== HTML CONTENT VIEWER STYLES ===== */
.html-content-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  padding: 1.5rem;
  box-sizing: border-box;
}

.html-content {
  max-width: 100%;
  min-height: 100%;
  line-height: 1.6;
  font-size: 16px;
  color: #333;
  transition: opacity 0.3s ease;
}

.html-content h1, .html-content h2, .html-content h3, .html-content h4 {
  color: var(--primary);
  margin: 1.5rem 0 1rem 0;
  font-family: 'Montserrat', sans-serif;
}

.html-content p {
  margin-bottom: 1rem;
}

.html-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.html-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.html-content table, .html-content th, .html-content td {
  border: 1px solid #ddd;
  padding: 0.75rem;
}

.html-content th {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.html-content tr:nth-child(even) {
  background: #f9f9f9;
}

.html-content ul, .html-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.html-content li {
  margin-bottom: 0.5rem;
}

.html-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #666;
}

.html-content code {
  background: #f4f4f4;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.html-content pre {
  background: #f8f8f8;
  padding: 1rem;
  border-radius: 8px;
  overflow: auto;
  margin: 1.5rem 0;
}

.html-content pre code {
  background: none;
  padding: 0;
}

.html-error-container, .html-fallback-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  color: #666;
}

.html-error-container i, .html-fallback-container i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #dc3545;
}

.html-error-container h3, .html-fallback-container h3 {
  color: #333;
  margin-bottom: 1rem;
}

.html-fallback-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: var(--transition);
}

.html-fallback-btn:hover {
  background: var(--primary);
  transform: translateY(-2px);
}
/*-------------------------------------------- PDF/HTML loading START ----------------------------------------------- */
#unitContentIframe {
  /* Keep current positioning, just adjust zoom */
  transform: scale(0.77) !important;  /* 90% size - zooms out */
  transform-origin: top left !important; /* Keeps position at top-left */
  width: 130% !important; /* Counteract the scaling: 100% / 0.9 = 111.11% */
  height: 130% !important; /* Same for height */
}

/* For mobile, zoom out a bit more */
@media (max-width: 768px) {
  #unitContentIframe {
    transform: scale(0.53) !important;  /* 85% size */
    width: 200% !important; /* 100% / 0.85 = 117.65% */
    height: 200% !important;
  }
}
/*-------------------------------------------- PDF/HTML loading END------------------------------------------- */
