:root {
  /* Common */
  --primary-color: #0490f2;
  --primary-glow: rgba(4, 144, 242, 0.6);
  --secondary-color: #0370bd;
  --font-main: 'Tajawal', sans-serif;

  /* Dark Theme (Default) */
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-white: #f8f9fa;
  --text-gray: #cbd5e1;
  --header-bg: rgba(15, 23, 42, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --grid-color: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] {
  --bg-dark: #f1f5f9; /* Premium cool gray/white */
  --bg-card: rgba(255, 255, 255, 0.9); /* Higher opacity for better contrast */
  --text-white: #0f172a; /* Deep blue-black for main text */
  --text-gray: #475569; /* Slate gray for secondary text */
  --header-bg: rgba(255, 255, 255, 0.95);
  --border-color: rgba(4, 144, 242, 0.2); /* Subtle blue borders */
  --grid-color: rgba(4, 144, 242, 0.08); /* More visible blue grid */
  --primary-glow: rgba(4, 144, 242, 0.2); /* Softer glow */
}

/* Force body background for mobile/general to ensure it applies */
body[data-theme="light"] {
    background-color: var(--bg-dark) !important;
    color: var(--text-white) !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
}

body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  
  /* Modern Grid Pattern */
  background-image: 
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(4, 144, 242, 0.05) 0%, transparent 50%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

/* Intro Overlay */
#intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.8s ease-out, visibility 0.8s;
}

.intro-logo {
  font-size: 4rem;
  font-weight: 900;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 1s ease forwards 0.5s;
}

.intro-slogan {
  font-size: 1.5rem;
  color: var(--text-gray);
  margin-top: 10px;
  opacity: 0;
  animation: fadeUp 1s ease forwards 1.2s;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* App Content */
#app {
  opacity: 0;
  transition: opacity 1s ease-in;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5%; /* Increased padding back */
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
  height: 75px; /* Taller header */
}

.logo {
  font-size: 1.6rem; /* Restored size slightly */
  font-weight: 800;
  letter-spacing: -0.5px;
}

.highlight {
  color: var(--primary-color);
  text-shadow: 0 0 20px var(--primary-glow);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 25px; /* Restored gap */
}

nav a {
  text-decoration: none;
  color: var(--text-gray);
  font-weight: 500;
  position: relative;
  transition: color 0.3s;
  padding-bottom: 5px;
  font-size: 0.85rem; /* KEPT SMALL as requested */
  letter-spacing: 0.5px;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

nav a:hover, nav a.active {
  color: var(--primary-color);
}

nav a:hover::after, nav a.active::after {
  width: 100%;
  left: 0;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 100px 20px 60px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

/* Floating background glow behind hero */
.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  background: var(--primary-color);
  filter: blur(120px);
  opacity: 0.15;
  z-index: -1;
  border-radius: 50%;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero p {
  font-size: 1.3rem;
  color: var(--text-gray);
  margin-bottom: 50px;
}

/* Cards Container */
.cards-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  padding: 20px 5%;
  margin-bottom: 100px;
}

/* Advanced Card Styling */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08); /* slight border */
  border-radius: 24px; /* rounder corners */
  padding: 3px; /* create space for gradient border */
  flex: 1 1 320px;
  max-width: 380px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.card:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.card-content {
  background: #1e293b; /* Inner Background */
  border-radius: 21px; 
  padding: 40px 30px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  position: relative;
}

/* Animated Border Gradient */
.card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    transparent, 
    rgba(4, 144, 242, 0.3), 
    transparent 30%
  );
  animation: rotate 4s linear infinite;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover::before {
  opacity: 1;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

.card-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 10px rgba(4, 144, 242, 0.3));
}

.card h2 {
  font-size: 1.8rem;
  color: var(--text-white);
  margin-bottom: 5px;
}

.card h3 {
  font-size: 1rem;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
  font-weight: 600;
}

.card p {
  color: var(--text-gray);
  margin-bottom: 30px;
  font-size: 1rem;
  line-height: 1.6;
}

.btn-glow {
  background: rgba(4, 144, 242, 0.1);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 12px 35px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 10px rgba(4, 144, 242, 0.1);
  width: 100%;
}

.btn-glow:hover {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 0 30px var(--primary-glow);
  transform: translateY(-2px);
}

/* Battle Card Special Style */
.battle-card .card-content {
  background: linear-gradient(160deg, #1e293b, #162033);
}

.battle-card h3 {
  color: #fca5a5; /* Reddish for battle */
}

.battle-card .btn-glow {
  border-color: #fca5a5;
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.05);
}

.battle-card .btn-glow:hover {
  background: #f87171;
  color: white;
  box-shadow: 0 0 30px rgba(248, 113, 113, 0.6);
}

/* About Section */
.about-section {
  background: rgba(255, 255, 255, 0.02);
  padding: 80px 20px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: auto; /* Push to bottom if content is short */
}

.about-section h2 {
  font-size: 2.2rem;
  margin-bottom: 25px;
}

.about-section p {
  max-width: 750px;
  margin: 0 auto 50px;
  color: var(--text-gray);
  font-size: 1.1rem;
}

.trust-badges {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap;
}

.badge {
  background: rgba(4, 144, 242, 0.05);
  color: var(--primary-color);
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid rgba(4, 144, 242, 0.2);
  transition: all 0.3s;
}

.badge:hover {
  background: rgba(4, 144, 242, 0.15);
  transform: scale(1.05);
}

/* Footer */
footer {
  text-align: center;
  padding: 50px 20px;
  background: #0b1120;
  color: var(--text-gray);
  font-size: 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive & Mobile Menu */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .intro-logo {
    font-size: 2.5rem;
  }
  
  .cards-container {
    gap: 30px;
  }

  /* Hamburger Toggle */
  .mobile-toggle {
    display: flex; /* Visible on mobile */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
    margin-right: 15px; /* Spacing from theme toggle if adjacent */
  }

  /* ... existing hamburger styles ... */
  /* (Keep the rest of hamburger styles same, I am just adding theme toggle below) */
}

/* Theme Toggle Button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-white);
  transition: all 0.3s ease;
  margin-left: 20px;
}

.theme-toggle:hover {
  background: var(--bg-card);
  transform: rotate(15deg);
}

/* Desktop: Hide hamburger only */
@media (min-width: 769px) {
  .mobile-toggle {
    display: none;
  }
}

  .mobile-toggle .bar {
    width: 100%;
    height: 3px;
    background: var(--text-white);
    border-radius: 3px;
    transition: all 0.3s ease;
  }

  /* Hamburger Animation */
  .mobile-toggle.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }
  .mobile-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }
  .mobile-toggle.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* Mobile Nav Drawer */
  .main-header nav {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden by default */
    width: 70%;
    height: 100vh;
    background: rgba(11, 17, 32, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: right 0.4s cubic-bezier(0.77, 0.2, 0.05, 1.0);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 100;
  }

  .main-header nav.mobile-active {
    right: 0;
  }

  .main-header nav ul {
    flex-direction: column;
    gap: 40px;
    text-align: center;
  }

  .main-header nav a {
    font-size: 1rem;
  }


/* Desktop: Hide toggle */
@media (min-width: 769px) {
  .mobile-toggle {
    display: none;
  }
}

/* Liquid Wave Background Effect */
.floating-shape {
  position: fixed;
  filter: blur(80px); /* Soft blur for wave effect */
  z-index: -2; 
  opacity: 0.15;
  will-change: transform, border-radius;
  animation: waveMorph 15s infinite linear;
}

.shape-1 {
  top: -20%;
  right: -10%;
  width: 700px;
  height: 700px;
  background: var(--primary-color);
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  animation-duration: 20s;
}

.shape-2 {
  bottom: -10%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: var(--secondary-color);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation-duration: 15s;
  animation-direction: reverse;
}

.shape-3 {
  top: 30%;
  left: 30%;
  width: 500px;
  height: 500px;
  background: rgba(147, 51, 234, 0.25);
  border-radius: 50% 50% 20% 80% / 25% 80% 20% 75%;
  animation-duration: 18s;
  animation-delay: -5s;
}

@keyframes waveMorph {
  0% { transform: rotate(0deg); border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  100% { transform: rotate(360deg); border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

/* Mouse Glow Effect (Refined to blend with waves) */

/* CSS removed: Stars Effect */

/* Light Mode Specific Overrides */
[data-theme="light"] footer {
  background: #ffffff; /* White footer for morning mode */
  color: var(--text-gray);
  border-top: 1px solid rgba(0,0,0,0.05);
}

[data-theme="light"] .card {
  /* Enhanced Blue Gradient for Cards */
  background: linear-gradient(135deg, #0490f2 0%, #0370bd 100%);
  box-shadow: 0 15px 35px rgba(4, 144, 242, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transform: translateZ(0);
}

[data-theme="light"] .card-content {
  background: transparent; 
}

[data-theme="light"] .card h2,
[data-theme="light"] .card p,
[data-theme="light"] .card .card-icon {
  color: #fff;
}

[data-theme="light"] .card h3 {
  color: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .btn-glow {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .btn-glow:hover {
  background: #fff;
  color: var(--primary-color);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .card:hover {
  box-shadow: 0 25px 50px rgba(4, 144, 242, 0.4);
  transform: translateY(-8px) scale(1.02);
}

/* Fix visibility of header links in light mode if needed */
[data-theme="light"] .main-header nav a {
  color: #334155; /* Darker gray for better visibility */
}
[data-theme="light"] .main-header nav a:hover,
[data-theme="light"] .main-header nav a.active {
  color: var(--primary-color);
}

/* Performance: Reduce blur in Light Mode to fix lag */
[data-theme="light"] .floating-shape {
  filter: blur(40px); /* Lower blur radius */
  opacity: 0.08;
}

/* Ensure desktop nav is always visible */
@media (min-width: 769px) {
  .main-header nav {
    position: static !important; /* Override mobile fixed positioning */
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    box-shadow: none !important;
    display: block !important;
    transform: none !important;
  }
  
  .main-header nav ul {
    flex-direction: row !important;
    gap: 30px !important;
  }
}

/* Smoother Body Transition */
body {
  transition: background-color 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
              color 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              background-image 0.6s ease;
  min-height: 100vh;
  position: relative;
}

/* Mouse Glow Effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(4, 144, 242, 0.15), transparent 40%);
  pointer-events: none;
  z-index: -1;
  opacity: 0.7;
}

[data-theme="light"] body::before {
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(4, 144, 242, 0.1), transparent 40%);
}
