/* ==========================================================================
   مجتمع آموزشی هوشمند خوارزمی رامسر — Khwarizmi Smart Academy of Ramsar
   Neo-Persian Futuristic 3D Design System (Hyrcanian Emerald, Caspian Turquoise, Persian Gold)
   ========================================================================== */

:root {
  /* Color Palette - Ramsar Nature & Persian Royal Heritage */
  --bg-deep: #040d0a;
  --bg-primary: #071612;
  --bg-secondary: #0b221c;
  --bg-glass: rgba(11, 34, 28, 0.65);
  --bg-glass-heavy: rgba(7, 22, 18, 0.85);
  --bg-card: rgba(14, 41, 34, 0.55);

  /* Accent Colors */
  --emerald-glow: #10b981;
  --emerald-bright: #34d399;
  --turquoise-caspian: #06b6d4;
  --turquoise-light: #38bdf8;
  --persian-gold: #f59e0b;
  --persian-gold-light: #fcd34d;
  --saffron-warm: #fb923c;

  /* Text Colors */
  --text-main: #f0fdf4;
  --text-secondary: #a7f3d0;
  --text-muted: #6ee7b7;
  --text-slate: #94a3b8;

  /* Borders & Glows */
  --border-glass: rgba(52, 211, 153, 0.18);
  --border-gold: rgba(245, 158, 11, 0.35);
  --shadow-3d: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 30px rgba(16, 185, 129, 0.15);
  --shadow-gold: 0 20px 40px -15px rgba(245, 158, 11, 0.25);

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light Mode / Day Mode variables (Ramsar Morning Mist) */
body.light-theme {
  --bg-deep: #f0fdf4;
  --bg-primary: #ecfdf5;
  --bg-secondary: #d1fae5;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-glass-heavy: rgba(255, 255, 255, 0.94);
  --bg-card: rgba(255, 255, 255, 0.88);
  --text-main: #064e3b;
  --text-secondary: #047857;
  --text-muted: #059669;
  --text-slate: #475569;
  --border-glass: rgba(16, 185, 129, 0.25);
  --border-gold: rgba(217, 119, 6, 0.4);
  --shadow-3d: 0 20px 45px -12px rgba(6, 78, 59, 0.14), 0 0 25px rgba(16, 185, 129, 0.1);
}

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

html {
  scroll-behavior: smooth;
  font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  direction: rtl;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  overflow-x: hidden;
  line-height: 1.75;
  position: relative;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--emerald-glow), var(--turquoise-caspian));
  border-radius: 999px;
  border: 2px solid var(--bg-deep);
}

/* ==========================================================================
   Persian Girih & Background Ambience
   ========================================================================== */
.girih-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2334d399' stroke-width='1'%3E%3Cpolygon points='60,5 75,40 115,40 82,62 95,100 60,78 25,100 38,62 5,40 45,40'/%3E%3Ccircle cx='60' cy='60' r='28' stroke='%23f59e0b' stroke-opacity='0.6'/%3E%3Cpath d='M60 0 L60 120 M0 60 L120 60' stroke-opacity='0.3'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 120px;
}

body.light-theme .girih-overlay {
  opacity: 0.08;
}

/* Ambient Glowing Orbs */
.ambient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  transition: opacity 0.5s ease;
}
.orb-emerald {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  top: -120px;
  right: -120px;
}
.orb-turquoise {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: 10%;
  left: -140px;
}
.orb-gold {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
  top: 42%;
  right: 25%;
  opacity: 0.2;
}

/* ==========================================================================
   3D Perspective & Interactive Tilt Cards
   ========================================================================== */
.perspective-stage {
  perspective: 1400px;
  transform-style: preserve-3d;
}

.card-3d {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: var(--shadow-3d);
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out, border-color 0.35s ease, box-shadow 0.35s ease;
  will-change: transform;
}

.card-3d::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(52, 211, 153, 0.16),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 1;
}

.card-3d:hover::before {
  opacity: 1;
}

.card-3d:hover {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(16, 185, 129, 0.25);
}

.card-3d-gold:hover {
  border-color: var(--persian-gold);
  box-shadow: var(--shadow-gold);
}

/* Inner 3D popped layer */
.layer-3d-pop {
  transform: translateZ(36px);
  transition: transform 0.35s var(--ease-out-expo);
}

.card-3d:hover .layer-3d-pop {
  transform: translateZ(52px);
}

.layer-3d-mid {
  transform: translateZ(20px);
}

/* ==========================================================================
   Floating Glass Navigation
   ========================================================================== */
.navbar-glass {
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
  transition: all 0.35s ease;
}

.nav-link {
  position: relative;
  padding: 0.5rem 0.85rem;
  font-weight: 500;
  font-size: 0.94rem;
  color: var(--text-main);
  opacity: 0.85;
  transition: all 0.25s ease;
  border-radius: 12px;
}

.nav-link:hover,
.nav-link.active {
  opacity: 1;
  color: var(--emerald-bright);
  background: rgba(16, 185, 129, 0.1);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 25%;
  left: 25%;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--emerald-glow), var(--persian-gold));
}

/* ==========================================================================
   Hero Section & 3D WebGL Canvas
   ========================================================================== */
#hero-3d-stage {
  position: relative;
  width: 100%;
  height: 540px;
  border-radius: 32px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  background: radial-gradient(circle at 50% 45%, rgba(16, 185, 129, 0.18), rgba(6, 182, 212, 0.08), rgba(4, 13, 10, 0.92));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), inset 0 0 60px rgba(16, 185, 129, 0.12);
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#webgl-canvas:active {
  cursor: grabbing;
}

/* Floating HUD Badges on 3D Stage */
.hud-badge {
  position: absolute;
  background: rgba(7, 22, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 18px;
  padding: 0.75rem 1.1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  transition: transform 0.35s var(--ease-spring), border-color 0.3s ease;
  z-index: 10;
}

body.light-theme .hud-badge {
  background: rgba(255, 255, 255, 0.88);
  color: #064e3b;
}

.hud-badge:hover {
  transform: translateY(-5px) scale(1.04);
  border-color: var(--persian-gold);
}

.hud-float-1 {
  top: 20px;
  right: 20px;
  animation: floatSlow 5s ease-in-out infinite;
}

.hud-float-2 {
  bottom: 92px;
  left: 20px;
  animation: floatSlow 6s ease-in-out infinite 1.2s;
}

.hud-float-3 {
  top: 20px;
  left: 20px;
  animation: floatSlow 5.5s ease-in-out infinite 0.6s;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* 3D Mode Switcher Pills inside Hero */
.mode-pill {
  padding: 0.45rem 0.9rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d1fae5;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-pill:hover,
.mode-pill.active {
  background: linear-gradient(135deg, var(--emerald-glow), var(--turquoise-caspian));
  color: #04130e;
  border-color: transparent;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.45);
}

/* ==========================================================================
   Persian Arch & Geometric Decorative Elements
   ========================================================================== */
.persian-arch-frame {
  position: relative;
  border-radius: 140px 140px 24px 24px;
  overflow: hidden;
  border: 2px solid var(--border-gold);
  box-shadow: var(--shadow-gold);
}

.persian-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16), rgba(245, 158, 11, 0.16));
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--persian-gold-light);
  font-size: 0.85rem;
  font-weight: 600;
}

body.light-theme .persian-badge {
  color: #b45309;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(245, 158, 11, 0.2));
}

.gradient-text-persian {
  background: linear-gradient(135deg, #34d399 0%, #38bdf8 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.light-theme .gradient-text-persian {
  background: linear-gradient(135deg, #047857 0%, #0284c7 50%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================================================
   3D Isometric Campus Explorer Map
   ========================================================================== */
.iso-map-wrapper {
  perspective: 1200px;
  padding: 2rem 1rem;
}

.iso-platform {
  position: relative;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.14), rgba(6, 182, 212, 0.08));
  border: 2px solid rgba(52, 211, 153, 0.3);
  border-radius: 32px;
  padding: 2.2rem;
  transform: rotateX(14deg) rotateY(-8deg);
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-out-expo), box-shadow 0.6s ease;
  box-shadow:
    -20px 30px 60px rgba(0, 0, 0, 0.65),
    0 0 0 6px rgba(16, 185, 129, 0.08),
    inset 0 0 40px rgba(52, 211, 153, 0.12);
}

.iso-platform:hover {
  transform: rotateX(6deg) rotateY(-2deg);
}

.iso-node {
  position: relative;
  border-radius: 20px;
  padding: 1.25rem;
  background: rgba(7, 22, 18, 0.82);
  border: 1px solid rgba(52, 211, 153, 0.28);
  cursor: pointer;
  transform: translateZ(24px);
  transition: all 0.35s var(--ease-spring);
  text-align: right;
}

body.light-theme .iso-node {
  background: rgba(255, 255, 255, 0.92);
}

.iso-node:hover,
.iso-node.active {
  transform: translateZ(48px) translateY(-6px);
  border-color: var(--persian-gold);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(245, 158, 11, 0.15));
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   3D Flipping Course Cards / Schedule Tabs
   ========================================================================== */
.tab-btn {
  padding: 0.85rem 1.5rem;
  border-radius: 16px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--emerald-glow), var(--turquoise-caspian));
  color: #03110c;
  border-color: transparent;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */
.btn-3d-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.95rem 2rem;
  border-radius: 16px;
  font-weight: 700;
  color: #04130e;
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #fbbf24 100%);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.5), inset 0 2px 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease;
  border: none;
  cursor: pointer;
}

.btn-3d-primary:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 18px 35px -5px rgba(16, 185, 129, 0.65), 0 0 20px rgba(245, 158, 11, 0.4);
}

.btn-3d-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.95rem 1.8rem;
  border-radius: 16px;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.35);
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  cursor: pointer;
}

.btn-3d-secondary:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--persian-gold);
  transform: translateY(-3px);
}

/* Pulse Ring Indicator */
.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: pulseEmerald 2s infinite;
}

@keyframes pulseEmerald {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Chart Container Sizing Rule */
.chart-box {
  position: relative;
  height: 250px;
  width: 100%;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .iso-platform {
    transform: none !important;
    padding: 1.25rem;
  }
  #hero-3d-stage {
    height: 440px;
  }
}

@media (max-width: 640px) {
  #hero-3d-stage {
    height: 380px;
  }
  .hud-float-1, .hud-float-2, .hud-float-3 {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  .hud-float-3 {
    display: none;
  }
}
