/* ==========================================================================
   NEESKA STUDIO — DESIGN SYSTEM & STYLESHEET
   Brand: neeska.net (B2B Mobile Apps & Modern Websites)
   ========================================================================== */

:root {
  --font-sans: 'Candara', 'Candara Light', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Color Palette */
  --bg-dark: #07090e;
  --bg-card: #0f1422;
  --bg-card-hover: #141b2e;
  
  --brand-300: #93c5fd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-900: #1e3a8a;
  --brand-950: #0a1738;

  --accent-purple: #8b5cf6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(59, 130, 246, 0.4);

  /* Safe Area Insets (iPhone Notch, Dynamic Island, Home Bar, Fold Hinge) */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

/* CSS Reset & Defaults */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: #f1f5f9;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body, button, input, select, textarea, h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
}

/* Ambient Glow & Grid Backdrop */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.28;
  pointer-events: none;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  top: -100px;
  right: -50px;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  top: 30%;
  left: -200px;
}

.glow-3 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
  bottom: 10%;
  right: 5%;
}

.grid-overlay {
  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: 50px 50px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.2) 80%);
}

/* Interactive Cursor Spotlight & Quality Effects */
#cursor-spotlight {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 122, 0, 0.13) 0%, rgba(56, 189, 248, 0.08) 35%, rgba(99, 102, 241, 0.03) 60%, transparent 75%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: left, top;
}

/* Glassmorphism & Cards with Dynamic Cursor Glow */
.card-glass {
  position: relative;
  background: rgba(15, 20, 34, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-light);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.card-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(350px circle at var(--mouse-x, -500px) var(--mouse-y, -500px), rgba(255, 122, 0, 0.28), rgba(56, 189, 248, 0.18), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
}

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

.card-glass > * {
  position: relative;
  z-index: 2;
}

.card-glass:hover {
  background: rgba(20, 27, 46, 0.85);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 25px -5px rgba(255, 122, 0, 0.18);
}

/* Typography Gradient */
.gradient-text {
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--accent-indigo) 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-400) 0%, #4f46e5 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

/* Currency Toggle */
.currency-btn,
.currency-dropdown-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.currency-btn.active,
.currency-dropdown-toggle-btn.active {
  background: var(--brand-500);
  color: #ffffff;
  font-weight: 700;
}

.currency-dropdown-toggle-btn.active svg {
  color: #ffffff;
}

.currency-dropdown-item {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

/* Cost Estimator Styling */
.calc-choice-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.calc-choice-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}

.calc-choice-btn.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--brand-400);
  box-shadow: 0 0 15px -3px rgba(59, 130, 246, 0.3);
}

.calc-speed-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.calc-speed-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--brand-400);
}

.feature-checkbox-label {
  user-select: none;
}

.feature-checkbox-label:has(input:checked) {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}

/* Portfolio Tabs */
.portfolio-tab {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.portfolio-tab.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--brand-300);
  border-color: rgba(59, 130, 246, 0.35);
  font-weight: 600;
}

/* FAQ Accordion */
.faq-question {
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.faq-question:hover {
  color: var(--brand-300);
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
}

.faq-item.active .faq-answer {
  display: block;
}

/* Form Inputs */
.form-input {
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--brand-400) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Utilities for Layout */
.bg-dark { background-color: var(--bg-dark); }
.bg-dark-card { background-color: var(--bg-card); }

/* Animation Keyframes */
@keyframes pulseSubtle {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.animate-subtle {
  animation: pulseSubtle 4s ease-in-out infinite;
}

/* Responsive Table */
@media (max-width: 640px) {
  table {
    display: block;
    overflow-x: auto;
  }
}

/* ==========================================================================
   MOBILE PHONES, FOLDABLES & TABLETS OPTIMIZATIONS
   ========================================================================== */

/* Header & Footer Safe Areas */
header {
  padding-top: var(--sat);
}

footer {
  padding-bottom: calc(3rem + var(--sab));
}

/* 1. iOS Safari Auto-Zoom Prevention on Form Inputs */
@media screen and (max-width: 768px) {
  input,
  select,
  textarea,
  .form-input {
    font-size: 16px !important;
  }
}

/* 2. Touch Screen & Mobile Accessibility (Min 44x44px Touch Targets) */
@media (pointer: coarse), (max-width: 768px) {
  .btn-primary,
  .btn-secondary,
  .calc-choice-btn,
  .calc-speed-btn,
  .feature-checkbox-label,
  .faq-question,
  button[type="button"],
  button[type="submit"] {
    min-height: 44px;
  }
  
  /* Tap highlight removal for iOS */
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* 3. Modal Smooth Momentum Scrolling & Overscroll Containment */
#habithogger-modal > div,
#privacy-modal > div,
#terms-modal > div {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 4. Foldables: Narrow Outer Cover Screens (Galaxy Z Fold 1-6 Cover: 280px - 340px) */
@media screen and (max-width: 340px) {
  .card-glass {
    padding: 1.15rem !important;
  }

  h1 {
    font-size: 1.85rem !important;
    line-height: 1.15 !important;
  }

  h2 {
    font-size: 1.5rem !important;
    line-height: 1.2 !important;
  }

  h3 {
    font-size: 1.25rem !important;
  }

  .btn-primary,
  .btn-secondary {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
    font-size: 0.8125rem !important;
  }
}

/* 5. Dual-Screen / Foldables Spanning Mode (Surface Duo, Samsung Fold unfolded dual-pane) */
@media (horizontal-viewport-segments: 2), (screen-spanning: single-fold-vertical) {
  .dual-screen-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: env(fold-width, 24px);
  }
}

/* 6. Tablet & iPad Portrait Refinements (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .hero-headline {
    letter-spacing: -0.02em;
  }
}

/* 7. Scrollbar styling */
.scrollbar-thin {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.scrollbar-thin::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
}
