/* ancientfit-frontend/css/ancientFitCoach.css */
/* NOTE: All navbar styling is handled exclusively by navBar.css.
   This file contains only page-body styles for ancientFitCoach.html. */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* === PAGE-LEVEL VARIABLES === */
:root {
  --glass-bg:         rgba(0, 0, 0, 0.55);
  --glass-border:     rgba(255, 255, 255, 0.09);
  --glass-shadow:     rgba(0, 0, 0, 0.5);
  --blur-intensity:   blur(10px);
  --transition-blur:  all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --accent-green:      #00b894;
  --accent-teal:       #00d6a8;
  --accent-glow:       rgba(0, 184, 148, 0.3);
  --text-white:        rgba(255, 255, 255, 0.95);
  --text-secondary:    rgba(255, 255, 255, 0.7);

  --gradient-primary:  linear-gradient(135deg,
                         rgba(0, 102, 204, 0.15),
                         rgba(0, 201, 183, 0.10));

  --glass-green:        linear-gradient(135deg,
                          rgba(0, 184, 148, 0.18),
                          rgba(0, 214, 168, 0.25));
  --glass-green-border: rgba(0, 184, 148, 0.35);
  --glass-green-shadow: rgba(0, 184, 148, 0.15);
}

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

/* === ROOT OVERFLOW CONTAINMENT — FIX #1 === */
html {
  overflow-x: hidden;
  max-width: 100%;
}

/* === BODY === */
body {
  font-family: 'Inter', sans-serif;
  background: url(../Images/Scheduler/CardThreeCover.jpg) no-repeat center center fixed;
  color: var(--text-white);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden; /* FIX #1 */
  max-width: 100%;
  width: 100%;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(6, 10, 18, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: -1;
}

/* === GLASS CONTAINER — FIX #2 === */
/* contain:layout style paint stops the 200×200% ::before pseudo-element
   from escaping the stacking context created by backdrop-filter         */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 40px;
  margin: 40px auto;
  box-shadow: 0 8px 32px var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  max-width: min(1400px, 100%); /* FIX: never wider than viewport */
  width: calc(100% - 32px);    /* FIX: safe side margins on mobile */
  transition: var(--transition-blur);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  contain: layout style paint; /* FIX #2 */
  box-sizing: border-box;
}

.glass::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: var(--gradient-primary);
  opacity: 0.08;
  z-index: -1;
  animation: rotate 20s linear infinite;
  backdrop-filter: var(--blur-intensity) saturate(160%);
  -webkit-backdrop-filter: var(--blur-intensity) saturate(160%);
  /* max-width intentionally unset — clipped by parent overflow:hidden */
  max-width: unset;
}

@keyframes rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.glass:hover {
  background: rgba(0,0,0,0.65);
  border-color: rgba(255,255,255,0.11);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
}

/* === HEADER === */
.header {
  text-align: center;
  padding: 60px 0 40px;
  position: relative;
  max-width: 100%;
  overflow: hidden; /* FIX */
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  border-radius: 2px;
}

.header h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2rem, 5vw, 4rem); /* FIX: was fixed 4rem, now fluid */
  font-weight: 800;
  margin-bottom: 24px;
  background: linear-gradient(to right, #ffffff, rgba(255,255,255,0.9));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
  text-shadow:
    0 0 30px rgba(255,255,255,0.3),
    0 0 60px rgba(0,184,148,0.2);
  position: relative;
  display: inline-block;
  word-break: break-word; /* FIX */
  max-width: 100%;
}

.header h1::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 120%; height: 120%;
  background: radial-gradient(circle, rgba(0,184,148,0.1) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  z-index: -1;
  max-width: unset; /* decorative — clipped by parent */
}

.header p {
  font-size: clamp(1rem, 2.5vw, 1.3rem); /* FIX: fluid */
  color: var(--text-secondary);
  max-width: min(700px, 100%);
  margin: 0 auto;
  line-height: 1.8;
}

/* === AFFILIATE SECTION === */
.affiliate-section {
  text-align: center;
  padding: 60px 40px;
  border-radius: 32px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  margin: 60px auto;
  position: relative;
  overflow: hidden;
  max-width: min(1200px, calc(100% - 32px)); /* FIX: was 95% + fixed max */
  width: calc(100% - 32px);
  box-shadow: 0 20px 80px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  isolation: isolate;
  box-sizing: border-box;
}

.affiliate-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(0,102,204,0.15) 0%,
    rgba(0,184,148,0.15) 100%);
  z-index: -1;
}

.affiliate-section h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem); /* FIX: fluid */
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 24px;
  position: relative;
  display: inline-block;
  text-shadow: 0 0 20px rgba(255,255,255,0.2);
  word-break: break-word;
  max-width: 100%;
}

.affiliate-section p {
  max-width: min(800px, 100%);
  margin: 0 auto 40px;
  font-size: clamp(1rem, 2vw, 1.2rem); /* FIX: fluid */
  color: rgba(255,255,255,0.85);
  line-height: 1.8;
}

/* === APPLY BUTTON === */
.apply-btn {
  margin-top: 24px;
  padding: 20px 48px;
  border-radius: 20px;
  border: 1px solid var(--glass-green-border);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 1.2rem); /* FIX: fluid */
  cursor: pointer;
  background: var(--glass-green);
  backdrop-filter: blur(15px) saturate(200%);
  -webkit-backdrop-filter: blur(15px) saturate(200%);
  color: white;
  box-shadow:
    0 8px 32px rgba(0,184,148,0.25),
    0 4px 16px rgba(0,184,148,0.15),
    inset 0 1px 0 rgba(255,255,255,0.3);
  transition: var(--transition-blur);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  letter-spacing: 0.5px;
  max-width: 100%;
  box-sizing: border-box;
}

.apply-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.2) 0%,
    rgba(255,255,255,0.05) 50%,
    rgba(255,255,255,0.2) 100%);
  z-index: 1;
  pointer-events: none;
  max-width: unset;
}

.apply-btn::after {
  content: '';
  position: absolute;
  top: -10px; left: -10px; right: -10px; bottom: -10px;
  background: conic-gradient(from 0deg at 50% 50%,
    rgba(0,184,148,0.4),
    rgba(0,214,168,0.6),
    rgba(0,184,148,0.4));
  z-index: -1;
  border-radius: 30px;
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: blur(15px);
  max-width: unset;
}

.apply-btn:hover::after { opacity: 0.8; }

.apply-btn:hover {
  transform: translateY(-4px) scale(1.02);
  background: linear-gradient(135deg,
    rgba(0,194,158,0.35),
    rgba(0,224,178,0.45));
  box-shadow:
    0 20px 60px rgba(0,184,148,0.4),
    0 8px 32px rgba(0,184,148,0.3),
    inset 0 1px 0 rgba(255,255,255,0.4);
  border-color: rgba(0,214,168,0.6);
}

.apply-btn:active { transform: translateY(-2px) scale(1.01); transition: all 0.1s ease; }

.apply-btn span { position: relative; z-index: 2; }

/* === HIGHLIGHT === */
.highlight {
  color: #ffffff;
  font-weight: 700;
  text-shadow:
    0 0 20px rgba(0,184,148,0.5),
    0 0 40px rgba(0,184,148,0.3);
  position: relative;
  display: inline-block;
}

/* === FILTERS === */
.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 48px;
  padding: 32px;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* FIX */
}

.filters::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0.02) 25%,
    transparent 50%,
    rgba(0,0,0,0.1) 75%,
    rgba(0,0,0,0.15) 100%);
  border-radius: 25px;
  z-index: -1;
  pointer-events: none;
  max-width: unset;
}

.filters::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.03) 1px, transparent 1px),
    radial-gradient(circle at 75% 75%, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: 24px;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  max-width: unset;
}

.filter-group { display: flex; flex-wrap: wrap; gap: 16px; }

.filter-group button,
.month-nav button {
  padding: 16px 32px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.3);
  color: rgba(255,255,255,0.8);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 16px;
  transition: var(--transition-blur);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  min-width: 0;       /* FIX: prevent flex blowout */
  box-sizing: border-box;
}

.filter-group button:hover,
.month-nav button:hover {
  background: rgba(0,0,0,0.45);
  color: white;
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

.filter.active {
  background: rgba(0,0,0,0.6) !important;
  color: white !important;
  border-color: rgba(255,255,255,0.35) !important;
  box-shadow:
    0 0 20px rgba(255,255,255,0.15),
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 4px 12px rgba(0,0,0,0.4) !important;
}

.filter.active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.3) 20%,
    rgba(255,255,255,0.5) 50%,
    rgba(255,255,255,0.3) 80%,
    transparent 100%);
  border-radius: 16px 16px 0 0;
  max-width: unset;
}

/* === COURSE CARDS — FIX #3 (grid min column) === */
.course-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); /* FIX: was minmax(360px,1fr) — on phones 360px > viewport */
  gap: 40px;
  margin-top: 48px;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden; /* FIX */
  padding-right: 16px;
  scrollbar-width: thin;
  scrollbar-color: #ff3b3b rgba(255,255,255,0.05);
  scrollbar-gutter: auto; /* FIX: was "stable" — reserved 16px even with no scrollbar */
  max-width: 100%;
  box-sizing: border-box;
}

.course-cards::-webkit-scrollbar { width: 16px; }
.course-cards::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
}
.course-cards::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff3b3b, #b11212);
  border-radius: 20px;
  border: 3px solid rgba(0,10,20,0.6);
  box-shadow: inset 0 0 6px rgba(255,255,255,0.35), 0 0 12px rgba(255,59,59,0.55);
}
.course-cards::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff6b6b, #e53935);
}

.course-card {
  padding: 40px;
  border-radius: 28px;
  background: rgba(0,10,20,0.45);
  backdrop-filter: blur(35px) saturate(160%);
  -webkit-backdrop-filter: blur(35px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.12);
  position: relative;
  overflow: hidden;
  transition: var(--transition-blur);
  cursor: pointer;
  box-shadow:
    0 15px 45px rgba(0,0,0,0.35),
    0 8px 25px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.2);
  z-index: 1;
  box-sizing: border-box;
  max-width: 100%;
}

.course-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg,
    rgba(0,184,148,0.08) 0%,
    rgba(0,102,204,0.05) 50%,
    rgba(0,184,148,0.08) 100%);
  opacity: 0.6;
  z-index: -1;
  border-radius: 28px;
  max-width: unset;
}

.course-card::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg,
    transparent 30%,
    rgba(255,255,255,0.03) 50%,
    transparent 70%);
  transform: rotate(45deg);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  max-width: unset;
}

.course-card:hover::after { opacity: 0.5; }

.course-card .accent-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    transparent 10%,
    rgba(0,184,148,0.7) 50%,
    transparent 90%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
  z-index: 2;
  max-width: unset;
}

.course-card:hover .accent-top { transform: scaleX(1); }

.course-card:hover {
  transform: translateY(-12px) scale(1.03);
  background: rgba(0,15,30,0.55);
  border-color: rgba(255,255,255,0.18);
  box-shadow:
    0 35px 90px rgba(0,0,0,0.5),
    0 20px 50px rgba(0,0,0,0.35),
    0 0 0 1px rgba(255,255,255,0.1),
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.25);
}

.course-card h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem); /* FIX: fluid */
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  margin-bottom: 20px;
  line-height: 1.4;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
  word-break: break-word; /* FIX */
}

.course-card p {
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  word-break: break-word; /* FIX */
}

.course-card .price {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(1.4rem, 3vw, 2rem); /* FIX: fluid */
  color: rgba(255,255,255,0.95);
  margin-top: 25px;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.course-card .price::before {
  content: '';
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  max-width: unset;
}

.course-card:hover h3  { color: white; text-shadow: 0 0 20px rgba(255,255,255,0.15), 0 2px 8px rgba(0,0,0,0.3); }
.course-card:hover p   { color: rgba(255,255,255,0.85); }
.course-card:hover .price { color: white; text-shadow: 0 0 15px rgba(255,255,255,0.2); }

.course-card .inner-glow {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  box-shadow: inset 0 0 40px rgba(0,184,148,0.05);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 0;
}
.course-card:hover .inner-glow { opacity: 1; }

.course-card .language {
  color: #3498db;
  font-weight: 600;
  margin: 5px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.course-card .language::before { content: "🌐"; font-size: 12px; }

/* === COURSE LOGOS === */
.course-logo {
  width: 66%;
  height: auto;
  aspect-ratio: 120/80;
  margin: 0 auto 45px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: block;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.3));
  max-width: 220px;
  min-width: 110px;
}

.course-logo.level-1 { background-image: url('../Images/AncientFitWebLogos/AncientFitLevel1Logo.png'); }
.course-logo.level-2 { background-image: url('../Images/AncientFitWebLogos/AncientFitLevel2Logo.png'); }
.course-logo.level-3 { background-image: url('../Images/AncientFitWebLogos/AncientFitL3ApexLogo.png'); }

.course-logo.level-3 { filter: drop-shadow(0 6px 12px rgba(0,184,148,0.4)); }
.course-card:hover .course-logo.level-3 {
  filter: drop-shadow(0 8px 16px rgba(0,184,148,0.6)) brightness(1.2);
}

@media (max-width: 768px) { .course-logo { width: 35%; margin-bottom: 20px; } }
@media (max-width: 480px) { .course-logo { width: 40%; margin-bottom: 15px; } }

/* === SHARE BUTTON === */
.course-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}
.course-header h3 { margin: 0; flex: 1; min-width: 0; } /* FIX: min-width:0 prevents flex blowout */

.share-btn {
  background: transparent;
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-left: 10px;
  flex-shrink: 0;
}

.share-btn:hover {
  background: var(--accent-green);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,184,148,0.3);
}

.share-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.share-btn:disabled:hover { background: transparent; color: var(--accent-green); transform: none; box-shadow: none; }

/* === SHARE MODAL PLATFORM BUTTONS === */
.share-platform-btn { transition: all 0.3s ease !important; }
.share-platform-btn:hover { transform: translateY(-3px) scale(1.05) !important; box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important; }
.share-platform-btn.whatsapp:hover { background: #128C7E !important; }
.share-platform-btn.telegram:hover { background: #0077B5 !important; }
.share-platform-btn.facebook:hover { background: #166FE5 !important; }
.share-platform-btn.twitter:hover  { background: #333 !important; }
.share-platform-btn.threads:hover  { background: #333 !important; }
.share-platform-btn.bluesky:hover  { background: #0073e6 !important; }
.share-platform-btn.reddit:hover   { background: #e04a00 !important; }
.share-platform-btn.pixelfed:hover { opacity: 0.9 !important; }
.share-platform-btn.email:hover    { background: #D14836 !important; }
#closeShareModal:hover { background: #f8f9fa !important; }

/* === STATUS BADGE === */
.status {
  display: inline-block;
  padding: 10px 20px;
  background: rgba(255,255,255,0.1);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 24px;
  margin-top: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
}

/* === MAP SECTION === */
.map-section {
  margin-top: 80px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(30px);
  border-radius: 32px;
  padding: 48px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  overflow: hidden; /* FIX: clip Leaflet bleed */
  max-width: 100%;
  box-sizing: border-box;
}

#map {
  height: 520px;
  border-radius: 24px;
  margin-bottom: 40px;
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  max-width: 100%; /* FIX */
  box-sizing: border-box;
}

.location-list div {
  padding: 24px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  border-left: 4px solid rgba(0,102,204,0.4);
  transition: var(--transition-blur);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
  max-width: 100%;
}

.location-list div:hover {
  background: rgba(255,255,255,0.1);
  transform: translateX(10px) translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--text-secondary);
  font-size: 1.2rem;
  background: rgba(255,255,255,0.05);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
}

.empty-state::before {
  content: '📚';
  font-size: 4rem;
  display: block;
  margin-bottom: 24px;
  opacity: 0.7;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

.hidden { display: none !important; }

/* === MODAL === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  width: 90%;
  max-width: min(600px, calc(100vw - 32px)); /* FIX: never wider than viewport */
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden; /* FIX */
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(40px);
  border-radius: 32px;
  padding: 48px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 40px 120px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  animation: modalSlideIn 0.5s cubic-bezier(0.4,0,0.2,1);
  box-sizing: border-box;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 10px; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  margin-bottom: 24px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: var(--text-white);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition-blur);
  backdrop-filter: blur(10px);
  box-sizing: border-box; /* FIX */
  max-width: 100%;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 20px rgba(255,255,255,0.1), inset 0 1px 0 rgba(255,255,255,0.1);
}

.modal input::placeholder,
.modal textarea::placeholder { color: rgba(255,255,255,0.5); }

.close {
  float: right;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  color: var(--text-secondary);
  transition: var(--transition-blur);
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
}

.close:hover { background: rgba(255,255,255,0.1); color: white; transform: rotate(90deg); }

/* === AGREEMENT SECTION === */
.agreement-section {
  margin: 40px 0;
  padding: 40px;
  background: rgba(255,255,255,0.05);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* FIX */
}

.agreement-section h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem); /* FIX: fluid */
  color: var(--text-white);
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  word-break: break-word;
}

.agreement-content {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden; /* FIX */
  padding: 32px;
  background: rgba(255,255,255,0.03);
  border-radius: 20px;
  margin: 24px 0;
  border: 1px solid rgba(255,255,255,0.1);
  box-sizing: border-box;
  max-width: 100%;
}

.agreement-content::-webkit-scrollbar { width: 6px; }
.agreement-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.agreement-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

.agreement-content h4 { color: var(--text-white); margin: 24px 0 16px; font-size: 1.2rem; font-weight: 600; word-break: break-word; }
.agreement-content ul { margin: 16px 0 16px 32px; padding: 0; }
.agreement-content li { margin-bottom: 12px; font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,0.85); overflow-wrap: break-word; }
.agreement-content p  { font-size: 1rem; line-height: 1.7; color: rgba(255,255,255,0.85); margin-bottom: 20px; overflow-wrap: break-word; }

/* === AGREEMENT CHECKBOX === */
.agreement-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin: 32px 0;
  padding: 32px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
  max-width: 100%;
}

.agreement-checkbox input[type="checkbox"] {
  width: 24px; height: 24px;
  margin: 4px 0 0;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  appearance: none;
  position: relative;
  flex-shrink: 0; /* FIX: don't let checkbox squish */
}

.agreement-checkbox input[type="checkbox"]:checked {
  background: rgba(0,102,204,0.3);
  border-color: rgba(0,102,204,0.5);
}

.agreement-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 16px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.agreement-checkbox label { flex: 1; font-size: 1.1rem; line-height: 1.6; cursor: pointer; color: var(--text-white); min-width: 0; overflow-wrap: break-word; } /* FIX */

/* === PAYMENT OPTIONS === */
.payment-options {
  display: grid;
  gap: 24px;
  margin: 40px 0 32px;
  animation: fadeIn 0.6s ease;
  max-width: 100%;
  box-sizing: border-box;
}

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

.payment-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.payment-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.4rem, 3vw, 2rem); /* FIX: fluid */
  color: var(--text-white);
  margin: 0 0 16px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.fee-description { font-size: 1.1rem; color: var(--text-secondary); margin: 0; }

/* === PAY BUTTONS === */
.pay-btn {
  position: relative;
  padding: 24px 32px;
  border-radius: 24px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 1.2rem); /* FIX: fluid */
  cursor: pointer;
  color: white;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: var(--transition-blur);
  overflow: hidden;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.2);
  width: 100%;           /* FIX: always full width in grid */
  min-width: 0;          /* FIX: prevent flex/grid blowout */
  box-sizing: border-box;
  word-break: break-word;
}

.pay-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.15) 0%,
    rgba(255,255,255,0) 50%,
    rgba(255,255,255,0.15) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  max-width: unset;
}

.pay-btn:hover::before { opacity: 1; }

.pay-btn:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    0 30px 80px rgba(0,0,0,0.3),
    0 0 0 1px rgba(255,255,255,0.2),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.pay-btn.stripe {
  background: linear-gradient(135deg, rgba(99,91,255,0.25), rgba(75,68,255,0.15));
  border-color: rgba(99,91,255,0.3);
}
.pay-btn.stripe:hover {
  background: linear-gradient(135deg, rgba(99,91,255,0.35), rgba(75,68,255,0.25));
  box-shadow: 0 30px 80px rgba(99,91,255,0.2), 0 0 0 1px rgba(99,91,255,0.3);
}

.pay-btn.paypal {
  background: linear-gradient(135deg, rgba(0,48,135,0.25), rgba(0,156,222,0.15));
  border-color: rgba(0,48,135,0.3);
}
.pay-btn.paypal:hover {
  background: linear-gradient(135deg, rgba(0,48,135,0.35), rgba(0,156,222,0.25));
  box-shadow: 0 30px 80px rgba(0,156,222,0.2), 0 0 0 1px rgba(0,156,222,0.3);
}

.pay-btn.egypt {
  background: linear-gradient(135deg, rgba(10,124,255,0.25), rgba(0,75,189,0.15));
  border-color: rgba(10,124,255,0.3);
}
.pay-btn.egypt:hover {
  background: linear-gradient(135deg, rgba(10,124,255,0.35), rgba(0,75,189,0.25));
  box-shadow: 0 30px 80px rgba(10,124,255,0.2), 0 0 0 1px rgba(10,124,255,0.3);
}

/* === AFFILIATE BUTTON === */
.affiliate-btn {
  width: 100%;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid rgba(0,102,204,0.4);
  cursor: pointer;
  font-weight: 700;
  font-size: clamp(1rem, 1.8vw, 1.1rem); /* FIX: fluid */
  background: rgba(0,102,204,0.25);
  color: white;
  transition: var(--transition-blur);
  font-family: 'Plus Jakarta Sans', sans-serif;
  backdrop-filter: blur(20px);
  box-sizing: border-box;
  word-break: break-word;
}

.affiliate-btn:hover {
  background: rgba(0,102,204,0.35);
  border-color: rgba(0,102,204,0.6);
  transform: translateY(-3px);
  box-shadow:
    0 20px 60px rgba(0,102,204,0.2),
    0 0 0 1px rgba(0,102,204,0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

/* === PAYMENT NOTE === */
.payment-note {
  margin-top: 24px;
  font-size: 0.95rem;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 20px;
  background: rgba(255,255,255,0.05);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  box-sizing: border-box;
  max-width: 100%;
}

/* === MAP MARKERS === */
.af-marker {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #000;
  border: 2px solid #ff2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.9), 0 0 10px rgba(255,42,42,0.7);
}

.af-marker.open {
  border-color: #00ff9c;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.9), 0 0 14px rgba(0,255,156,0.9);
  animation: pulseGreen 1.8s infinite;
}

.af-marker.coming {
  border-color: #ffd000;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.9), 0 0 12px rgba(255,208,0,0.9);
}

.af-marker.full {
  border-color: #ff2a2a;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.9), 0 0 12px rgba(255,42,42,0.9);
}

@keyframes pulseGreen {
  0%  { box-shadow: 0 0 0 0 rgba(0,255,156,0.7), 0 0 10px rgba(0,255,156,0.8); }
  70% { box-shadow: 0 0 0 12px rgba(0,255,156,0), 0 0 18px rgba(0,255,156,0.4); }
  100%{ box-shadow: 0 0 0 0 rgba(0,255,156,0), 0 0 10px rgba(0,255,156,0.8); }
}

.map-apply-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-teal));
  color: white;
  transition: var(--transition-blur);
  box-sizing: border-box;
}

.map-apply-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,184,148,0.3); }

/* === VALIDATION HINT === */
.validation-hint {
  display: block;
  margin-top: -16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-word; /* FIX */
}

.validation-hint a { color: var(--accent-green); text-decoration: none; }
.validation-hint a:hover { text-decoration: underline; }

/* === ID VERIFICATION === */
.id-verification { margin: 24px 0; }
.id-options { display: flex; gap: 24px; margin: 12px 0 16px; flex-wrap: wrap; } /* FIX: flex-wrap */
.id-options label { display: flex; align-items: center; gap: 8px; color: var(--text-white); cursor: pointer; }
.id-input { width: 100%; box-sizing: border-box; } /* FIX */

/* === SIGNATURE SECTION === */
.signature-section { margin: 32px 0; }

.signature-line {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 16px 0;
  color: var(--text-secondary);
  flex-wrap: wrap; /* FIX */
}

.signature-space {
  flex: 1;
  min-width: 80px; /* FIX */
  height: 1px;
  background: rgba(255,255,255,0.2);
  border-bottom: 1px dashed rgba(255,255,255,0.3);
}

.signature-note { font-size: 0.9rem; color: var(--text-secondary); margin-top: 16px; overflow-wrap: break-word; }

/* === AGREEMENT BLOCKS === */
.agreement-block { margin-bottom: 24px; }
.agreement-block h4 { color: var(--text-white); margin-bottom: 12px; word-break: break-word; }
.agreement-block h5 { color: var(--text-secondary); margin: 16px 0 8px; font-size: 0.95rem; }
.clause { margin-bottom: 16px; padding-left: 16px; border-left: 2px solid rgba(255,255,255,0.1); }
.highlight-block { background: rgba(0,102,204,0.08); border-radius: 12px; padding: 20px; border: 1px solid rgba(0,102,204,0.2); }
.warning-text { color: #ffd000; font-size: 0.9rem; margin-top: 8px; overflow-wrap: break-word; }
.agreement-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 16px; }
.required { color: #ff7675; margin-left: 4px; }
.modal-subtitle { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.95rem; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .glass { padding: 24px; margin: 16px; border-radius: 24px; width: calc(100% - 32px); }
  .header h1 { font-size: clamp(1.8rem, 6vw, 2.5rem); }
  .course-cards { grid-template-columns: 1fr; gap: 24px; padding-right: 8px; }
  .filters { flex-direction: column; align-items: stretch; padding: 20px; }
  .filter-group { justify-content: center; }
  .payment-options { grid-template-columns: 1fr; }
  .modal-content { width: 95%; padding: 24px 20px; }
  .map-section { padding: 24px; margin: 0 16px; }
  #map { height: 350px; }
  .affiliate-section { padding: 32px 24px; margin: 24px 16px; }
  .affiliate-section h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
  .agreement-section { padding: 24px 20px; }
  .agreement-checkbox { flex-direction: column; }
  .id-options { flex-direction: column; gap: 12px; }
  .course-card { padding: 28px; }
}

@media (max-width: 480px) {
  .glass { padding: 16px; margin: 10px; width: calc(100% - 20px); }
  .filter-group button,
  .month-nav button { padding: 12px 20px; font-size: 0.9rem; }
  .apply-btn { padding: 16px 32px; }
  .pay-btn { padding: 18px 20px; }
  .course-card { padding: 20px; }
  .map-section { padding: 16px; margin: 0 10px; }
  #map { height: 280px; }
}

/* === ULTRA-NARROW (Galaxy Fold outer screen, < 360px) === */
@media (max-width: 360px) {
  .glass { padding: 12px; margin: 8px; width: calc(100% - 16px); }
  .header h1 { font-size: 1.6rem; }
  .affiliate-section h2 { font-size: 1.4rem; }
  .agreement-section { padding: 16px 12px; }
  .agreement-content { padding: 16px; }
  .agreement-checkbox { padding: 16px; }
  .modal-content { padding: 16px 14px; }
  .course-card { padding: 16px; }
}