/* ==========================================================================
   BRAINIUM — LIQUID GLASS (GLASSMORPHISM 2.0) DESIGN SYSTEM
   Theme: Dark Obsidian Canvas (#070B11) with Liquid Lime, Emerald & Deep Indigo
   Spec: Specular Top Highlights, Saturation Boost, Deep Diffusion & Fluid Glows
   ========================================================================== */

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

:root {
  --bg-canvas: #070b11;
  --bg-surface: #0d1421;
  --bg-glass: rgba(13, 20, 33, 0.65);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-specular: rgba(255, 255, 255, 0.25);
  --glow-lime: rgba(132, 204, 22, 0.35);
  --glow-emerald: rgba(16, 185, 129, 0.35);
  --glow-indigo: rgba(67, 56, 202, 0.3);
}

/* Reset & Global Canvas */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-canvas);
  color: #f1f5f9;
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  background-color: var(--bg-canvas);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   AMBIENT LIQUID BACKGROUND
   Organic floating glowing orbs with Lime, Emerald, Dark Forest & Indigo tones
   ========================================================================== */
.ambient-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.mesh-orb-1 {
  position: absolute;
  top: -12%;
  left: 15%;
  width: min(700px, 85vw);
  height: min(700px, 85vw);
  background: radial-gradient(circle, rgba(132, 204, 22, 0.18) 0%, rgba(16, 185, 129, 0.08) 45%, rgba(6, 78, 59, 0) 70%);
  filter: blur(65px);
  animation: floatLiquidOrb1 20s ease-in-out infinite alternate;
}

.mesh-orb-2 {
  position: absolute;
  top: 30%;
  right: -12%;
  width: min(750px, 90vw);
  height: min(750px, 90vw);
  background: radial-gradient(circle, rgba(49, 46, 129, 0.22) 0%, rgba(30, 27, 75, 0.15) 45%, rgba(7, 11, 17, 0) 70%);
  filter: blur(75px);
  animation: floatLiquidOrb2 24s ease-in-out infinite alternate;
}

.mesh-orb-3 {
  position: absolute;
  bottom: 8%;
  left: 5%;
  width: min(650px, 80vw);
  height: min(650px, 80vw);
  background: radial-gradient(circle, rgba(16, 185, 129, 0.16) 0%, rgba(132, 204, 22, 0.08) 45%, rgba(6, 78, 59, 0) 70%);
  filter: blur(65px);
  animation: floatLiquidOrb3 22s ease-in-out infinite alternate;
}

.mesh-orb-4 {
  position: absolute;
  top: 65%;
  right: 20%;
  width: min(550px, 70vw);
  height: min(550px, 70vw);
  background: radial-gradient(circle, rgba(163, 230, 53, 0.12) 0%, rgba(67, 56, 202, 0.08) 50%, rgba(7, 11, 17, 0) 75%);
  filter: blur(70px);
  animation: floatLiquidOrb4 19s ease-in-out infinite alternate;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 45%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 45%, transparent 85%);
}

@keyframes floatLiquidOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, 70px) scale(1.12); }
  100% { transform: translate(-40px, 30px) scale(0.94); }
}

@keyframes floatLiquidOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, -50px) scale(1.15); }
  100% { transform: translate(40px, 50px) scale(0.92); }
}

@keyframes floatLiquidOrb3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -40px) scale(1.1); }
  100% { transform: translate(-30px, 40px) scale(0.9); }
}

@keyframes floatLiquidOrb4 {
  0% { transform: translate(0, 0) scale(0.95); }
  50% { transform: translate(-35px, 45px) scale(1.1); }
  100% { transform: translate(30px, -35px) scale(1.02); }
}

/* ==========================================================================
   GLASSMORPHISM 2.0 — LIQUID PANELS & CARDS
   ========================================================================== */
.glass-panel {
  background: rgba(13, 20, 33, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 1.75rem;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
              inset 0 0 20px 0 rgba(132, 204, 22, 0.04);
}

.glass-panel-subtle {
  background: rgba(11, 17, 28, 0.55);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

.glass-card {
  background: linear-gradient(145deg, rgba(16, 25, 42, 0.72) 0%, rgba(10, 16, 28, 0.82) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 1.75rem;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
              inset 0 0 20px 0 rgba(132, 204, 22, 0.04);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* Specular Top-Light Glass Reflection */
.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.08), transparent 40%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.glass-card:hover::before {
  opacity: 1;
}

.glass-card:hover {
  transform: translateY(-4px);
  border-color: rgba(163, 230, 53, 0.4);
  border-top-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7),
              0 0 30px 0 rgba(132, 204, 22, 0.22),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.35),
              inset 0 0 25px 0 rgba(132, 204, 22, 0.08);
}

/* Card Glow Accent Variants */
.glow-lime-hover:hover {
  border-color: rgba(132, 204, 22, 0.5);
  border-top-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7),
              0 0 35px 0 rgba(132, 204, 22, 0.28),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.4);
}

.glow-emerald-hover:hover {
  border-color: rgba(16, 185, 129, 0.5);
  border-top-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7),
              0 0 35px 0 rgba(16, 185, 129, 0.28),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.4);
}

.glow-amber-hover:hover {
  border-color: rgba(245, 158, 11, 0.5);
  border-top-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7),
              0 0 35px 0 rgba(245, 158, 11, 0.28),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   BUTTONS & PILL TAGS — LIQUID GLASS STYLING
   ========================================================================== */
.btn-primary {
  background: linear-gradient(135deg, #a3e635 0%, #84cc16 45%, #10b981 100%);
  background-size: 200% 200%;
  color: #060b11;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 24px -2px rgba(132, 204, 22, 0.48),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.6),
              inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  background-position: 100% 0;
  box-shadow: 0 8px 32px 2px rgba(16, 185, 129, 0.65),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  color: #03060a;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.12);
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(163, 230, 53, 0.45);
  border-top-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4),
              0 0 18px rgba(132, 204, 22, 0.2),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}

.btn-secondary:active {
  transform: scale(0.98);
}

/* Tag Pill */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  transition: all 0.25s ease;
}

.tag-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-color: rgba(132, 204, 22, 0.35);
  box-shadow: 0 0 12px rgba(132, 204, 22, 0.15),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

/* Typography Gradient Headers */
.text-gradient-lime {
  background: linear-gradient(135deg, #ffffff 30%, #bef264 70%, #84cc16 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-hero {
  background: linear-gradient(135deg, #ffffff 20%, #bef264 50%, #10b981 80%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  animation: shineGradient 8s ease infinite alternate;
}

@keyframes shineGradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* Badges & Glowing Accents */
.badge-glowing {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.025em;
  background: rgba(132, 204, 22, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(132, 204, 22, 0.35);
  border-top: 1px solid rgba(190, 242, 100, 0.55);
  color: #bef264;
  box-shadow: 0 0 20px rgba(132, 204, 22, 0.25),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.badge-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #a3e635;
  box-shadow: 0 0 10px #a3e635;
  animation: pulseDot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Soroban Mini Simulator Visualization */
.soroban-rod {
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, #475569, #334155);
  position: relative;
  margin: 0 auto;
}

.soroban-beam {
  position: absolute;
  top: 33%;
  left: 0;
  right: 0;
  height: 4px;
  background: #a3e635;
  box-shadow: 0 0 10px rgba(163, 230, 53, 0.6);
  z-index: 5;
}

.soroban-bead {
  width: 22px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: top 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.soroban-bead.active {
  background: linear-gradient(135deg, #a3e635, #65a30d);
  box-shadow: 0 0 10px rgba(163, 230, 53, 0.7);
}

/* Modals & Backdrop Blur */
.modal-backdrop {
  background: rgba(4, 7, 13, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-content-box {
  background: linear-gradient(145deg, rgba(17, 26, 42, 0.96), rgba(9, 14, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 1.75rem;
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.9),
              0 0 40px -5px rgba(132, 204, 22, 0.2),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(14, 22, 36, 0.95);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(132, 204, 22, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  color: #f1f5f9;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6),
              0 0 20px rgba(132, 204, 22, 0.25),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

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

/* Language Switcher Button active state */
.lang-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.15),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}

/* Sticky Navbar Liquid State */
#main-navbar {
  overflow-x: clip;
}

#main-navbar.scrolled {
  background: rgba(7, 11, 17, 0.82) !important;
  backdrop-filter: blur(24px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(190%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.5),
              inset 0 -1px 0 0 rgba(255, 255, 255, 0.05) !important;
}


/* Mobile Drawer Styles */
#mobile-drawer {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

#mobile-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#mobile-drawer.closed {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* Safe Area Utility */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 1.25rem);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #070b11;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(132, 204, 22, 0.4);
}

/* Responsive Touch Optimizations for narrow mobile viewports (360px - 430px) */
@media (max-width: 640px) {
  .touch-target-min {
    min-height: 48px;
    min-width: 48px;
  }
  
  .glass-card {
    padding: 1.25rem !important;
    border-radius: 1.5rem !important;
  }
  
  .glass-panel {
    border-radius: 1.5rem !important;
  }
}
