@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --secondary: #F59E0B;
  --secondary-hover: #D97706;
  --bg-dark: #0F172A;
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;
  --success: #10B981;
  --danger: #EF4444;
  --border-color: rgba(255, 255, 255, 0.1);
  --glow: 0 0 20px rgba(37, 99, 235, 0.3);
  --font-family: 'Cairo', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background animated particles */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.2);
  animation: float 15s infinite linear;
}

@keyframes float {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: translateY(-100px) translateX(100px);
    opacity: 0;
  }
}

/* Glassmorphism */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

/* Typography */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.4;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 8px;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-align: center;
  gap: 8px;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.btn-secondary {
  background-color: var(--secondary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.btn-study {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-study:hover {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  color: white;
}

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

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Navbar */
header {
  padding: 20px 5%;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo span {
  color: var(--secondary);
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links li a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.1rem;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links li a:hover,
.nav-links li a.active {
  color: white;
}

.nav-links li a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  right: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
  width: 100%;
}

.user-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  border: 2px solid var(--secondary);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.profile-pic:hover {
  transform: scale(1.1);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Section */
.hero {
  min-height: calc(100vh - 90px);
  display: flex;
  align-items: center;
  padding: 60px 0;
}

.hero-content {
  max-width: 800px;
  text-align: center;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fff, #94A3B8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.hero-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

/* Animations */
.fade-in {
  animation: fadeIn 1s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

.delay-1 {
  animation-delay: 0.2s;
}

.delay-2 {
  animation-delay: 0.4s;
}

.delay-3 {
  animation-delay: 0.6s;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Nav */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-links {
    display: flex !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    background: transparent !important;
    flex-direction: row !important;
    padding: 0 !important;
    border: none !important;
    align-items: center !important;
    gap: 15px !important;
  }

  .mobile-menu-btn {
    display: none !important;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-buttons {
    flex-direction: column;
  }
}

/* Features */
.features {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 50px;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -15px;
  right: 50%;
  transform: translateX(50%);
  width: 60px;
  height: 4px;
  background-color: var(--secondary);
  border-radius: 2px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.feature-card {
  padding: 40px 30px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--glow);
}

.feature-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 20px;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.feature-card p {
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- Categories Page --- */
.categories-header {
  text-align: center;
  padding: 60px 0 40px;
}

.search-bar {
  max-width: 600px;
  margin: 0 auto 40px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 16px 50px 16px 20px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: white;
  font-size: 1.1rem;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.3s ease;
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
}

.search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  padding-bottom: 80px;
}

.category-card {
  padding: 30px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-color: var(--primary);
}

.category-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 20px;
}

.category-card h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.category-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  flex-grow: 1;
}

.category-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-easy {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-medium {
  background: rgba(245, 158, 11, 0.2);
  color: var(--secondary);
}

.badge-hard {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* --- Quiz Page --- */
.quiz-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  border-radius: 12px;
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary);
}

.quiz-progress {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  margin-bottom: 40px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 50%;
  transition: width 0.3s ease;
}

.question-card {
  padding: 40px;
  border-radius: 20px;
  margin-bottom: 30px;
}

.question-text {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 30px;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  padding: 20px;
  border-radius: 12px;
  text-align: right;
  font-size: 1.2rem;
  font-family: var(--font-family);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 15px;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

[dir="ltr"] .option-btn {
  text-align: left;
}

.option-btn.selected {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
}

.option-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-btn.selected .option-circle {
  border-color: var(--primary);
  background: var(--primary);
}

.option-btn.selected .option-circle::after {
  content: '';
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Result Page --- */
.result-container {
  max-width: 600px;
  margin: 60px auto;
  text-align: center;
}

.result-card {
  padding: 50px 30px;
  border-radius: 24px;
}

.score-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 85%, var(--border-color) 0);
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--glow);
}

.score-inner {
  width: 170px;
  height: 170px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-text {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.score-label {
  color: var(--text-muted);
  font-size: 1rem;
}

.result-message {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.result-desc {
  color: var(--text-muted);
  margin-bottom: 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 40px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-value.correct {
  color: var(--success);
}

.stat-value.wrong {
  color: var(--danger);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* --- Profile Page --- */
.profile-header {
  padding: 40px 0;
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 40px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  border: 4px solid var(--bg-card);
  box-shadow: var(--glow);
}

.profile-info h1 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.profile-info p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
  margin-bottom: 80px;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }
}

.overview- cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.overview-card {
  padding: 20px;
  border-radius: 16px;
  text-align: center;
}

.overview-icon {
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 10px;
}

.overview-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.overview-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.section-panel {
  padding: 30px;
  border-radius: 16px;
  margin-bottom: 30px;
}

.panel-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-details {
  flex-grow: 1;
}

.activity-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.activity-time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.activity-score {
  font-weight: 700;
  color: var(--success);
}

  /* Home Features Grid & Cards */
  .home-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
  }

  .home-feature-card {
    padding: 30px 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

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

  .home-feature-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
  }

  .home-feature-title {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: white;
  }

  .home-feature-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
  }

  /* Categories Grid */
  .categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
  }

  /* Quizzes Grid */
  .quizzes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
  }

  /* Answers Review Panel & Item */
  .review-panel {
    padding: 30px 20px;
    border-radius: 20px;
  }

  .review-item {
    border-width: 1px;
    border-style: solid;
    padding: 20px;
    border-radius: 12px;
    transition: transform 0.2s;
  }

  /* Option circle flex-shrink to prevent oval distortion on mobile */
  .option-circle {
    flex-shrink: 0;
  }

/* =========================================
   MOBILE & APP-LIKE OPTIMIZATIONS
   ========================================= */
@media (max-width: 768px) {

  /* General App-like Feel */
  body {
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    /* Prevent pull-to-refresh bounce effect on mobile */
  }

  a,
  button,
  .category-card,
  .option-btn {
    -webkit-tap-highlight-color: transparent !important;
    /* Remove blue tap highlight on mobile */
  }

  /* Header & Navigation */
  header {
    padding: 12px 20px !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(15px) !important;
    background: rgba(15, 23, 42, 0.85) !important;
  }

  .logo {
    font-size: 1.1rem !important;
  }

  .logo i {
    font-size: 1.2rem !important;
  }

  .nav-links {
    gap: 15px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
  }

  .nav-links li a {
    font-size: 0.95rem !important;
  }

  .mobile-menu-btn {
    display: none !important;
    /* Keep it hidden, app-style top bar */
  }

  /* Hero Section (Home) */
  main.container {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
  }

  .hero-content {
    padding: 30px 20px !important;
    margin-bottom: 30px !important;
    border-radius: 20px !important;
  }

  .hero-content img {
    max-width: 140px !important;
    margin-bottom: 20px !important;
  }

  .hero-content p {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin-bottom: 25px !important;
  }

  .hero-btns {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .hero-btns .btn {
    width: 100% !important;
    padding: 14px 20px !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
  }

  /* Features Grid (Home) */
  .home-features-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  .home-feature-card {
    padding: 25px 20px !important;
    border-radius: 16px !important;
  }

  .home-feature-icon {
    font-size: 2rem !important;
  }

  /* Categories & Quizzes Grid */
  .categories-grid,
  .quizzes-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    padding: 0 10px !important;
  }

  /* Categories Page */
  .categories-header {
    margin-bottom: 30px !important;
  }

  .categories-header h1 {
    font-size: 1.8rem !important;
  }

  .categories-header p {
    font-size: 0.95rem !important;
  }

  .category-card {
    padding: 20px 15px !important;
    border-radius: 16px !important;
    flex-direction: row !important;
    /* App list style */
    flex-wrap: wrap !important;
    align-items: center !important;
    text-align: right !important;
  }

  .cat-icon {
    font-size: 1.8rem !important;
    margin-bottom: 0 !important;
    margin-left: 15px !important;
    width: 40px !important;
    text-align: center !important;
  }

  .cat-title {
    font-size: 1.1rem !important;
    margin-bottom: 5px !important;
    flex-grow: 1 !important;
  }

  .cat-desc {
    width: 100% !important;
    font-size: 0.85rem !important;
    margin-bottom: 15px !important;
    margin-top: 10px !important;
  }

  .cat-footer {
    width: 100% !important;
  }

  .cat-questions {
    font-size: 0.85rem !important;
  }

  .cat-btn {
    padding: 6px 15px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
  }

  /* Quiz Page Mobile Optimizations */
  .quiz-container {
    margin: 15px auto !important;
    padding: 0 10px !important;
  }

  .quiz-header {
    padding: 12px 15px !important;
    flex-direction: row !important; /* Keep horizontal row for layout compactness */
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 15px !important;
  }

  .quiz-progress {
    margin-bottom: 15px !important;
  }

  .question-card {
    padding: 20px 15px !important;
    margin-bottom: 20px !important;
  }

  .question-text {
    font-size: 1.25rem !important;
    margin-bottom: 20px !important;
  }

  /* Optimize images inside questions for mobile */
  .question-text img {
    max-height: 180px !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin: 0 auto 15px !important;
  }

  .options-list {
    gap: 10px !important;
  }

  .option-btn {
    padding: 12px 15px !important;
    font-size: 0.95rem !important;
    border-radius: 10px !important;
    gap: 10px !important;
  }

  .option-circle {
    width: 20px !important;
    height: 20px !important;
  }

  .option-btn.selected .option-circle::after {
    width: 8px !important;
    height: 8px !important;
  }

  .quiz-footer {
    flex-direction: column-reverse !important;
    gap: 15px !important;
  }

  .quiz-footer .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Result Page */
  .result-card {
    padding: 30px 20px !important;
  }

  .score-circle {
    width: 160px !important;
    height: 160px !important;
  }

  .score-inner {
    width: 130px !important;
    height: 130px !important;
  }

  .score-text {
    font-size: 2.2rem !important;
  }

  .result-message {
    font-size: 1.4rem !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stat-box {
    padding: 15px !important;
  }

  .result-actions {
    flex-direction: column !important;
  }

  .result-actions .btn {
    width: 100% !important;
  }

  /* Answers Review Panel & Item Mobile Overrides */
  .review-panel {
    padding: 20px 12px !important;
    border-radius: 16px !important;
  }

  .review-item {
    padding: 12px !important;
    border-radius: 10px !important;
  }

  .review-item h4 {
    font-size: 1rem !important;
    margin-bottom: 10px !important;
  }

  .review-item img {
    max-height: 150px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin: 0 auto 10px !important;
    display: block !important;
  }
}

/* Extra optimization for very small mobile screens */
@media (max-width: 360px) {
  header {
    padding: 10px 12px !important;
  }

  .logo {
    font-size: 0.95rem !important;
  }

  .logo i {
    font-size: 1rem !important;
  }

  .nav-links {
    gap: 10px !important;
  }

  .nav-links li a {
    font-size: 0.85rem !important;
  }
}

/* View Answers Button styling */
#view-answers-btn {
  background: rgba(245, 158, 11, 0.2);
  color: var(--secondary);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-family);
  outline: none;
  line-height: 1.4;
}

#view-answers-btn:hover {
  background: var(--secondary);
  color: white;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

/* Inline Answers sheet styles */
.answers-header-card {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.answers-title {
  font-family: var(--font-family);
}

.answer-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.answer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.answer-option-item {
  transition: all 0.2s ease;
}

/* LTR formatting for English tests */
.ltr-mode {
  direction: ltr !important;
  text-align: left !important;
}

.ltr-mode .answer-card-q {
  flex-direction: row !important;
}

.ltr-mode .answer-option-item {
  text-align: left !important;
}

.ltr-mode .question-text {
  text-align: left !important;
  direction: ltr !important;
}

.ltr-mode .option-btn {
  text-align: left !important;
  direction: ltr !important;
}

/* =========================================================
   Study Mode Base Design (Desktop & All Screen Sizes)
   ========================================================= */

/* Study Mode Header Card */
.study-header-card {
  padding: 28px 24px;
  margin-bottom: 25px;
  border-radius: 20px;
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), rgba(15, 23, 42, 0.95));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.study-header-title-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.study-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.4));
  border: 1px solid rgba(16, 185, 129, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.study-header-card h2 {
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  text-align: center;
}

.study-header-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}

.study-badges-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.study-badge {
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.study-badge-count {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.study-badge-status {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

/* Study Search Bar & Actions Row */
.study-search-bar-wrapper {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.study-search-input-box {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.study-search-input-box .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #10b981;
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 5;
}

.study-search-input {
  width: 100%;
  padding: 11px 42px 11px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  font-family: var(--font-family);
  font-size: 0.92rem;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.study-search-input:focus {
  background-color: #0f172a !important;
  background: #0f172a !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.35), inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.study-search-input::placeholder {
  color: rgba(255, 255, 255, 0.55) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.55) !important;
  opacity: 1 !important;
}

.study-search-input:-webkit-autofill,
.study-search-input:-webkit-autofill:hover,
.study-search-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
  box-shadow: 0 0 0px 1000px #0f172a inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
}

.study-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}

.study-actions-row .btn {
  padding: 10px 18px;
  font-size: 0.88rem;
  border-radius: 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

/* Study Question Cards (Desktop & Base) */
.study-q-card {
  padding: 24px 22px;
  margin-bottom: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  direction: rtl;
  text-align: right;
}

.study-q-card:hover {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.study-q-card.ltr-mode {
  direction: ltr !important;
  text-align: left !important;
}

.study-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.study-q-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.study-q-count {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.study-q-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 18px;
  line-height: 1.6;
  word-break: break-word;
}

.study-q-text img {
  max-height: 280px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 10px;
  display: block;
  margin: 12px auto;
}

.study-answer-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(6, 78, 59, 0.35));
  border: 1.5px solid rgba(16, 185, 129, 0.45);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12);
  position: relative;
  overflow: hidden;
}

.answer-accent-bar {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  background: #10b981;
}

.ltr-mode .answer-accent-bar {
  right: auto !important;
  left: 0 !important;
}

.answer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #34d399;
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.answer-text {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.5;
  padding-right: 4px;
  word-break: break-word;
}

.ltr-mode .answer-text {
  padding-right: 0 !important;
  padding-left: 4px !important;
}

/* Study Footer Card */
.study-footer-card {
  padding: 28px 24px;
  border-radius: 20px;
  text-align: center;
  margin-top: 30px;
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.study-footer-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 14px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.study-footer-card h3 {
  color: white;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.study-footer-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.study-footer-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Mobile Floating Controls */
.study-mobile-fab-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 14px;
  border-radius: 40px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(16, 185, 129, 0.25);
}

.study-mobile-fab-bar .fab-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.study-mobile-fab-bar .fab-btn:active {
  transform: scale(0.92);
  background: rgba(16, 185, 129, 0.3);
}

.study-mobile-fab-bar .fab-btn-quiz {
  width: auto;
  padding: 0 16px;
  border-radius: 25px;
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Quiz Top Header Flex & Truncation Styles */
.quiz-top-header {
  border-radius: 0 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  padding: 14px 5% !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
}

.header-exit-btn {
  font-size: 0.95rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.header-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--secondary);
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.header-timer {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.study-header-badge {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* =========================================================
   Mobile Responsiveness Overrides (< 768px)
   ========================================================= */
@media (max-width: 768px) {
  .quiz-model-card .model-icon {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.4rem !important;
    margin-bottom: 10px !important;
  }

  .quiz-model-card h3 {
    font-size: 1.1rem !important;
  }

  .quiz-model-card p {
    font-size: 0.8rem !important;
    margin-bottom: 10px !important;
  }

  .study-header-card {
    padding: 18px 14px !important;
    margin-bottom: 18px !important;
    border-radius: 16px !important;
  }

  .study-header-title-box {
    gap: 8px !important;
    margin-bottom: 8px !important;
  }

  .study-header-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.2rem !important;
    border-radius: 12px !important;
  }

  .study-header-card h2 {
    font-size: 1.25rem !important;
  }

  .study-header-desc {
    font-size: 0.85rem !important;
    margin-bottom: 14px !important;
  }

  .study-badges-row {
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  .study-badge {
    padding: 5px 12px !important;
    font-size: 0.78rem !important;
  }

  .study-search-bar-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
  }

  .study-search-input-box {
    width: 100% !important;
    min-width: 0 !important;
  }

  .study-search-input {
    padding: 10px 42px 10px 14px !important;
    font-size: 0.88rem !important;
  }

  .study-actions-row {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
  }

  .study-actions-row .btn {
    flex: 1 !important;
    padding: 9px 8px !important;
    font-size: 0.8rem !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .study-q-card {
    padding: 15px 13px !important;
    margin-bottom: 14px !important;
    border-radius: 14px !important;
  }

  .study-q-header {
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
  }

  .study-q-badge {
    padding: 3px 10px !important;
    font-size: 0.76rem !important;
  }

  .study-q-count {
    font-size: 0.76rem !important;
  }

  .study-q-text {
    font-size: 1.0rem !important;
    line-height: 1.55 !important;
    margin-bottom: 14px !important;
  }

  .study-answer-box {
    padding: 13px 14px !important;
    border-radius: 12px !important;
  }

  .answer-label {
    font-size: 0.78rem !important;
    margin-bottom: 4px !important;
  }

  .answer-text {
    font-size: 0.98rem !important;
  }

  .study-footer-card {
    padding: 20px 14px !important;
    border-radius: 16px !important;
    margin-top: 24px !important;
  }

  .study-footer-icon {
    width: 46px !important;
    height: 46px !important;
    font-size: 1.4rem !important;
    margin: 0 auto 10px !important;
  }

  .study-footer-card h3 {
    font-size: 1.15rem !important;
  }

  .study-footer-card p {
    font-size: 0.84rem !important;
    margin-bottom: 16px !important;
  }

  .study-footer-btns {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .study-footer-btns .btn {
    width: 100% !important;
    font-size: 0.88rem !important;
    padding: 10px 14px !important;
  }

  .quiz-top-header {
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  .header-exit-btn {
    font-size: 0.85rem !important;
  }

  .header-title {
    font-size: 0.88rem !important;
  }

  .header-timer {
    font-size: 0.8rem !important;
  }

  .study-header-badge {
    padding: 3px 8px !important;
    font-size: 0.76rem !important;
  }
}

@media (max-width: 480px) {
  .card-btns-row {
    flex-direction: row !important;
    display: flex !important;
    gap: 6px !important;
  }

  .card-btns-row a {
    flex: 1 !important;
    width: 50% !important;
    padding: 8px 4px !important;
    font-size: 0.82rem !important;
  }
}

/* ==========================================================
   Question Translation & Lamp Button Feature
   ========================================================== */
.question-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.question-header-row .question-text {
  flex: 1;
  margin-bottom: 0;
}

.question-hint-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  font-size: 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
  outline: none;
  position: relative;
}

.question-hint-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fbbf24;
  transform: scale(1.08) rotate(-8deg);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.45);
}

.question-hint-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fbbf24;
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.7), inset 0 0 8px rgba(255, 255, 255, 0.3);
  animation: lampGlow 1.8s infinite alternate ease-in-out;
}

@keyframes lampGlow {
  0% {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
  }
  100% {
    box-shadow: 0 0 28px rgba(245, 158, 11, 0.85), 0 0 8px rgba(251, 191, 36, 0.9);
  }
}

.question-translation-box {
  direction: rtl !important;
  text-align: right !important;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-right: 4px solid #f59e0b;
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: -10px;
  margin-bottom: 26px;
  animation: transSlideDown 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.ltr-mode .question-translation-box {
  direction: rtl !important;
  text-align: right !important;
}

@keyframes transSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-translation-box .trans-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.question-translation-box .trans-content {
  color: #fef3c7;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.65;
  font-family: var(--font-family);
}

/* Study mode lamp and translation styling */
.study-q-text {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.study-q-text-inner {
  flex: 1;
}

.study-lamp-btn {
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
}

.study-translation-box {
  margin-top: 10px;
  margin-bottom: 14px;
  padding: 12px 16px;
}