/* ========== THEME SYSTEM ========== */

/* Theme: Terra Stone (Default) */
body[data-theme="terra"] {
  --color-primary: #c17855;
  --color-primary-rgb: 193, 120, 85;
  --color-primary-light: rgba(193, 120, 85, 0.1);
  --color-bg-main: #dad5cd;
  --color-bg-alt: #f5f3f0;
  --color-text-main: #7a4a35;
  --color-text-main-rgb: 122, 74, 53;
  --color-text-secondary: #9d6b52;
  --color-overlay: rgba(74, 74, 74, 0.7);
  --color-overlay-light: rgba(74, 74, 74, 0.4);
  --color-video-overlay: rgba(74, 74, 74, 0.8);
}

/* Theme: Ocean Tech */
body[data-theme="ocean"] {
  --color-primary: #0ea5e9;
  --color-primary-rgb: 14, 165, 233;
  --color-primary-light: rgba(14, 165, 233, 0.1);
  --color-bg-main: #dbeafe;
  --color-bg-alt: #f0f9ff;
  --color-text-main: #0c4a6e;
  --color-text-main-rgb: 12, 74, 110;
  --color-text-secondary: #0369a1;
  --color-overlay: rgba(12, 74, 110, 0.7);
  --color-overlay-light: rgba(12, 74, 110, 0.4);
  --color-video-overlay: rgba(12, 74, 110, 0.8);
}

/* Theme: Sunset Energy */
body[data-theme="sunset"] {
  --color-primary: #f97316;
  --color-primary-rgb: 249, 115, 22;
  --color-primary-light: rgba(249, 115, 22, 0.1);
  --color-bg-main: #fed7aa;
  --color-bg-alt: #fff7ed;
  --color-text-main: #7c2d12;
  --color-text-main-rgb: 124, 45, 18;
  --color-text-secondary: #c2410c;
  --color-overlay: rgba(124, 45, 18, 0.7);
  --color-overlay-light: rgba(124, 45, 18, 0.4);
  --color-video-overlay: rgba(124, 45, 18, 0.8);
}

/* Theme: Forest Natural */
body[data-theme="forest"] {
  --color-primary: #10b981;
  --color-primary-rgb: 16, 185, 129;
  --color-primary-light: rgba(16, 185, 129, 0.1);
  --color-bg-main: #d1fae5;
  --color-bg-alt: #f0fdf4;
  --color-text-main: #064e3b;
  --color-text-main-rgb: 6, 78, 59;
  --color-text-secondary: #059669;
  --color-overlay: rgba(6, 78, 59, 0.7);
  --color-overlay-light: rgba(6, 78, 59, 0.4);
  --color-video-overlay: rgba(6, 78, 59, 0.8);
}

/* Theme: Midnight Professional */
body[data-theme="midnight"] {
  --color-primary: #8b5cf6;
  --color-primary-rgb: 139, 92, 246;
  --color-primary-light: rgba(139, 92, 246, 0.1);
  --color-bg-main: #e9d5ff;
  --color-bg-alt: #faf5ff;
  --color-text-main: #4c1d95;
  --color-text-main-rgb: 76, 29, 149;
  --color-text-secondary: #6b21a8;
  --color-overlay: rgba(76, 29, 149, 0.7);
  --color-overlay-light: rgba(76, 29, 149, 0.4);
  --color-video-overlay: rgba(76, 29, 149, 0.8);
}

/* Theme: Rose Elegance */
body[data-theme="rose"] {
  --color-primary: #e11d48;
  --color-primary-rgb: 225, 29, 72;
  --color-primary-light: rgba(225, 29, 72, 0.1);
  --color-bg-main: #fce7f3;
  --color-bg-alt: #fef2f2;
  --color-text-main: #881337;
  --color-text-main-rgb: 136, 19, 55;
  --color-text-secondary: #be123c;
  --color-overlay: rgba(136, 19, 55, 0.7);
  --color-overlay-light: rgba(136, 19, 55, 0.4);
  --color-video-overlay: rgba(136, 19, 55, 0.8);
}

/* Theme: Slate Modern */
body[data-theme="slate"] {
  --color-primary: #64748b;
  --color-primary-rgb: 100, 116, 139;
  --color-primary-light: rgba(100, 116, 139, 0.1);
  --color-bg-main: #e2e8f0;
  --color-bg-alt: #f8fafc;
  --color-text-main: #1e293b;
  --color-text-main-rgb: 30, 41, 59;
  --color-text-secondary: #475569;
  --color-overlay: rgba(30, 41, 59, 0.7);
  --color-overlay-light: rgba(30, 41, 59, 0.4);
  --color-video-overlay: rgba(30, 41, 59, 0.8);
}

/* Theme: Amber Energy */
body[data-theme="amber"] {
  --color-primary: #f59e0b;
  --color-primary-rgb: 245, 158, 11;
  --color-primary-light: rgba(245, 158, 11, 0.1);
  --color-bg-main: #fef3c7;
  --color-bg-alt: #fffbeb;
  --color-text-main: #78350f;
  --color-text-main-rgb: 120, 53, 15;
  --color-text-secondary: #b45309;
  --color-overlay: rgba(120, 53, 15, 0.7);
  --color-overlay-light: rgba(120, 53, 15, 0.4);
  --color-video-overlay: rgba(120, 53, 15, 0.8);
}

/* Apply theme colors using variables */
body {
  background-color: var(--color-bg-main);
  color: var(--color-text-main);
}

/* ========== BASE STYLES ========== */

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Work Sans', sans-serif;
  font-size: 17px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold !important;
}

@media (min-width: 768px) {
  body {
    font-size: 18px;
  }
}

/* Navigation background with primary color */
.nav-bg {
  background-color: rgba(var(--color-primary-rgb), 0.3);
}

/* Scroll offset for navigation */
section {
  scroll-margin-top: 80px;
}

/* ========== ANIMATIONS ========== */

/* Scroll animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Initial hidden state for scroll animations */
.scroll-reveal {
  opacity: 0;
}

.scroll-reveal.active {
  animation: fadeInUp 0.8s ease-out forwards;
}

/* Staggered card animations */
.card-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.card-animate.active {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for multiple cards */
.card-animate:nth-child(1) { transition-delay: 0.1s; }
.card-animate:nth-child(2) { transition-delay: 0.2s; }
.card-animate:nth-child(3) { transition-delay: 0.3s; }
.card-animate:nth-child(4) { transition-delay: 0.4s; }
.card-animate:nth-child(5) { transition-delay: 0.5s; }
.card-animate:nth-child(6) { transition-delay: 0.6s; }

/* Subtle hover effects for desktop only */
@media (hover: hover) {
  .card-animate {
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
  }

  .card-animate:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  }

  .card-animate.active:hover {
    transform: translateY(-4px);
  }
}

/* Hero fade in */
.fade-in-up {
  animation: fadeInUp 1s ease-out forwards;
}

/* Heading reveal animation */
.heading-reveal {
  opacity: 0;
}

.heading-reveal.active {
  animation: fadeInScale 0.7s ease-out forwards;
}

/* Button pulse effect */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(193, 120, 85, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(193, 120, 85, 0.6);
  }
}

.btn-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ========== MOBILE MENU ========== */

/* Mobile menu animations */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

#mobile-menu.open {
  max-height: 300px;
}

/* Hamburger to X animation */
#mobile-menu-button svg {
  transition: transform 0.3s ease;
}

#mobile-menu-button.open svg {
  transform: rotate(90deg);
}

/* ========== THEME SWITCHER ========== */

.theme-switcher {
  position: fixed;
  left: -2px;
  top: 50%;
  z-index: 100;
  display: flex;
  align-items: center;
  transform: translateY(-50%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* When closed, slide the entire thing left so toggle is at screen edge */
.theme-switcher:not(.open) {
  transform: translateY(-50%) translateX(calc(-100% + 44px));
}

.theme-dots {
  background: white;
  border-radius: 0 16px 16px 0;
  padding: 20px 14px;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: white;
  border: none;
  border-radius: 0 12px 12px 0;
  padding: 16px 10px;
  cursor: pointer;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -1px; /* Overlap to hide seam */
}

.theme-toggle:hover {
  background: var(--color-bg-alt);
}

.toggle-icon {
  width: 24px;
  height: 24px;
}

.toggle-icon path {
  fill: var(--color-primary);
  transition: fill 0.3s ease;
}

.theme-toggle:hover .toggle-icon path {
  fill: var(--color-text-main);
}

.theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 0;
}

.theme-dot:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
}

.theme-dot.active {
  transform: scale(1.25);
  border-color: white;
}

/* Dot colors - matching theme primaries */
.theme-dot[data-theme="terra"] { background: #c17855; }
.theme-dot[data-theme="ocean"] { background: #0ea5e9; }
.theme-dot[data-theme="sunset"] { background: #f97316; }
.theme-dot[data-theme="forest"] { background: #10b981; }
.theme-dot[data-theme="midnight"] { background: #8b5cf6; }
.theme-dot[data-theme="rose"] { background: #e11d48; }
.theme-dot[data-theme="slate"] { background: #64748b; }
.theme-dot[data-theme="amber"] { background: #f59e0b; }

/* Font divider */
.font-divider {
  width: 100%;
  height: 1px;
  background: var(--color-text-main);
  opacity: 0.2;
  margin: 8px 0;
}

/* Font buttons */
.font-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: white;
  color: var(--color-text-main);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.font-btn:hover {
  transform: scale(1.1);
  background: var(--color-bg-alt);
  border-color: var(--color-primary);
}

.font-btn.active {
  background: var(--color-primary);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ========== HOW IT WORKS CARDS ========== */

.how-it-works-card {
  position: relative;
  overflow: hidden;
}

.how-it-works-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  transition: transform 0.6s ease;
}

.how-it-works-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(var(--color-primary-rgb), 0.92);
  z-index: 1;
  transition: background-color 0.3s ease;
}

.how-it-works-card[data-bg="customize.webp"]::before {
  background-image: url('../images/customize.webp');
}

.how-it-works-card[data-bg="geofence.webp"]::before {
  background-image: url('../images/geofence.webp');
}

.how-it-works-card[data-bg="launch.webp"]::before {
  background-image: url('../images/launch.webp');
}

.how-it-works-card > * {
  position: relative;
  z-index: 2;
}

@media (hover: hover) {
  .how-it-works-card:hover::before {
    transform: scale(1.05);
  }
}

/* ========== WHITE-LABEL SECTION ========== */

.white-label-bg-mobile::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(var(--color-text-main-rgb), 0.85);
  transition: background-color 0.3s ease;
}

.white-label-bg-desktop::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(var(--color-text-main-rgb), 0.75), rgba(var(--color-text-main-rgb), 0.3));
  transition: background 0.3s ease;
}

/* ========== MISC ========== */

/* Logo color theming */
.logo-themed path {
  fill: var(--color-text-main);
  transition: fill 0.3s ease;
}

.logo-light path {
  fill: var(--color-bg-alt);
  transition: fill 0.3s ease;
}

/* hCaptcha styling */
.h-captcha {
  margin: 0 auto;
}

/* ========== RESPONSIVE ========== */

/* Mobile adjustments */
@media (max-width: 768px) {
  .theme-dots {
    padding: 16px 12px;
    gap: 14px;
  }

  .theme-dot {
    width: 18px;
    height: 18px;
  }

  .theme-toggle {
    padding: 14px 8px;
  }

  .toggle-icon {
    width: 20px;
    height: 20px;
  }

  /* Adjust closed state for mobile - leave only 36px for toggle button */
  .theme-switcher:not(.open) {
    transform: translateY(-50%) translateX(calc(-100% + 36px));
  }

  .font-btn {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
}

/* ========== LANGUAGE SWITCHER ========== */

.lang-btn {
  position: relative;
  transition: all 0.3s ease;
}

.lang-btn.active {
  color: var(--color-primary);
  font-weight: 600;
}

.lang-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--color-primary);
}
