/* ============================================
   موقع تعليمي عن حساسات السيارة + كهرباء السيارة
   Capteurs Automobiles & Électricité Auto
   Design: 3D Interactive (THREE.js) + Responsive
   ============================================ */

:root {
  /* ===== Neon Blue Tech Academy Theme ===== */
  --dk-black: #000510;
  --dk-red: #00aaff;
  --dk-red-bright: #00d4ff;
  --dk-red-dark: #0066cc;
  --dk-green: #00d4ff;
  --dk-green-glow: #7dd3fc;
  --dk-green-dark: #0099dd;
  --dk-yellow: #ffd700;
  --dk-white: #eaf6ff;

  --primary: #00aaff;        /* neon blue accent */
  --primary-dark: #0066cc;
  --primary-light: #33bbff;
  --accent: #00d4ff;         /* electric cyan */
  --accent-glow: #7dd3fc;
  --accent-dark: #0099dd;
  --dark: #000510;           /* deep navy black */
  --dark-2: #050d1a;
  --dark-3: #0a1428;
  --dark-4: #0f1d38;
  --light: #eaf6ff;
  --gray: #8aa4c8;
  --gray-light: #a8bfd9;
  --success: #00d4ff;
  --danger: #00aaff;
  --info: #00ccff;
  --purple: #6644ff;
  --neon-glow: 0 0 20px rgba(0,212,255,0.4);
  --neon-glow-strong: 0 0 30px rgba(0,212,255,0.6), 0 0 60px rgba(0,170,255,0.2);
  --shadow: 0 10px 40px rgba(0,170,255,0.10);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.8);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Cairo', 'Tajawal', 'Segoe UI', 'Tahoma', 'Noto Kufi Arabic', sans-serif;
  background: #000510;
  background-image:
    linear-gradient(rgba(0,170,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,170,255,0.04) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, rgba(0,102,204,0.10), transparent 50%);
  background-size: 50px 50px, 50px 50px, 100% 100%;
  color: var(--light);
  line-height: 1.75;
  direction: rtl;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: #001020;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #000510; }
::-webkit-scrollbar-thumb { background: var(--dk-red); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  background: rgba(0, 5, 16, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 170, 255, 0.25);
  box-shadow: 0 4px 30px rgba(0,102,204,0.10);
  padding: 12px 0;
  transition: var(--transition);
}

.navbar.scrolled {
  padding: 8px 0;
  background: rgba(0, 5, 16, 0.96);
  border-bottom-color: rgba(0,212,255,0.45);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(0,212,255,0.5);
}

.logo-icon {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
}

.logo-shield {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 8px rgba(0,212,255,0.6));
  transition: filter .3s;
}

.logo:hover .logo-shield {
  filter: drop-shadow(0 0 14px rgba(0,212,255,0.9));
}

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

.nav-links a {
  color: var(--light);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: color 0.2s;
  position: relative;
  padding: 4px 0;
}

.nav-links a:hover {
  color: var(--accent);
}

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

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

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
}

.menu-toggle span {
  width: 26px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 100px 24px 60px;
  background: #000510;
  background-image:
    radial-gradient(ellipse at 50% 40%, rgba(0,102,204,0.15), transparent 60%),
    linear-gradient(rgba(0,170,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,170,255,0.05) 1px, transparent 1px);
  background-size: 100% 100%, 60px 60px, 60px 60px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(0,212,255,0.12) 0%, transparent 65%);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,102,204,0.15) 0%, transparent 65%);
  border-radius: 50%;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,170,255, 0.15);
  border: 1px solid rgba(0,212,255,0.5);
  color: var(--accent-glow);
  padding: 8px 22px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(0,212,255,0.2);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,212,255,0.35); }
  50% { box-shadow: 0 0 0 14px rgba(0,212,255,0); }
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent) 60%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 50px rgba(0,212,255,0.3);
  filter: drop-shadow(0 0 30px rgba(0,170,255,0.15));
}

.hero h1 .fr {
  display: block;
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--gray);
  -webkit-text-fill-color: var(--gray);
  margin-top: 10px;
}

.hero p {
  font-size: 1.12rem;
  color: #cccccc;
  margin-bottom: 32px;
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
}

.hero-image {
  margin: 36px auto 24px;
  max-width: 900px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(0,212,255,0.4), 0 0 50px rgba(0,170,255,0.25);
  position: relative;
  z-index: 2;
  perspective: 1000px;
}

.hero-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(0,212,255,0.08) 50%, transparent 70%);
  animation: shine 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.hero-image img {
  width: 100%;
  display: block;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 30px;
}

.btn {
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #001020;
  box-shadow: 0 8px 24px rgba(0,170,255,0.35), 0 0 20px rgba(0,212,255,0.2);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,212,255,0.55), 0 0 30px rgba(0,212,255,0.3);
}

.btn-outline {
  background: transparent;
  border-color: rgba(0,170,255,0.6);
  color: var(--light);
}

.btn-outline:hover {
  background: rgba(0,170,255,0.15);
  border-color: var(--accent);
  color: var(--accent-glow);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,102,204,0.4);
}

.btn-secondary {
  background: var(--primary);
  color: #001020;
}

.btn-secondary:hover {
  background: var(--dk-red-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,102,204,0.4);
}

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-top: 50px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-num {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 20px rgba(0,212,255,0.5);
  filter: drop-shadow(0 0 8px rgba(0,170,255,0.3));
}

.stat-label {
  font-size: 0.88rem;
  color: var(--gray);
  margin-top: 6px;
}

/* ===== SECTIONS ===== */
.section {
  padding: 90px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-tag {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-title {
  font-size: 2.3rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: #fff;
}

.section-subtitle {
  font-size: 1.08rem;
  color: var(--gray);
  max-width: 720px;
  margin: 0 auto;
}

/* ===== INTRO ===== */
.intro {
  background: linear-gradient(160deg, rgba(0,30,60,0.6), rgba(0,10,25,0.4));
  border-radius: var(--radius);
  padding: 40px;
  margin-bottom: 50px;
  border: 1px solid rgba(0,170,255,0.25);
  box-shadow: inset 0 0 40px rgba(0,102,204,0.08);
}

.intro p {
  font-size: 1.05rem;
  color: #c4d2df;
  margin-bottom: 16px;
}

/* ===== 3D INTERACTIVE VIEWER ===== */
.viewer-section {
  padding: 60px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.viewer-wrapper {
  background: linear-gradient(135deg, var(--dark-2), var(--dark-3));
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(0,212,255,0.15);
  box-shadow: var(--shadow);
  position: relative;
}

#three-canvas-container {
  width: 100%;
  height: 560px;
  position: relative;
  background: radial-gradient(ellipse at center, #140a0a 0%, #000000 80%);
  cursor: grab;
}

#three-canvas-container:active {
  cursor: grabbing;
}

#three-canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.viewer-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(13, 27, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  max-width: 280px;
  z-index: 5;
}

.viewer-overlay h4 {
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.viewer-overlay p {
  color: var(--gray-light);
  font-size: 0.82rem;
  line-height: 1.5;
}

.viewer-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 10px;
  z-index: 5;
}

.viewer-btn {
  background: rgba(13, 27, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0,212,255,0.3);
  color: var(--light);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
}

.viewer-btn:hover {
  background: var(--accent);
  color: var(--dark);
  transform: scale(1.1);
}

.viewer-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent);
  font-size: 1.1rem;
  z-index: 10;
}

.viewer-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0,212,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Sensor hotspot tooltip in 3D */
.hotspot-tooltip {
  position: absolute;
  background: rgba(13, 27, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--light);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 20;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.2s;
}

.hotspot-tooltip.visible {
  opacity: 1;
}

.hotspot-tooltip strong {
  color: var(--accent);
}

/* ===== SEARCH & FILTER ===== */
.controls-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50px;
  color: var(--light);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}

.search-box::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.7;
}

.filter-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  padding: 10px 20px;
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50px;
  color: var(--gray-light);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--light);
}

.chip.active {
  background: var(--accent);
  color: var(--dark);
  border-color: var(--accent);
}

/* ===== CATEGORIES ===== */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 60px;
}

.category-card {
  background: var(--dark-2);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid rgba(255,255,255,0.05);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s;
}

.category-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0,212,255,0.15);
}

.category-card:hover::before {
  transform: scaleX(1);
}

.category-icon {
  font-size: 2.2rem;
  margin-bottom: 14px;
}

.category-card h3 {
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.category-card p {
  color: var(--gray);
  font-size: 0.9rem;
}

/* ===== SENSOR CARD GRID ===== */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.sensor-card {
  background: var(--dark-2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
}

.sensor-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,212,255,0.3);
}

.sensor-card-image {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  position: relative;
  background: #000;
}

.sensor-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.sensor-card:hover .sensor-card-image img {
  transform: scale(1.06);
}

.sensor-card-number {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: var(--dark);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  z-index: 2;
  box-shadow: 0 0 16px rgba(0,212,255,0.5);
}

.sensor-card-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(13,27,42,0.85);
  backdrop-filter: blur(8px);
  color: var(--accent-glow);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  z-index: 2;
}

.sensor-card-body {
  padding: 22px;
}

.sensor-card-fr {
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.sensor-card-abbr {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.sensor-card-desc {
  color: var(--gray);
  font-size: 0.88rem;
  line-height: 1.6;
}

.sensor-card-loc {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: var(--accent-glow);
}

/* ===== DETAILED SENSOR SECTION (Modal-based now) ===== */
.sensor-detail {
  background: var(--dark-2);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 40px;
  border: 1px solid rgba(255,255,255,0.06);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  scroll-margin-top: 100px;
}

.sensor-detail.reverse {
  direction: ltr;
}

.sensor-detail.reverse > * {
  direction: rtl;
}

.sensor-detail-image {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 420px;
  position: relative;
}

.sensor-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sensor-detail-content {
  padding: 40px;
}

.sensor-detail-num {
  display: inline-block;
  background: var(--accent);
  color: var(--dark);
  padding: 5px 16px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.sensor-detail-content h3 {
  font-size: 1.65rem;
  color: #fff;
  margin-bottom: 6px;
  font-weight: 800;
}

.sensor-detail-abbr {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: block;
}

.sensor-detail-content > p {
  color: #c4d2df;
  margin-bottom: 14px;
  font-size: 1rem;
}

.info-block {
  background: rgba(0,102,204,0.12);
  border-right: 3px solid var(--primary);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

.info-block.location {
  border-color: var(--accent);
  background: rgba(0,212,255,0.07);
}

.info-block.function {
  border-color: var(--success);
  background: rgba(46,204,113,0.07);
}

.info-block.symptoms {
  border-color: var(--danger);
  background: rgba(231,76,60,0.07);
}

.info-block.dtc {
  border-color: var(--purple);
  background: rgba(155,89,182,0.07);
}

.info-block-label {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-block.location .info-block-label { color: var(--accent); }
.info-block.function .info-block-label { color: var(--success); }
.info-block.symptoms .info-block-label { color: var(--danger); }
.info-block.dtc .info-block-label { color: var(--purple); }
.info-block .info-block-label { color: var(--primary-light); }

.info-block p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.7;
  color: #c4d2df;
}

.info-block p.dtc {
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  color: #e0c4f0;
  font-weight: 600;
}

/* Navigation arrows between sensors */
.sensor-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sensor-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50px;
  color: var(--light);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
}

.sensor-nav-btn:hover {
  background: var(--accent);
  color: var(--dark);
  border-color: var(--accent);
}

.sensor-nav-btn:disabled,
.sensor-nav-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== ELECTRICITY SECTION ===== */
.elec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.elec-card {
  background: var(--dark-2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(52,152,219,0.15);
  transition: var(--transition);
}

.elec-card:hover {
  transform: translateY(-5px);
  border-color: var(--info);
  box-shadow: 0 12px 30px rgba(52,152,219,0.15);
}

.elec-card-header {
  background: linear-gradient(135deg, var(--dark-3), var(--dark-4));
  padding: 20px 24px;
  border-bottom: 1px solid rgba(52,152,219,0.15);
  display: flex;
  align-items: center;
  gap: 14px;
}

.elec-card-icon {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52,152,219,0.15);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.elec-card-header h3 {
  color: var(--info);
  font-size: 1.2rem;
  font-weight: 700;
}

.elec-card-header .fr-sub {
  color: var(--gray);
  font-size: 0.82rem;
  display: block;
  margin-top: 2px;
}

.elec-card-body {
  padding: 24px;
}

.elec-card-body p {
  color: #c4d2df;
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.elec-specs {
  list-style: none;
  padding: 0;
}

.elec-specs li {
  padding: 8px 0;
  color: var(--gray-light);
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-right: 22px;
  position: relative;
}

.elec-specs li::before {
  content: '';
  position: absolute;
  right: 0;
  color: var(--info);
  font-size: 0.85rem;
}

.elec-specs li:last-child {
  border-bottom: none;
}

.elec-specs li strong {
  color: var(--accent-glow);
}

/* Circuit diagram box */
.circuit-diagram {
  background: rgba(52,152,219,0.08);
  border: 1px solid rgba(52,152,219,0.2);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 16px;
  text-align: center;
}

.circuit-diagram .flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.circuit-node {
  background: var(--dark);
  border: 1px solid var(--info);
  color: var(--light);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
}

.circuit-arrow {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 800;
}

/* ===== DIAGNOSTIC SECTION ===== */
.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.diag-card {
  background: var(--dark-2);
  border-radius: var(--radius);
  padding: 26px;
  border: 1px solid rgba(255,255,255,0.06);
  transition: var(--transition);
}

.diag-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.diag-card h4 {
  color: var(--accent);
  margin-bottom: 14px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diag-card ul {
  list-style: none;
  padding: 0;
}

.diag-card li {
  padding: 9px 0;
  color: #c4d2df;
  font-size: 0.92rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-right: 24px;
  position: relative;
}

.diag-card li::before {
  content: '▸';
  position: absolute;
  right: 0;
  color: var(--accent);
}

.diag-card li:last-child {
  border-bottom: none;
}

/* ===== MODAL (for sensor details) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 20, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s;
}

.modal-overlay.open,
.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal {
  background: linear-gradient(180deg, var(--dark-2), #000000);
  border-radius: var(--radius);
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(0,212,255,0.4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,212,255,0.1);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-overlay.open .modal,
.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  z-index: 20;
}

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

/* ===== MODAL TOP: image + info side by side ===== */
.modal-top {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.modal-image {
  background: #000;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-image img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  max-height: 340px;
  object-fit: cover;
}

.modal-info {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.modal-category {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  width: fit-content;
  margin-bottom: 6px;
}

.modal-title {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
}

.modal-abbr {
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
}

.modal-fr {
  color: var(--gray-light);
  font-size: 0.88rem;
  margin: 0;
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  border-right: 3px solid var(--accent);
}

/* ===== MODAL BODY: details in columns ===== */
.modal-body {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ===== MODAL NAV ===== */
.modal-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
}

.modal-nav .btn { flex: 1; }

/* 3D focus button inside modal */
.modal-3d-hint {
  margin-top: 14px;
}
.modal-3d-hint .btn {
  width: 100%;
  font-size: 0.9rem;
  padding: 12px 20px;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  background: var(--accent);
  color: var(--dark);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  box-shadow: 0 6px 20px rgba(0,212,255,0.4);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-4px) scale(1.1);
}

/* ===== FOOTER ===== */
.footer {
  background: #000000;
  padding: 50px 24px 24px;
  text-align: center;
  border-top: 1px solid rgba(0,212,255,0.15);
  margin-top: 60px;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
}

.footer h3 {
  color: var(--accent);
  margin-bottom: 14px;
}

.footer p {
  color: var(--gray);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.footer-bottom {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--gray);
  font-size: 0.85rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .hero h1 { font-size: 2.6rem; }
  .section-title { font-size: 2rem; }
  #three-canvas-container { height: 480px; }
  .modal-body { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .modal-top { grid-template-columns: 1fr; }
  .modal-image { min-height: 220px; max-height: 260px; }
  .modal-image img { min-height: 220px; max-height: 260px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-info { padding: 20px; }
  .modal-body { padding: 20px; }
  .modal-nav { padding: 14px 20px; }
}

@media (max-width: 900px) {
  .sensor-detail {
    grid-template-columns: 1fr;
  }
  .sensor-detail.reverse { direction: rtl; }
  .nav-links {
    display: none;
    position: fixed;
    top: 60px;
    right: 0;
    left: 0;
    background: var(--dark-2);
    flex-direction: column;
    padding: 20px;
    border-bottom: 1px solid rgba(0,212,255,0.2);
    gap: 8px;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 12px;
    border-radius: var(--radius-sm);
  }
  .nav-links a:hover {
    background: var(--dark-3);
  }
  .menu-toggle {
    display: flex;
  }
  .viewer-overlay {
    max-width: 220px;
    padding: 10px 14px;
    font-size: 0.8rem;
  }
  .viewer-overlay p { display: none; }
}

@media (max-width: 600px) {
  .hero { padding: 90px 16px 40px; }
  .hero h1 { font-size: 1.9rem; }
  .hero h1 .fr { font-size: 1.05rem; }
  .hero p { font-size: 1rem; }
  .section { padding: 60px 16px; }
  .section-title { font-size: 1.6rem; }
  .sensor-detail-content { padding: 24px; }
  .hero-stats { gap: 24px; }
  .stat-num { font-size: 1.9rem; }
  #three-canvas-container { height: 380px; }
  .viewer-overlay {
    top: 10px;
    right: 10px;
    max-width: 180px;
  }
  .viewer-controls {
    bottom: 10px;
    left: 10px;
  }
  .viewer-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  .modal-overlay { padding: 10px; }
  .modal { max-height: 95vh; }
  .modal-top { grid-template-columns: 1fr; }
  .modal-image { min-height: 180px; }
  .modal-image img { min-height: 180px; max-height: 220px; }
  .modal-info { padding: 16px; }
  .modal-title { font-size: 1.15rem; }
  .modal-body { padding: 16px; grid-template-columns: 1fr; }
  .modal-nav { padding: 12px 16px; }
  .modal-close { top: 10px; left: 10px; width: 34px; height: 34px; }
  .btn { padding: 12px 24px; font-size: 0.95rem; }
  .intro { padding: 24px; }
  .back-to-top { bottom: 20px; left: 20px; width: 44px; height: 44px; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .filter-chips { justify-content: center; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: 1.6rem; }
  .logo { font-size: 1.1rem; }
  #three-canvas-container { height: 320px; }
  .viewer-overlay { display: none; }
}

/* Smooth animations on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   SUPPLEMENTARY STYLES — added during build
   ============================================================ */

/* ---- Hero subtitle & accent span ---- */
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--gray-light);
  max-width: 620px;
  margin: 0 auto 1.8rem;
  line-height: 1.85;
}
.hero-subtitle strong { color: var(--light); }
.accent, .hero-content .accent {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0,212,255,0.3);
}

/* ---- Logo text ---- */
.logo-text {
  display: flex;
  flex-direction: column;
  font-weight: 900;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--light);
}
.logo-text .fr {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* ---- Loading overlay & spinner ---- */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13,27,42,0.85);
  z-index: 5;
  gap: 14px;
  color: var(--gray-light);
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0,212,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Viewer hint text ---- */
.viewer-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13,27,42,0.7);
  color: var(--gray-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(0,212,255,0.25);
  backdrop-filter: blur(6px);
}
@media (max-width: 600px) {
  .viewer-hint { font-size: 0.7rem; padding: 5px 10px; max-width: 90%; white-space: normal; text-align: center; }
}

/* ---- Tooltip hotspot abbreviation ---- */
.hotspot-tooltip .tt-abbr {
  display: block;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

/* ---- Viewer selected info panel ---- */
.viewer-selected-info {
  margin: 16px auto 0;
  max-width: 720px;
  background: linear-gradient(135deg, var(--dark-2), var(--dark-3));
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 90px;
  transition: var(--transition);
}
.viewer-selected-info .hint {
  color: var(--gray);
  font-size: 0.95rem;
  width: 100%;
  text-align: center;
}
.viewer-selected-info .sel-num {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
}
.viewer-selected-info .sel-content { flex: 1; }
.viewer-selected-info .sel-content h4 {
  color: var(--light);
  font-size: 1.1rem;
  margin-bottom: 2px;
}
.viewer-selected-info .sel-abbr {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.viewer-selected-info .sel-desc {
  color: var(--gray-light);
  font-size: 0.92rem;
  margin-bottom: 8px;
}
.viewer-selected-info .sel-open { font-size: 0.85rem; padding: 8px 18px; }
@media (max-width: 600px) {
  .viewer-selected-info { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
}

/* ---- Category card count ---- */
.cat-count {
  display: inline-block;
  margin-top: 10px;
  background: var(--dark-3);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* ---- No results ---- */
.no-results {
  text-align: center;
  color: var(--gray);
  font-size: 1.1rem;
  padding: 40px 0;
}

/* ---- Diagnostic card icon ---- */
.diag-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark-3), var(--dark-4));
  border-radius: 14px;
  border: 1px solid var(--accent);
}

/* ---- Electricity section background ---- */
.elec-section {
  background: linear-gradient(180deg, var(--dark) 0%, #0a1828 50%, var(--dark) 100%);
  position: relative;
}
.elec-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--info), transparent);
}

/* ---- Footer columns ---- */
.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
}
.footer-col h3 {
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 14px;
}
.footer-col p { color: var(--gray-light); font-size: 0.92rem; }
.footer-col ul { list-style: none; }
.footer-col ul li {
  color: var(--gray-light);
  font-size: 0.92rem;
  padding: 5px 0;
}
.footer-col ul li a {
  color: var(--gray-light);
  text-decoration: none;
  transition: var(--transition);
}
.footer-col ul li a:hover { color: var(--accent); padding-right: 6px; }
@media (max-width: 700px) {
  .footer-content { grid-template-columns: 1fr; gap: 24px; }
}

/* ---- Back to top visible state ---- */
.back-to-top {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--dark);
  border: none;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
  z-index: 90;
  box-shadow: var(--shadow);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover { transform: translateY(-4px) scale(1.08); box-shadow: 0 14px 30px rgba(0,212,255,0.5); }

/* ---- Fade-in visible state (already partially defined, ensure) ---- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Controls bar active state ---- */
.btn-secondary.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: var(--dark);
  border-color: var(--accent);
}

/* ---- Chip active base (ensure) ---- */
.chip {
  cursor: pointer;
  transition: var(--transition);
}
.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-color: var(--primary-light);
}

/* ---- Mobile menu open state ---- */
.menu-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 70px;
    right: 0;
    left: 0;
    background: var(--dark-2);
    padding: 20px;
    gap: 14px;
    box-shadow: var(--shadow-lg);
    border-top: 1px solid var(--dark-4);
  }
}

/* ---- Sensor grid ---- */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ---- Section tag refinement ---- */
.section-tag {
  display: inline-block;
  background: rgba(0,212,255,0.12);
  color: var(--accent);
  padding: 5px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  border: 1px solid rgba(0,212,255,0.3);
}

/* ============================================================
   THREE.js UI Effects — particle background & 3D transitions
   ============================================================ */

/* Hero 3D particle background canvas container */
.hero-3d-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.hero-3d-bg canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Ensure hero content always above the 3D background */
.hero-content,
.hero-image,
.hero-stats {
  position: relative;
  z-index: 2;
}

/* 3D tilt perspective for hero image (driven by JS parallax) */
.hero-image img {
  transition: transform 0.1s linear, opacity 0.3s ease;
  will-change: transform, opacity;
  transform-style: preserve-3d;
}

/* ---- 3D card tilt on hover (desktop) ---- */
@media (min-width: 769px) {
  .sensor-card,
  .category-card,
  .elec-card,
  .diag-card {
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.3s ease;
  }
}

/* ---- Smooth 3D modal entrance already handled, add depth glow ---- */
.modal {
  transform-style: preserve-3d;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,212,255,0.1), 0 0 80px rgba(0,102,204,0.25);
}

/* ---- Section reveal with subtle 3D perspective ---- */
.section {
  perspective: 1200px;
}
.section-header,
.intro-content {
  will-change: transform, opacity;
}

/* ============================================================
   AMBIENT EFFECTS — scanline, neon glow accents
   ============================================================ */

/* Full-screen ambient overlay (sits above bg, below content) */
.ambient-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* Neon scanline at bottom of viewport */
.ambient-overlay::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 212, 255, 0.6) 20%,
    rgba(0,102,204, 0.6) 50%,
    rgba(0, 212, 255, 0.6) 80%,
    transparent 100%);
  animation: scanline 4s ease-in-out infinite;
  opacity: 0.5;
}

@keyframes scanline {
  0%, 100% { transform: scaleX(0.3); opacity: 0.2; }
  50% { transform: scaleX(1); opacity: 0.6; }
}

/* Neon glow border on cards (hover accent) */
.sensor-card:hover,
.elec-card:hover,
.diag-card:hover {
  box-shadow: 0 0 25px rgba(0, 212, 255, 0.15), 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* Category card red accent border */
.category-card {
  border-left: 3px solid var(--dk-red);
}

/* ---- Stat counter 3D pop ---- */
.stat {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}
.stat:hover {
  transform: translateY(-4px) scale(1.05);
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

/* ---- Floating animation utility ---- */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---- Button 3D press effect ---- */
.btn {
  transform: translateZ(0);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}

/* ============================================================
   GAME SECTION — لعبة معرفة الحساس
   ============================================================ */
.game-section {
  background: linear-gradient(180deg, var(--dark-2) 0%, var(--dark) 100%);
  padding-bottom: 80px;
}

.game-container {
  max-width: 720px;
  margin: 0 auto;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(0,102,204,0.08);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

/* ---- Start Screen ---- */
.game-start {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 30px;
  text-align: center;
}
.game-start-inner h3 {
  font-size: 1.8rem;
  margin: 20px 0 12px;
  color: var(--light);
}
.game-start-inner p {
  color: var(--gray);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 30px;
  max-width: 480px;
}
.game-icon-big {
  font-size: 4rem;
  animation: floatY 3s ease-in-out infinite;
}

.btn-lg {
  padding: 16px 48px !important;
  font-size: 1.2rem !important;
  border-radius: 14px !important;
}

/* ---- Play Screen ---- */
.game-play {
  flex: 1;
  padding: 30px;
  display: flex;
  flex-direction: column;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hud-item {
  background: var(--dark-4);
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  flex: 1;
  min-width: 80px;
  border: 1px solid rgba(255,255,255,0.05);
}
.hud-label {
  display: block;
  font-size: 0.75rem;
  color: var(--gray);
  margin-bottom: 4px;
}
.hud-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--light);
  font-family: 'Cairo', sans-serif;
}
.hud-score { color: var(--accent); text-shadow: 0 0 12px rgba(0,212,255,0.3); }
.hud-streak { color: var(--dk-yellow); }

.game-progress-bar {
  height: 6px;
  background: var(--dark-4);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}
.game-progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-question {
  text-align: center;
}
.game-prompt {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--light);
  margin-bottom: 20px;
}

.game-image-wrap {
  background: var(--dark);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 24px;
  border: 2px solid var(--dark-4);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}
.game-image-wrap img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  object-fit: contain;
}

.game-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.game-choice {
  background: var(--dark-4);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--light);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s ease;
  font-family: 'Cairo', sans-serif;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.game-choice:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(0,102,204,0.15);
  transform: translateY(-2px);
}
.game-choice .choice-fr {
  font-size: 0.8rem;
  color: var(--gray);
  font-weight: 400;
}
.game-choice.correct {
  border-color: var(--accent);
  background: rgba(0,212,255,0.15);
  color: var(--accent);
  animation: pulseCorrect 0.5s ease;
}
.game-choice.correct .choice-fr { color: var(--accent-glow); }
.game-choice.wrong {
  border-color: var(--primary-light);
  background: rgba(51,153,255,0.15);
  color: var(--primary-light);
  animation: shakeWrong 0.4s ease;
}
.game-choice:disabled { cursor: default; opacity: 0.65; }
.game-choice.correct:disabled, .game-choice.wrong:disabled { opacity: 1; }

@keyframes pulseCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---- Feedback ---- */
.game-feedback {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  animation: fadeInUp 0.3s ease;
}
.game-feedback.correct {
  background: rgba(0,212,255,0.12);
  border: 1px solid var(--accent-dark);
  color: var(--accent);
}
.game-feedback.wrong {
  background: rgba(51,153,255,0.12);
  border: 1px solid var(--primary);
  color: var(--primary-light);
}
.game-feedback .fb-detail {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--gray);
}
.game-feedback .fb-continue {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--accent-dark);
}

/* ---- End Screen ---- */
.game-end {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 30px;
  text-align: center;
}
.game-end-inner { max-width: 460px; }
.game-end-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: floatY 2.5s ease-in-out infinite;
}
.game-end-inner h3 {
  font-size: 2rem;
  color: var(--light);
  margin-bottom: 20px;
}
.game-end-score {
  background: var(--dark-4);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}
.end-score-num {
  display: block;
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(0,212,255,0.3);
  font-family: 'Cairo', sans-serif;
}
.end-score-label {
  color: var(--gray);
  font-size: 0.9rem;
}
.game-end-stats {
  color: var(--gray);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 24px;
}
.game-end-stats strong { color: var(--light); }
.game-end-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.game-best {
  font-size: 0.85rem;
  color: var(--dk-yellow);
  margin-top: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .game-choices { grid-template-columns: 1fr; }
  .hud-item { min-width: 70px; padding: 8px 10px; }
  .hud-value { font-size: 1.1rem; }
  .game-image-wrap img { max-height: 200px; }
  .game-start-inner h3 { font-size: 1.4rem; }
  .end-score-num { font-size: 2.4rem; }
}

/* =====================================================================
   ===== صفحة أكواد الأعطال (DTC) — codes.html =====
   ===================================================================== */

/* Navbar solid variant (no transparency on sub-pages) */
.navbar-solid {
  background: rgba(10, 10, 10, 0.97) !important;
  backdrop-filter: blur(12px);
}

/* ----- Codes Hero ----- */
.codes-hero {
  min-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7rem 1.5rem 3rem;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(0, 212, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(0,102,204, 0.08), transparent 60%),
    var(--dark);
  position: relative;
  overflow: hidden;
}
.codes-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}
.codes-hero-inner { position: relative; z-index: 1; max-width: 900px; }
.codes-hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  margin: 1rem 0;
  line-height: 1.2;
  font-family: 'Cairo', sans-serif;
}
.codes-hero h1 .accent { color: var(--accent); text-shadow: 0 0 30px rgba(0, 212, 255, 0.3); }
.codes-hero .hero-subtitle {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--gray-light);
  max-width: 760px;
  margin: 0 auto 2rem;
}
.codes-hero .hero-badge {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 100px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}
.codes-hero .hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 2.5rem;
}
.codes-hero .stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.5rem;
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  min-width: 140px;
}
.codes-hero .stat-num {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent);
  font-family: 'Cairo', sans-serif;
}
.codes-hero .stat-label { color: var(--gray-light); font-size: 0.85rem; }

/* ----- Info banner / code structure ----- */
.codes-info-banner {
  padding: 3rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
.code-structure-diagram {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}
.structure-example {
  display: flex;
  gap: 0.6rem;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  flex-wrap: wrap;
  justify-content: center;
}
.struct-char {
  width: 70px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--dark-3), var(--dark-4));
  border: 2px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.15);
  position: relative;
  cursor: help;
  transition: var(--transition);
}
.struct-char:nth-child(1) { border-color: #5a67d8; color: #5a67d8; box-shadow: 0 4px 20px rgba(90,103,216,0.2); }
.struct-char:nth-child(2) { border-color: #f4a261; color: #f4a261; box-shadow: 0 4px 20px rgba(244,162,97,0.2); }
.struct-char:nth-child(3) { border-color: #2a9d8f; color: #2a9d8f; box-shadow: 0 4px 20px rgba(42,157,143,0.2); }
.struct-char:nth-child(4), .struct-char:nth-child(5) { border-color: #4361ee; color: #4361ee; box-shadow: 0 4px 20px rgba(67,97,238,0.2); }
.struct-char.small { width: 55px; height: 80px; }
.struct-char:hover { transform: translateY(-4px) scale(1.05); }
.struct-char:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  padding: 0.7rem 0.9rem;
  background: var(--dark-3);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--light);
  font-family: 'Cairo', 'Tajawal', sans-serif;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}
.structure-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-light);
  font-size: 0.9rem;
}
.legend-dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
}

/* ----- Category cards grid ----- */
.codes-categories-section { padding: 2rem 1.5rem 1rem; }
.dtc-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.dtc-cat-card {
  background: linear-gradient(135deg, var(--dark-3), var(--dark-4));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.8rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.dtc-cat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  background: var(--cat-color);
}
.dtc-cat-card:hover {
  transform: translateY(-6px);
  border-color: var(--cat-color);
  box-shadow: 0 15px 40px rgba(0,0,0,0.5), 0 0 30px var(--cat-color)22;
}
.dtc-cat-icon {
  font-size: 2.5rem;
  background: rgba(255,255,255,0.05);
  width: 60px; height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dtc-cat-info { flex: 1; }
.dtc-cat-letter {
  display: inline-block;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--cat-color);
  font-family: 'Courier New', monospace;
  margin-bottom: 0.3rem;
}
.dtc-cat-info h3 { font-size: 1.15rem; color: var(--light); margin-bottom: 0.2rem; }
.dtc-cat-en { color: var(--accent); font-size: 0.85rem; margin-bottom: 0.5rem; }
.dtc-cat-desc { color: var(--gray-light); font-size: 0.85rem; line-height: 1.6; margin-bottom: 0.8rem; }
.dtc-cat-count {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  background: var(--cat-color);
  color: #000;
  font-weight: 700;
  border-radius: 100px;
  font-size: 0.8rem;
}

/* ----- Codes main section / controls ----- */
.codes-main-section { padding: 2rem 1.5rem 4rem; }
.codes-controls {
  max-width: 1200px;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.codes-search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}
.codes-search-box .search-icon {
  position: absolute;
  right: 1rem;
  font-size: 1.2rem;
  pointer-events: none;
}
.codes-search-box input {
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  background: var(--dark-3);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--light);
  font-size: 1rem;
  font-family: 'Cairo', 'Tajawal', sans-serif;
  transition: var(--transition);
}
.codes-search-box input::placeholder { color: var(--gray); }
.codes-search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0,212,255,0.15);
}
.codes-clear-btn {
  position: absolute;
  left: 1rem;
  background: var(--dark-4);
  border: none;
  color: var(--gray);
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}
.codes-clear-btn:hover { background: var(--danger); color: #fff; }

.codes-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
.codes-filter-row .filter-chips { justify-content: center; }
.severity-chips .chip { font-size: 0.85rem; }

/* Custom chips for DTC page */
#dtcCatChips .chip, #dtcSeverityChips .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--dark-3);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  color: var(--gray-light);
  cursor: pointer;
  font-family: 'Cairo','Tajawal',sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
}
#dtcCatChips .chip:hover, #dtcSeverityChips .chip:hover {
  border-color: var(--chip-color, var(--accent));
  color: var(--light);
}
#dtcCatChips .chip.active, #dtcSeverityChips .chip.active {
  background: var(--chip-color, var(--accent));
  border-color: var(--chip-color, var(--accent));
  color: #000;
  font-weight: 700;
}
.chip-icon { font-size: 1rem; }
.chip-count {
  background: rgba(0,0,0,0.25);
  padding: 0.1rem 0.5rem;
  border-radius: 100px;
  font-size: 0.75rem;
}

.codes-summary {
  text-align: center;
  color: var(--gray-light);
  font-size: 0.95rem;
  padding: 0.5rem;
}
.codes-summary strong { color: var(--accent); }

/* ----- DTC codes grid ----- */
.dtc-codes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
  max-width: 1300px;
  margin: 0 auto;
}
.dtc-card {
  background: linear-gradient(160deg, #1a1a2e, #16213e);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: var(--radius);
  padding: 1.4rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  opacity: 1 !important;
}

.dtc-cat-card {
  opacity: 1 !important;
}
.dtc-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--cat-color), transparent);
}
.dtc-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--sev-color);
  opacity: 0.6;
}
.dtc-card:hover {
  transform: translateY(-5px);
  border-color: var(--cat-color);
  box-shadow: 0 12px 35px rgba(0,0,0,0.5);
}
.dtc-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dtc-card-code {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cat-color);
  letter-spacing: 1px;
  background: rgba(0,0,0,0.4);
  padding: 4px 10px;
  border-radius: 8px;
  text-shadow: 0 0 8px currentColor;
}
.dtc-card-sev {
  font-size: 0.8rem;
  color: var(--sev-color);
  font-weight: 600;
  white-space: nowrap;
}
.dtc-card-cat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--gray);
}
.dtc-card-cat-label { font-weight: 600; }
.dtc-card-desc {
  color: var(--light);
  font-size: 0.95rem;
  line-height: 1.6;
  font-weight: 500;
}
.dtc-card-fr {
  color: var(--accent);
  font-size: 0.85rem;
  line-height: 1.5;
  font-style: italic;
}
.dtc-card-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: auto;
}
.dtc-tag {
  padding: 0.2rem 0.6rem;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--accent);
}
.dtc-card-btn {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--gray-light);
  font-family: 'Cairo','Tajawal',sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.dtc-card:hover .dtc-card-btn {
  background: var(--cat-color);
  color: #000;
  border-color: var(--cat-color);
  font-weight: 700;
}

/* ----- DTC Modal ----- */
#dtcModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 9999;
  padding: 2rem 1rem;
  overflow-y: auto;
}
#dtcModalOverlay.active { display: flex; }
.dtc-modal {
  background: linear-gradient(160deg, var(--dark-2), var(--dark-3));
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius);
  max-width: 700px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: dtcModalIn 0.3s ease;
}
@keyframes dtcModalIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dtc-modal .modal-close {
  position: absolute;
  top: 1rem; left: 1rem;
  background: var(--dark-4);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--light);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition);
}
.dtc-modal .modal-close:hover { background: var(--danger); transform: rotate(90deg); }
.dtc-modal-header {
  padding: 2rem 1.8rem 1.2rem;
  border-top: 4px solid var(--accent);
  background: linear-gradient(180deg, rgba(0,212,255,0.04), transparent);
}
.dtc-modal-code-wrap { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.dtc-modal-cat-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  color: #000;
  font-size: 0.8rem;
  font-weight: 700;
}
.dtc-modal-code {
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  font-weight: 900;
  color: var(--cat-color, var(--accent));
  letter-spacing: 2px;
}
.dtc-modal-sev-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
}
.dtc-modal-title-ar {
  font-size: 1.2rem;
  color: var(--light);
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 0.4rem;
}
.dtc-modal-title-fr {
  font-size: 1rem;
  color: var(--accent);
  font-style: italic;
  line-height: 1.5;
}
.dtc-modal-body { padding: 1rem 1.8rem 2rem; }
.dtc-detail-block { margin-bottom: 1.5rem; }
.dtc-detail-block h4 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(0,212,255,0.15);
}
.dtc-list { list-style: none; padding: 0; }
.dtc-list li {
  position: relative;
  padding-right: 1.5rem;
  padding-bottom: 0.5rem;
  color: var(--light);
  font-size: 0.92rem;
  line-height: 1.6;
}
.dtc-list li::before {
  content: '◆';
  position: absolute;
  right: 0;
  color: var(--accent);
  font-size: 0.7rem;
  top: 0.3rem;
}
.dtc-symptoms li::before { color: var(--danger); content: ''; }
.dtc-fix-block {
  background: rgba(0,212,255,0.05);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}
.dtc-fix-block h4 { border-bottom: none; padding-bottom: 0; }
.dtc-fix-text {
  color: var(--light);
  font-size: 0.95rem;
  line-height: 1.7;
}
.dtc-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.85rem;
  color: var(--gray);
}
.dtc-meta-item strong { color: var(--accent); }

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .codes-hero { min-height: auto; padding: 6rem 1rem 2rem; }
  .codes-hero h1 { font-size: 1.8rem; }
  .codes-hero .hero-stats { gap: 0.8rem; }
  .codes-hero .stat { min-width: 110px; padding: 0.8rem 1rem; }
  .codes-hero .stat-num { font-size: 1.6rem; }
  .struct-char { width: 50px; height: 60px; font-size: 1.4rem; }
  .struct-char.small { width: 42px; }
  .struct-char:hover::after { display: none; }
  .dtc-codes-grid { grid-template-columns: 1fr; }
  .codes-filter-row { flex-direction: column; align-items: center; }
  .dtc-modal-code { font-size: 1.5rem; }
  .dtc-modal-header, .dtc-modal-body { padding: 1.5rem 1.2rem; }
}
@media (max-width: 480px) {
  .dtc-cat-grid { grid-template-columns: 1fr; }
  .structure-legend { flex-direction: column; gap: 0.5rem; }
}


/* ============================================================
   LEARN.JS EDUCATIONAL FEATURES — CSS (Standard Arabic)
   Progress Dashboard · Flashcards · Quiz · Summary · Card Extras
   ============================================================ */

/* ===== LEARN SECTION (shared) ===== */
.learn-section {
  scroll-margin-top: 90px;
}

/* ===== PROGRESS DASHBOARD ===== */
.progress-dash {
  max-width: 900px;
  margin: 0 auto;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.dash-card {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  transition: var(--transition);
}

.dash-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

.dash-num {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 0 18px rgba(0,212,255,0.25);
}

.dash-label {
  font-size: 0.82rem;
  color: var(--gray-light);
  font-weight: 600;
}

.dash-bar-wrap {
  max-width: 600px;
  margin: 0 auto 24px;
}

.dash-bar-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--gray-light);
}

.dash-bar-info span:last-child {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.1rem;
}

.dash-bar {
  height: 14px;
  background: var(--dark-3);
  border-radius: 50px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.dash-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  border-radius: 50px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 14px rgba(0,212,255,0.4);
}

.dash-actions {
  text-align: center;
}

.dash-reset {
  font-size: 0.85rem;
  padding: 10px 22px;
}

.dash-reset:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ===== MINI BUTTON (shared small button) ===== */
.mini-btn {
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--gray-light);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,212,255,0.08);
  transform: translateY(-2px);
}

.mini-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: #000;
  border-color: var(--accent);
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0,212,255,0.3);
}

/* ===== CARD EXTRA (buttons on sensor cards) ===== */
.card-extra {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}

.card-extra .mini-btn {
  flex: 1;
  justify-content: center;
  min-width: 0;
  font-size: 0.75rem;
  padding: 7px 10px;
}

.learn-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: #000;
}

.fav-btn.active {
  background: linear-gradient(135deg, var(--dk-yellow), #ffaa00);
  color: #000;
  border-color: var(--dk-yellow);
  box-shadow: 0 4px 14px rgba(255,215,0,0.3);
}

/* ===== NOTES BLOCK (inside modal) ===== */
.notes-block {
  grid-column: 1 / -1;
  background: rgba(0,212,255,0.06);
  border-color: var(--accent);
  border-right: 3px solid var(--accent);
}

.notes-block .info-block-label {
  color: var(--accent);
}

.note-area {
  width: 100%;
  min-height: 90px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--light);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  transition: var(--transition);
}

.note-area:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0,0,0,0.6);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}

.note-area::placeholder {
  color: var(--gray);
}

.modal-extra-btns {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.modal-extra-btns .mini-btn {
  flex: 1;
  justify-content: center;
  min-width: 120px;
}

/* ===== FLASHCARDS ===== */
.flash-wrap {
  max-width: 620px;
  margin: 0 auto;
}

.flash-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.flash-filter {
  padding: 10px 18px;
  border-radius: 50px;
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--light);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  min-width: 200px;
}

.flash-filter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}

.flash-counter {
  background: var(--dark-2);
  border: 1px solid rgba(0,212,255,0.3);
  color: var(--accent);
  padding: 8px 18px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
}

.flash-card {
  width: 100%;
  height: 440px;
  perspective: 1200px;
  cursor: pointer;
  margin-bottom: 20px;
}

.flash-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flash-inner.flipped {
  transform: rotateY(180deg);
}

.flash-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(0,212,255,0.25);
  background: linear-gradient(180deg, var(--dark-2), #000);
  box-shadow: 0 16px 50px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  text-align: center;
  overflow-y: auto;
}

.flash-front {
  justify-content: flex-start;
  gap: 10px;
}

.flash-img-wrap {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 0 0 24px rgba(0,212,255,0.2);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.flash-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flash-fr {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.flash-abbr {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.flash-cat {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.76rem;
  font-weight: 600;
}

.flash-hint {
  margin-top: auto;
  padding-top: 12px;
  color: var(--gray);
  font-size: 0.8rem;
}

/* Flashcard back face */
.flash-back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  gap: 10px;
  text-align: right;
  align-items: stretch;
}

.flash-back-title {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 4px;
  text-align: center;
}

.flash-back-desc {
  color: #c4d2df;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 8px;
  text-align: center;
}

.flash-back-section {
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border-right: 3px solid var(--accent);
}

.flash-back-section strong {
  color: var(--accent-glow);
  font-size: 0.82rem;
  display: block;
  margin-bottom: 4px;
}

.flash-back-section p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.6;
  color: #c4d2df;
}

.flash-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 1rem;
  text-align: center;
  background: var(--dark-2);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
}

.flash-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.flash-nav .btn {
  padding: 12px 24px;
  font-size: 0.9rem;
}

.flash-nav .mini-btn {
  flex: 1;
  justify-content: center;
  min-width: 160px;
}

/* ===== QUIZ CHOICES (supplemental to game-choice) ===== */
.quiz-choice {
  width: 100%;
  text-align: right;
  padding: 16px 22px;
  border-radius: var(--radius-sm);
  background: var(--dark-2);
  border: 2px solid rgba(255,255,255,0.08);
  color: var(--light);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 10px;
}

.quiz-choice:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(0,212,255,0.08);
  transform: translateX(-4px);
}

.quiz-choice.correct {
  background: rgba(0,212,255,0.15);
  border-color: var(--accent);
  color: var(--accent-glow);
  box-shadow: 0 0 16px rgba(0,212,255,0.2);
}

.quiz-choice.wrong {
  background: rgba(0,102,204,0.15);
  border-color: var(--danger);
  color: #ff6666;
}

.quiz-choice:disabled {
  cursor: default;
  opacity: 0.7;
}

.quiz-choice.correct:disabled,
.quiz-choice.wrong:disabled {
  opacity: 1;
}

.quiz-feedback {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  animation: fadeInUp 0.4s ease;
}

.quiz-feedback.correct {
  background: rgba(0,212,255,0.12);
  border: 1px solid var(--accent);
  color: var(--accent-glow);
}

.quiz-feedback.wrong {
  background: rgba(0,102,204,0.12);
  border: 1px solid var(--danger);
  color: #ff7777;
}

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

/* ===== SUMMARY / REVIEW SECTION ===== */
.summary-box {
  max-width: 1000px;
  margin: 0 auto;
}

.summary-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  justify-content: center;
}

.summary-tab {
  padding: 10px 22px;
  border-radius: 50px;
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--gray-light);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.summary-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.summary-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: #000;
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0,212,255,0.3);
}

.summary-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.summary-row {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: var(--transition);
}

.summary-row:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}

.summary-row.learned {
  border-right: 3px solid var(--accent);
}

.summary-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.summary-num {
  background: var(--accent);
  color: #000;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.summary-fr {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
}

.summary-abbr {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(0,212,255,0.08);
  padding: 2px 10px;
  border-radius: 50px;
}

.summary-badge {
  background: var(--accent);
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 50px;
}

.summary-short {
  color: var(--gray-light);
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 0 0 8px;
}

.summary-meta {
  font-size: 0.78rem;
  color: var(--accent-glow);
}

.summary-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--gray);
  padding: 40px;
  font-size: 1rem;
}

/* ===== RESPONSIVE for learn features ===== */
@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .summary-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .flash-card {
    height: 400px;
  }
  .flash-img-wrap {
    width: 140px;
    height: 140px;
  }
  .flash-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .flash-nav {
    flex-direction: column;
  }
  .flash-nav .btn,
  .flash-nav .mini-btn {
    width: 100%;
    justify-content: center;
  }
  .modal-extra-btns {
    flex-direction: column;
  }
  .modal-extra-btns .mini-btn {
    width: 100%;
  }
  .summary-tabs {
    gap: 6px;
  }
  .summary-tab {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
}

/* ===== END LEARN FEATURES CSS ===== */

/* =====================================================================
   COURSE MODULES — كورس كهرباء السيارة الشامل
   ===================================================================== */
.course-section {
  position: relative;
}

/* --- course overview / progress dashboard --- */
.course-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark-2), var(--dark-3));
  border: 1px solid rgba(0,212,255,0.12);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 40px;
}

.course-overview-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.course-overview-ring svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.course-overview-ring .ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 8;
}

.course-overview-ring .ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 0 6px rgba(0,212,255,0.5));
}

.course-overview-ring .ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.course-overview-ring .ring-pct {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
}

.course-overview-ring .ring-label {
  font-size: 0.7rem;
  color: var(--gray);
}

.course-overview-stats {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 260px;
  justify-content: center;
}

.course-overview-stat {
  text-align: center;
}

.course-overview-stat .num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.course-overview-stat .lbl {
  display: block;
  font-size: 0.85rem;
  color: var(--gray);
  margin-top: 6px;
}

/* --- course controls --- */
.course-controls {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.course-controls .btn {
  padding: 10px 22px;
  font-size: 0.9rem;
}

/* --- module card --- */
.course-modules {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.course-module {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  --mod-color: var(--accent);
}

.course-module:hover {
  border-color: rgba(255,255,255,0.15);
}

.course-module.open {
  border-color: var(--mod-color);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 0 1px var(--mod-color)22;
}

.course-module-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 28px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  user-select: none;
}

.course-module-header:hover {
  background: rgba(255,255,255,0.03);
}

.course-module-icon {
  font-size: 1.8rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.course-module-meta {
  flex: 1;
  min-width: 0;
}

.course-module-level {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border: 1px solid;
  border-radius: 50px;
  margin-bottom: 8px;
}

.course-module-meta h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.course-module-fr {
  display: block;
  font-size: 0.82rem;
  color: var(--gray);
  margin-bottom: 8px;
}

.course-module-desc {
  font-size: 0.88rem;
  color: #b0b8c0;
  line-height: 1.6;
}

.course-module-info {
  text-align: center;
  flex-shrink: 0;
  padding: 0 8px;
}

.course-module-count {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--mod-color);
  line-height: 1;
}

.course-module-count small {
  font-size: 0.65rem;
  color: var(--gray);
  font-weight: 400;
}

.course-module-num {
  display: block;
  font-size: 0.7rem;
  color: var(--gray);
  margin-top: 4px;
  letter-spacing: 1px;
}

.course-module-chevron {
  font-size: 0.9rem;
  color: var(--gray);
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-top: 4px;
}

.course-module.open .course-module-chevron {
  transform: rotate(180deg);
  color: var(--mod-color);
}

/* --- progress bar (inside header) --- */
.course-module-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255,255,255,0.06);
}

.course-module-progress-fill {
  height: 100%;
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 0 0 0 var(--radius);
}

.course-module-progress-text {
  position: absolute;
  bottom: -22px;
  left: 16px;
  font-size: 0.68rem;
  color: var(--gray);
  white-space: nowrap;
}

/* --- module body (collapsible) --- */
.course-module-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4,0,0.2,1);
}

.course-module.open .course-module-body {
  max-height: 99999px;
}

.course-module-body-inner {
  padding: 8px 28px 28px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* --- chapter --- */
.course-chapter {
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  overflow: hidden;
}

.course-chapter-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.course-chapter-header:hover {
  background: rgba(255,255,255,0.03);
}

.course-chapter-idx {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mod-color);
  color: #000;
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.course-chapter-titles {
  flex: 1;
  min-width: 0;
}

.course-chapter-titles h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #e0e6ec;
}

.course-chapter-titles span {
  font-size: 0.78rem;
  color: var(--gray);
}

.course-chapter-count {
  font-size: 0.75rem;
  color: var(--gray);
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}

.course-chapter-chevron {
  font-size: 0.7rem;
  color: var(--gray);
  transition: transform 0.3s ease;
}

.course-chapter.open .course-chapter-chevron {
  transform: rotate(90deg);
  color: var(--mod-color);
}

/* --- lessons list --- */
.course-lessons {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  border-top: 1px solid transparent;
}

.course-chapter.open .course-lessons {
  max-height: 99999px;
  border-top-color: rgba(255,255,255,0.05);
}

/* --- single lesson --- */
.course-lesson {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition);
}

.course-lesson:last-child {
  border-bottom: none;
}

.course-lesson.done {
  background: rgba(0,212,255,0.04);
}

.course-lesson-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.course-lesson-header:hover {
  background: rgba(255,255,255,0.03);
}

.course-lesson-check {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.course-lesson-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.course-lesson-check:hover {
  border-color: var(--accent);
}

.course-lesson-titles {
  flex: 1;
  min-width: 0;
}

.course-lesson-titles h5 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #d0d8e0;
  line-height: 1.4;
}

.course-lesson.done .course-lesson-titles h5 {
  color: #9098a0;
  text-decoration: line-through;
  text-decoration-color: rgba(0,212,255,0.4);
}

.course-lesson-titles span {
  font-size: 0.75rem;
  color: var(--gray);
}

.course-lesson-duration {
  font-size: 0.72rem;
  color: var(--gray);
  white-space: nowrap;
  background: rgba(255,255,255,0.04);
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.course-lesson-chevron {
  font-size: 1.1rem;
  color: var(--gray);
  font-weight: 300;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.course-lesson.open .course-lesson-chevron {
  transform: rotate(45deg);
  color: var(--mod-color);
}

/* --- lesson body (content) --- */
.course-lesson-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.course-lesson.open .course-lesson-body {
  max-height: 99999px;
}

.course-lesson-section {
  padding: 16px 20px 16px 52px;
}

.course-lesson-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mod-color);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.course-objectives ul {
  list-style: none;
  padding: 0;
}

.course-objectives li {
  font-size: 0.85rem;
  color: #b8c0c8;
  padding: 5px 0 5px 20px;
  position: relative;
}

.course-objectives li::before {
  content: '';
  position: absolute;
  right: 0;
  color: var(--accent);
  font-weight: 700;
}

.course-content-box p {
  font-size: 0.9rem;
  color: #c4ccd4;
  line-height: 1.85;
  text-align: justify;
}

.course-lesson-formula {
  margin: 0 20px 0 52px;
  padding: 14px 18px;
  background: rgba(0,102,204,0.12);
  border: 1px solid rgba(0,102,204,0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.course-lesson-formula code {
  color: var(--primary-light);
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
  font-weight: 700;
  direction: ltr;
  display: inline-block;
}

.course-example p {
  font-size: 0.86rem;
  color: #d8e0e8;
  line-height: 1.7;
  background: rgba(255,215,0,0.06);
  border-right: 3px solid var(--dk-yellow);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* =====================================================================
   GLOSSARY — المعجم التقني
   ===================================================================== */
.glossary-section .search-box {
  margin-bottom: 16px;
}

.glossary-count {
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 28px;
}

.glossary-count strong {
  color: var(--accent);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.glossary-card {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  transition: var(--transition);
}

.glossary-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,212,255,0.1);
}

.glossary-card-lang {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
  direction: ltr;
}

.glossary-card-lang.fr {
  background: rgba(0,102,204,0.15);
  color: var(--primary-light);
  margin-left: 6px;
}

.glossary-card-lang.en {
  background: rgba(0,212,255,0.12);
  color: var(--accent);
}

.glossary-card-ar {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 6px 0;
}

.glossary-card-def {
  font-size: 0.83rem;
  color: #a8b0b8;
  line-height: 1.6;
}

/* =====================================================================
   RESPONSIVE — course & glossary
   ===================================================================== */
@media (max-width: 768px) {
  .course-module-header {
    padding: 18px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .course-module-icon {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  .course-module-meta h3 {
    font-size: 1.1rem;
  }

  .course-module-info {
    order: 3;
    width: 100%;
    text-align: right;
    padding-right: 60px;
  }

  .course-module-body-inner {
    padding: 8px 12px 16px;
  }

  .course-chapter-header {
    padding: 14px 12px;
    gap: 10px;
  }

  .course-lesson-header {
    padding: 12px 12px 12px 10px;
    gap: 8px;
  }

  .course-lesson-section {
    padding: 14px 12px 14px 38px;
  }

  .course-lesson-formula {
    margin: 0 12px 0 38px;
  }

  .course-overview {
    padding: 20px 16px;
    gap: 18px;
  }

  .course-overview-stats {
    gap: 20px;
  }

  .glossary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .course-module-desc {
    display: none;
  }

  .course-lesson-duration {
    display: none;
  }
}

/* ===== END COURSE & GLOSSARY CSS ===== */

/* ============================================================
   FEATURES SHOWCASE — لماذا هذا الموقع
   ============================================================ */
.features-showcase {
  padding: 80px 0 60px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.feature-card {
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 28px 22px;
  text-align: center;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), border-color .35s, box-shadow .35s;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(0, 200, 255, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity .4s;
}
.feature-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0,200,255,0.45);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 24px rgba(0,200,255,0.15);
}
.feature-card:hover::before { opacity: 1; }
.feature-icon {
  font-size: 2.6rem;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.feature-card h3 {
  font-size: 1.15rem;
  color: #fff;
  margin: 0 0 4px;
  font-weight: 700;
}
.feature-fr {
  font-size: .8rem;
  color: #7dd3fc;
  margin: 0 0 10px;
  font-style: italic;
}
.feature-card p {
  font-size: .9rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
  margin: 0;
}
@media (max-width: 1100px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .features-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   YOUTUBE VIDEOS SECTION — Vidéos Éducatives
   ============================================================ */
.videos-section { padding: 70px 0; }
.videos-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 auto 36px;
  max-width: 1000px;
}
.video-filter-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  padding: 8px 18px;
  border-radius: 50px;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .3s;
}
.video-filter-btn:hover {
  border-color: rgba(0,212,255,0.5);
  color: #fff;
  box-shadow: 0 0 14px rgba(0,212,255,0.2);
}
.video-filter-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: var(--accent);
  color: #001a33;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,212,255,0.4), 0 0 20px rgba(0,170,255,0.2);
}
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
}
.video-card {
  background: linear-gradient(165deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .35s, border-color .35s, box-shadow .35s;
  display: flex;
  flex-direction: column;
}
.video-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255,0,0,0.4);
  box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 20px rgba(255,0,0,0.12);
}
.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  cursor: pointer;
  background: #111;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s, opacity .3s;
}
.video-thumb:hover img { transform: scale(1.08); opacity: .7; }
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.5));
  opacity: 0;
  transition: opacity .35s;
}
.video-thumb:hover .video-play-overlay { opacity: 1; }
.play-triangle {
  width: 60px;
  height: 60px;
  background: rgba(255,0,0,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  padding-left: 4px;
  box-shadow: 0 0 30px rgba(255,0,0,0.6);
  animation: pulsePlay 2s ease-in-out infinite;
}
@keyframes pulsePlay {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.video-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,0,0,0.9);
  color: #fff;
  font-size: .7rem;
  padding: 4px 12px;
  border-radius: 50px;
  font-weight: 600;
}
.video-count {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 50px;
}
.video-body {
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.video-title {
  font-size: 1.1rem;
  color: #fff;
  margin: 0 0 2px;
  font-weight: 700;
}
.video-title-fr {
  font-size: .85rem;
  color: #7dd3fc;
  margin: 0 0 10px;
  font-style: italic;
}
.video-desc {
  font-size: .85rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.55;
  margin: 0 0 12px;
}
.video-channel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.channel-name {
  font-size: .82rem;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}
.channel-views {
  font-size: .75rem;
  color: rgba(255,255,255,0.5);
}
.video-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.vid-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: rgba(255,255,255,0.55);
  padding: 5px 8px;
  border-radius: 8px;
  transition: background .25s, color .25s;
  text-decoration: none;
}
.vid-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.vid-dur {
  background: rgba(255,0,0,0.25);
  color: #ff6b6b;
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.vid-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vid-views {
  font-size: .68rem;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  flex-shrink: 0;
}
.video-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  flex-wrap: wrap;
}
.btn-sm {
  padding: 8px 14px;
  font-size: .8rem;
}
.video-watch {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* ---------- YouTube Modal ---------- */
.yt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ytFadeIn .3s ease;
}
@keyframes ytFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.yt-modal {
  width: 100%;
  max-width: 900px;
  position: relative;
  animation: ytZoomIn .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes ytZoomIn {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.yt-modal-close {
  position: absolute;
  top: -42px;
  left: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s, transform .25s;
}
.yt-modal-close:hover {
  background: rgba(255,0,0,0.6);
  transform: rotate(90deg);
}
.yt-modal-frame {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(255,0,0,0.2);
}
.yt-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
@media (max-width: 600px) {
  .videos-grid { grid-template-columns: 1fr; }
  .yt-modal-close { top: -40px; }
}

/* ===== END NEW SECTIONS CSS ===== */
