/* style/main.css (FINAL GABUNGAN - Mempertahankan Gaya Halaman Utama + Perbaikan Variabel & Spinner) */

/* ----------------------------------
 * 1. FONT & RESET DASAR
 * ---------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f9fbff;
  transition: background 0.3s, color 0.3s;
}


/* ----------------------------------
 * 2. GLOBAL VARIABLES & BRANDING (KOREKSI)
 * ---------------------------------- */
:root {
  /* Variabel Branding Dasar */
  --citta-blue: #0052cc;
  --fun-orange: #ff6200;
  
  /* Variabel Umum Halaman Utama Anda */
  --bg-light: #f9fbff;
  --bg-dark: #1e1e2f;
  --text-light: #333;
  --text-dark: #ddd;
  --how-bg-dark: #1e1e2f;
  
  /* NEW: Variabel Dinamis untuk Ujian/Misi (Ciri Khas CittaFun) */
  --color-primary: var(--citta-blue); /* Light Mode: Biru Citta */
  --color-accent: var(--fun-orange);  /* Highlight/Success */

  --color-success: #28a745;   /* Hijau Sukses */
  --color-error: #dc3545;     /* Merah Error */

  /* Variabel UI Ujian/Misi */
  --bg-primary: #ffffff;      /* Latar Utama Ujian/Card */
  --bg-secondary: #f1f5ff;    /* Latar Sekunder Ujian (Sedikit Biru Pudar) */
  --card-bg: #ffffff;         /* Latar Card */

  --text-color: #212529;      /* Teks Gelap Default */
  --text-muted: #6c757d;      /* Teks Redup Ujian */
  --border-color: #ced4da;    /* Border Garis */
  
  --shadow-small: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow-large: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);

  --color-success-light: #d4edda;
  --color-success-dark: #155724;
  --color-error-light: #f8d7da;
  --color-error-dark: #721c24;
}

/* Dark Mode (Gabungan dan Penyesuaian Variabel Ujian) */
body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);

  /* UPDATE: Variabel Dinamis untuk Ujian/Misi di Dark Mode */
  --color-primary: var(--fun-orange); /* Dark Mode: Oranye Fun */
  --color-accent: var(--citta-blue);  /* Highlight/Success */

  --bg-primary: #1e1e2f;    /* Latar Utama Ujian/Card */
  --bg-secondary: #2a2a3c;  /* Latar Sekunder Ujian */
  --card-bg: #2a2a3c;       /* Latar Card */
  --text-color: #f1f1f1;
  --text-muted: #aaaaaa;
  --border-color: #444444;
}

body.dark .navbar {
  background: rgba(30, 30, 47, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
/* ... (SEMUA GAYA DARK MODE LAINNYA DI PERTAHANKAN) ... */
body.dark .nav-links {
  background: rgba(30, 30, 47, 0.95);
}

body.dark .features,
body.dark .referral {
  background: #2a2a3c;
}

body.dark .feature-card,
body.dark .step {
  background: #35354f;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

body.dark .footer {
  background: #151522;
}


/* ----------------------------------
 * 3. GLOBAL LAYOUT & UTILITIES
 * ---------------------------------- */

/* Container */
.container {
  width: 90%;
  max-width: 1200px; /* Lebar max disesuaikan dengan landing page */
  margin: auto;
}

/* Utility */
h1 {
  font-weight: 800;
  margin-bottom: 15px;
  font-size: 1.8rem;
}
/* ... (SEMUA GAYA UTILITY HINGGA .btn-primary:hover DI PERTAHANKAN) ... */
h2 {
  font-weight: 800;
  margin-bottom: 15px;
  font-size: 1.6rem;
}

h3 {
  font-weight: 800;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

p {
  font-size: 0.9rem !important;
  margin-bottom: 10px;
}

a {
  text-decoration: none;
  color: inherit;
}

/* KOREKSI: Menggunakan variabel --color-primary yang dinamis */
.btn-primary { 
  display: inline-block;
  padding: 12px 24px;
  /* MENGUBAH GRADIENT agar sesuai dengan warna dinamis utama di mode Light/Dark */
  background: linear-gradient(45deg, var(--color-primary), #00d2ff); 
  color: white;
  font-weight: 700;
  border-radius: 30px;
  font-size: 0.9rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.05);
  /* Gunakan rgba dari --citta-blue untuk Light Mode */
  box-shadow: 0 8px 20px rgba(0, 82, 204, 0.3); 
}


/* ----------------------------------
 * 4. GAYA MISSION / UTILITY MISSION
 * ---------------------------------- */

/* Global Button Styles untuk Misi (diperlukan untuk test.js/html) */
.btn {
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.2s;
}

.btn-success {
    background: var(--color-success);
    color: white;
    border: none;
}

.btn:disabled, .btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Header Misi */
.mission-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.mission-title {
    margin: 0;
    flex-grow: 1;
    text-align: center;
    font-size: 1.5rem;
    color: var(--text-color);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}


/* ----------------------------------
 * 5. GAYA LANDING PAGE ASLI ANDA
 * ---------------------------------- */

/* Navbar Styling */
.navbar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 800;
}

.logo-img {
  height: 40px;
  margin-right: 10px;
  animation: bounce 1.8s infinite;
}

.logo:hover .logo-img,
.logo:hover #citta,
.logo:hover #fun {
  animation: bounce 0.5s ease-in-out;
}

.blue, #citta, #citta-hero, #citta-about, #citta-referral, #citta-footer, #citta-about-lower {
  color: var(--citta-blue);
  display: inline-block;
  animation: wave 2s infinite ease-in-out;
  font-size: inherit;
}

.orange, #fun, #fun-hero, #fun-about, #fun-referral, #fun-footer, #fun-about-lower {
  color: var(--fun-orange);
  display: inline-block;
  animation: wave 2s infinite ease-in-out 0.2s;
  font-size: inherit;
}

.beta-badge {
  display: inline-block;
  background-color: #ff4444;
  color: white;
  font-size: 0.7em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: bold;
}

/* Menyesuaikan ukuran font CittaFun (tetap seperti sebelumnya) */
@media (min-width: 769px) {
  .logo .blue, .logo .orange {
    font-size: 1.5rem;
  }
  .hero .blue, .hero .orange {
    font-size: 0.9rem;
  }
  .about .blue, .about .orange,
  .referral .blue, .referral .orange {
    font-size: 0.9rem;
  }
  .footer .blue, .footer .orange {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .logo .blue, .logo .orange {
    font-size: 1.3rem;
  }
  .hero .blue, .hero .orange {
    font-size: 0.85rem;
  }
  .about .blue, .about .orange,
  .referral .blue, .referral .orange {
    font-size: 0.85rem;
  }
  .footer .blue, .footer .orange {
    font-size: 0.85rem;
  }
}

/* Animasi Bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  60% { transform: translateY(-6px); }
}

/* Animasi Wave */
@keyframes wave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Nav links desktop */
.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
  transition: all 0.3s ease;
  z-index: 1100;
}

.nav-links a {
  padding: 6px 12px;
  font-weight: 600;
  border-radius: 20px;
  transition: background 0.3s, color 0.3s;
  color: var(--text-light);
  font-size: 1rem; /* Tetap untuk header */
}

.nav-links a:hover {
  background: var(--citta-blue);
  color: white;
}

body.dark .nav-links a {
  color: var(--text-dark);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.3s;
}

.theme-toggle:hover {
  transform: scale(1.2);
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
  z-index: 1200;
}

.hamburger span {
  width: 28px;
  height: 3px;
  background: var(--text-light);
  border-radius: 2px;
  transition: all 0.3s ease;
}

body.dark .hamburger span {
  background: var(--text-dark);
}

/* Animasi jadi X */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Responsive Menu */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -260px;
    height: 100vh;
    width: 240px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 20px;
    gap: 20px;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    transition: right 0.4s ease;
    overflow-y: auto;
  }

  .nav-links.active {
    right: 0;
  }

  .hamburger {
    display: flex;
  }

  .nav-links a {
    font-size: 0.9rem; /* Sesuai footer di mobile */
  }
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 900;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--citta-blue), #00d2ff);
  color: white;
  text-align: center;
  padding: 120px 20px 100px;
  animation: fadeIn 1.5s ease-in-out;
}

.hero h1 {
  font-size: 1.8rem; /* Diseragamkan dengan .cta h2 */
  margin-bottom: 20px;
}

.hero p {
  max-width: 700px;
  margin: auto;
  margin-bottom: 30px;
  font-size: 0.9rem !important; /* Paksa seragam dengan footer */
}

/* About Section */
.about {
  padding: 80px 20px;
  text-align: center;
  animation: slideUp 1.5s ease;
}

.about p {
  font-size: 0.9rem !important; /* Paksa seragam dengan footer */
}

/* Features Section */
.features {
  background: #fff;
  padding: 80px 20px;
  text-align: center;
}

.features h2 {
  font-size: 1.6rem; /* Diperkecil */
}

.features-grid {
  display: grid;
  gap: 30px;
  margin-top: 40px;
}

@media (min-width: 769px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    justify-content: center;
  }
}

.feature-card {
  background: #f1f5ff;
  padding: 25px;
  border-radius: 16px;
  min-width: 260px;
  max-width: 300px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s, box-shadow 0.3s;
  margin: 0 auto;
}

.feature-card h3 {
  font-size: 1.1rem; /* Diperkecil */
  margin-bottom: 12px;
}

.feature-card p {
  font-size: 0.9rem !important; /* Paksa seragam dengan footer */
  line-height: 1.5;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* How It Works */
.how {
  background: linear-gradient(120deg, #f9fbff, #eaf2ff);
  padding: 80px 20px;
  text-align: center;
}

body.dark .how {
  background: var(--how-bg-dark);
}

.steps {
  display: grid;
  gap: 30px;
  margin-top: 40px;
}

@media (min-width: 769px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .steps {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    justify-content: center;
  }
}

.step {
  background: white;
  padding: 25px;
  border-radius: 16px;
  min-width: 260px;
  max-width: 300px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s, box-shadow 0.3s;
  margin: 0 auto;
}

.step h3 {
  font-size: 1.1rem; /* Diperkecil */
  margin-bottom: 12px;
}

.step p {
  font-size: 0.9rem !important; /* Paksa seragam dengan footer */
  line-height: 1.5;
}

.step:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Referral */
.referral {
  padding: 80px 20px;
  text-align: center;
  background: #fff;
}

.referral p {
  font-size: 0.9rem !important; /* Paksa seragam dengan footer */
}

/* CTA */
.cta {
  background: linear-gradient(135deg, var(--citta-blue), #00d2ff);
  color: white;
  text-align: center;
  padding: 80px 20px;
  border-radius: 30px 30px 0 0;
  animation: pulse 3s infinite;
}

.cta h2 {
  font-size: 1.8rem; /* Tetap untuk keseragaman dengan .hero h1 */
  margin-bottom: 20px;
}

/* Footer */
.footer {
  background: var(--bg-dark);
  color: #bbb;
  text-align: center;
  padding: 30px 20px;
  font-size: 0.9rem;
}

.footer p:nth-child(2) {
  font-size: 0.8rem;
}

.footer a {
  color: var(--citta-blue);
  transition: color 0.3s;
}

.footer a:hover {
  color: #00d2ff;
}

/* Responsivitas untuk mobile */
@media (max-width: 768px) {
  h1 {
    font-size: 1.6rem; /* Diseragamkan dengan .cta h2 di mobile */
  }
  h2 {
    font-size: 1.4rem; /* Diperkecil */
  }
  h3 {
    font-size: 1rem; /* Diperkecil */
  }
  p {
    font-size: 0.85rem !important; /* Sesuai footer di mobile */
  }
  .btn-primary {
    font-size: 0.85rem;
  }
  .hero p,
  .about p,
  .referral p,
  .feature-card p,
  .step p {
    font-size: 0.85rem !important;
  }
  .cta h2 {
    font-size: 1.6rem; /* Tetap untuk keseragaman dengan .hero h1 */
  }
}

/* Responsivitas untuk tablet (opsional, untuk transisi halus) */
@media (min-width: 769px) and (max-width: 1024px) {
  h1 {
    font-size: 1.7rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.05rem;
  }
  p {
    font-size: 0.85rem !important;
  }
  .btn-primary {
    font-size: 0.85rem;
  }
}

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

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 82, 204, 0.6); }
  50% { box-shadow: 0 0 30px 10px rgba(0, 82, 204, 0.2); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  60% { transform: translateY(-6px); }
}

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

/* ----------------------------------
 * 6. GLOBAL LOADING SPINNER (BARU)
 * ---------------------------------- */

#global-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary); /* Menggunakan warna latar misi/card */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999; 
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-out, visibility 0s 0.5s;
}

#global-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner-cube-grid {
    width: 50px;
    height: 50px;
    margin: 10px auto;
    transform: rotate(45deg);
}

.spinner-cube-grid .cube {
    width: 33%;
    height: 33%;
    background-color: var(--color-primary); /* Menggunakan warna primary dinamis */
    float: left;
    animation: cubeGridScaleDelay 1.3s infinite ease-in-out;
}

.spinner-cube-grid .cube1 { animation-delay: 0.2s; }
.spinner-cube-grid .cube2 { animation-delay: 0.3s; }
.spinner-cube-grid .cube3 { animation-delay: 0.4s; }
.spinner-cube-grid .cube4 { animation-delay: 0.1s; }
.spinner-cube-grid .cube5 { animation-delay: 0.2s; }
.spinner-cube-grid .cube6 { animation-delay: 0.3s; }
.spinner-cube-grid .cube7 { animation-delay: 0s; }
.spinner-cube-grid .cube8 { animation-delay: 0.1s; }
.spinner-cube-grid .cube9 { animation-delay: 0.2s; }

@keyframes cubeGridScaleDelay {
    0%, 70%, 100% {
        transform: scale3D(1, 1, 1);
    } 
    35% {
        transform: scale3D(0, 0, 1);
    }
}

#global-loading-overlay p {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 15px;
    animation: fadeIn 2s infinite alternate;
}

body.dark #global-loading-overlay p {
    color: var(--color-primary);
}
