/* =========================================================
   SOTARCLOUD v2 - UI/UX PRO MAX DESIGN SYSTEM
   Two Themes: Light (White & Cloud Blue) | Dark (Space Cosmic)
   3D Tilt Cards, Mouse Tracking Parallax, Modern Typography
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --font-main: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* LIGHT THEME (White & Vibrant Cloud Blue Mix - DEFAULT) */
  --bg-primary: #F4F8FC;
  --bg-secondary: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.9);
  
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  
  --border-subtle: #E2E8F0;
  --border-focus: #0284C7;
  
  --accent-primary: #0284C7;
  --accent-secondary: #2563EB;
  --accent-gradient: linear-gradient(135deg, #0284C7 0%, #2563EB 100%);
  --accent-glow: rgba(2, 132, 199, 0.22);
  --card-shadow: 0 4px 20px -2px rgba(2, 132, 199, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.04);
  --card-shadow-hover: 0 16px 36px -6px rgba(2, 132, 199, 0.18), 0 4px 12px -2px rgba(15, 23, 42, 0.06);

  --nav-bg: rgba(255, 255, 255, 0.92);
  --nav-border: #E2E8F0;
}

/* DARK THEME (Pure Black & Deep Charcoal Gray, Sky/Blue Accents, NO PURPLE) */
html.dark {
  --bg-primary: #080C14;
  --bg-secondary: #0E1524;
  --bg-card: rgba(14, 21, 37, 0.75);
  --bg-card-hover: rgba(20, 31, 54, 0.9);
  --bg-glass: rgba(14, 21, 37, 0.85);
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-focus: rgba(56, 189, 248, 0.5);
  
  --accent-primary: #38BDF8;
  --accent-secondary: #0EA5E9;
  --accent-gradient: linear-gradient(135deg, #38BDF8 0%, #0284C7 50%, #1D4ED8 100%);
  --accent-glow: rgba(56, 189, 248, 0.25);
  --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.65), 0 0 15px rgba(56, 189, 248, 0.05);
  --card-shadow-hover: 0 20px 45px -10px rgba(0, 0, 0, 0.85), 0 0 28px rgba(56, 189, 248, 0.15);

  --nav-bg: rgba(8, 12, 20, 0.88);
  --nav-border: rgba(255, 255, 255, 0.09);
}

/* Base resets & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* FIXED BLURRED BACKGROUND SYSTEM: Image 2 for Light Mode, Image 3 for Dark Mode */
body::before {
  content: '';
  position: fixed;
  top: -24px;
  left: -24px;
  right: -24px;
  bottom: -24px;
  z-index: -2;
  background-image: url('/images/bg-light.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  filter: blur(9px);
  transform: scale(1.05);
  pointer-events: none;
  transition: background-image 0.4s ease;
}

/* Elegant glass tint overlay for superior text contrast & readability */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(244, 248, 252, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  transition: background-color 0.4s ease;
}

html.dark body::before {
  background-image: url('/images/bg-dark.png');
  filter: blur(9px);
  transform: scale(1.05);
}

html.dark body::after {
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Typography Accent Helpers */
.font-display {
  font-family: var(--font-display), var(--font-main), sans-serif;
}

.font-poppins {
  font-family: var(--font-main), sans-serif;
}

.font-mono {
  font-family: var(--font-mono), monospace;
}

/* Dark starfield integrated directly into bg-dark.png */

/* Soft Ambient Glow - Blue/White in light, Cyan/Charcoal in dark */
.space-aurora {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 500px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.14) 0%, rgba(37, 99, 235, 0.06) 45%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
}

html.dark .space-aurora {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, rgba(30, 41, 59, 0.25) 55%, transparent 75%);
}

/* Glassmorphism Header */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nav-border);
}

/* SOLID, FLAT, MODERN CARDS (NO 3D TILT, NO JITTER/WOBBLE) */
.card-3d-wrap {
  perspective: none;
}

.card-3d {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  transform: none !important;
}

.card-3d:hover {
  border-color: var(--border-focus);
  box-shadow: var(--card-shadow-hover);
  transform: none !important;
}

/* Interactive Mouse Glow Inside Cards */
.card-3d::after {
  content: '';
  position: absolute;
  top: var(--mouse-y, -100px);
  left: var(--mouse-x, -100px);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  border-radius: 50%;
}

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

/* Gradient text utility */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Buttons with modern micro-interactions */
.btn-primary {
  background: var(--accent-gradient);
  color: #FFFFFF !important;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.65rem 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: all 0.25s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary:hover {
  transform: none;
  box-shadow: 0 8px 25px var(--accent-glow);
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary) !important;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.65rem 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

/* Floating Badges */
.badge-glow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(14, 165, 233, 0.25);
}

/* Realtime live pulsing status dot */
.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10B981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Pricing Slider / Stepper Elements */
.addon-counter-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.6rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.addon-counter-btn:hover {
  background: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
}

/* Input & Form Styling */
.input-custom {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  transition: all 0.2s ease;
  outline: none;
}

.input-custom:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Slim scrollbar for sidebar */
#app-sidebar::-webkit-scrollbar,
.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
}
#app-sidebar::-webkit-scrollbar-track,
.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}
#app-sidebar::-webkit-scrollbar-thumb,
.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
#app-sidebar::-webkit-scrollbar-thumb:hover,
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}


/* ==============================================================
   RESPONSIVE UI/UX OPTIMIZATIONS (PC, TABLET, MOBILE AUTO-ADAPT)
   ============================================================== */

/* Fast touch response (eliminate 300ms tap delay & gray tap highlight on mobile) */
a, button, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Smooth iOS momentum scrolling */
.overflow-x-auto, .overflow-y-auto, aside, main {
  -webkit-overflow-scrolling: touch;
}

/* Safe area insets for modern mobile displays with notch & home pill */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  #app-sidebar {
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
}

/* Fluid responsive titles */
.heading-responsive {
  font-size: clamp(1.35rem, 3.2vw + 0.6rem, 2.5rem);
  line-height: 1.2;
}

/* Desktop Sidebar Collapse Mode */
@media (min-width: 1024px) {
  #app-sidebar.desktop-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right-width: 0 !important;
    overflow: hidden !important;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%) !important;
    margin-right: 0 !important;
  }
  
  #app-sidebar {
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s ease, opacity 0.25s ease !important;
  }
}

/* Mobile & Tablet Drawer Animation (< 1024px) */
@media (max-width: 1023px) {
  #app-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 295px !important;
    max-width: 86vw !important;
    z-index: 60 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    will-change: transform;
  }
  
  #sidebar-backdrop {
    z-index: 55 !important;
    transition: opacity 0.25s ease;
  }
}

/* Card & button adjustments on small mobile screens (< 640px) */
@media (max-width: 639px) {
  .card-3d {
    border-radius: 1.15rem !important;
  }
  
  .input-custom, .btn-primary, .btn-secondary {
    min-height: 44px;
  }
  
  .addon-counter-btn {
    width: 42px;
    height: 42px;
  }
}

/* Tablet Optimizations (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  #app-sidebar {
    width: 320px !important;
  }
}
