/* ═══════════════════════════════════════════════════════════
   ZEN ASSETS — Mobile-First Optimization
   Zero-lag, smooth scrolling, mature phone experience
═══════════════════════════════════════════════════════════ */

/* ── Global Mobile Fixes ────────────────────────────────── */
@media (max-width: 1024px) {

  /* Allow scrolling on login screen */
  body {
    overflow: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* Login screen needs to be scrollable */
  .login-screen {
    position: relative !important;
    min-height: 100vh;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Remove all backdrop-filter on mobile — massive GPU saver */
  .login-container,
  .register-card,
  .comparison-block,
  .tier-modal-overlay,
  .search-overlay,
  .modal-backdrop,
  .fm-claim-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Login container: stack vertically */
  .login-container {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: rgba(21, 26, 36, 0.95) !important;
  }

  /* Left brand section — compact on tablet */
  .login-brand-section {
    border-right: none !important;
    border-bottom: 1px solid rgba(212,165,116,0.12) !important;
    padding: 32px 24px !important;
    gap: 24px !important;
    overflow-y: visible !important;
  }

  /* Right form section */
  .login-form-section {
    padding: 32px 24px !important;
    overflow-y: visible !important;
  }

  .login-form-card {
    max-width: 100% !important;
  }

  /* Goals strip */
  .goals-preview-strip {
    flex-direction: column !important;
    padding: 20px 16px !important;
    gap: 12px !important;
  }
  .gps-divider { display: none !important; }
  .gps-item {
    font-size: 12px !important;
  }

  /* Tier modal */
  .tier-modal-content {
    padding: 24px 16px !important;
    max-height: 95vh !important;
    width: 98% !important;
  }
  .tier-modal-title { font-size: 22px !important; }
  .tier-cards-full {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .tier-card { padding: 24px 20px !important; }
}


/* ═══════════════════════════════════════════════════════
   PHONE BREAKPOINT (≤768px) — Core Mobile Experience
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Typography Scale Down ──────────────────────────── */
  html { font-size: 13px !important; }

  /* ── Login Layout ───────────────────────────────────── */
  .login-brand-section {
    padding: 24px 16px !important;
    gap: 20px !important;
  }

  .login-form-section {
    padding: 24px 16px !important;
  }

  /* Logo */
  .login-logo {
    gap: 12px !important;
  }
  .logo-icon {
    width: 44px !important; height: 44px !important;
    font-size: 26px !important;
    border-radius: 8px !important;
  }
  .logo-main {
    font-size: 20px !important;
    letter-spacing: 3px !important;
  }
  .logo-sub { font-size: 10px !important; }

  /* Value Proposition */
  .lvp-title {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  /* Comparison Blocks */
  .comparison-block {
    padding: 14px !important;
    gap: 12px !important;
  }
  .cb-icon {
    width: 36px !important; height: 36px !important;
    font-size: 16px !important;
  }
  .cb-rate { font-size: 16px !important; }
  .cb-reality { font-size: 12px !important; }
  .cb-loss, .cb-gain { font-size: 11px !important; }

  /* Returns Breakdown */
  .returns-breakdown {
    padding: 18px 14px !important;
    margin-top: 16px !important;
  }
  .rbd-header {
    flex-direction: column !important;
    gap: 8px !important;
    text-align: center !important;
  }
  .rbd-header span { font-size: 13px !important; }
  .rbd-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .rbd-item {
    padding: 14px !important;
  }
  .rbd-item.highlight {
    grid-column: auto !important;
  }
  .rbd-range { font-size: 16px !important; }
  .rbd-example { font-size: 12px !important; }
  .rbd-profit { font-size: 14px !important; }
  .rbd-desc { font-size: 11px !important; }

  /* Wealth Projection */
  .wealth-projection {
    padding: 18px 14px !important;
  }
  .wp-title { font-size: 12px !important; }
  .wp-institution { font-size: 11px !important; }
  .wp-amount { font-size: 14px !important; }
  .wp-insight { font-size: 12px !important; padding: 12px !important; }
  .wp-insight span { font-size: 11px !important; }

  /* Investment Calculator */
  .investment-calculator {
    padding: 18px 14px !important;
    margin-top: 16px !important;
  }
  .ic-header {
    flex-direction: column !important;
    gap: 12px !important;
    text-align: center !important;
    align-items: center !important;
  }
  .ic-header i {
    width: 40px !important; height: 40px !important;
    font-size: 18px !important;
  }
  .ic-title { font-size: 15px !important; }
  .ic-subtitle { font-size: 11px !important; text-align: center !important; }

  /* Strategy Tabs → horizontal scroll */
  .ic-strategy-tabs {
    gap: 8px !important;
  }
  .ic-tab {
    padding: 10px 12px !important;
    font-size: 12px !important;
    gap: 6px !important;
  }
  .ic-tab i { font-size: 14px !important; }

  /* Formula Box */
  .ic-formula-box { padding: 16px 12px !important; }
  .icf-formula {
    font-size: 16px !important;
    padding: 14px 10px !important;
    word-break: break-all;
  }
  .icf-legend {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .icfl-item { font-size: 11px !important; }

  /* Data Table — horizontal scroll container */
  .ic-examples {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-left: -14px !important;
    margin-right: -14px !important;
    padding: 0 14px !important;
  }
  .ice-table {
    min-width: 600px !important;
    padding: 12px !important;
  }
  .ice-row {
    font-size: 10px !important;
    gap: 6px !important;
  }
  .ice-value {
    font-size: 10px !important;
    padding: 5px !important;
  }
  .ice-gain { font-size: 8px !important; }

  /* Insights */
  .ic-insights {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .ici-box { padding: 12px !important; }
  .ici-icon {
    width: 32px !important; height: 32px !important;
    font-size: 14px !important;
  }
  .ici-title { font-size: 12px !important; }
  .ici-text { font-size: 11px !important; }

  /* Membership Tiers */
  .membership-tiers-preview {
    padding: 18px 14px !important;
  }
  .mtp-header { font-size: 14px !important; }
  .tier-cards-mini {
    gap: 8px !important;
    padding-bottom: 8px !important;
    /* Horizontal scroll on mobile */
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .tier-cards-mini::-webkit-scrollbar { display: none; }
  .tier-mini {
    min-width: 120px !important;
    flex-shrink: 0 !important;
    padding: 12px 8px !important;
    scroll-snap-align: start;
  }
  .tm-return { font-size: 13px !important; }
  .tm-min { font-size: 10px !important; }

  /* Login Form */
  .live-stats-ticker {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }
  .lst-item { font-size: 12px !important; }

  .login-title {
    font-size: 24px !important;
    margin-bottom: 6px !important;
  }
  .login-subtitle-enhanced {
    font-size: 13px !important;
    margin-bottom: 20px !important;
  }

  .login-form .form-input {
    padding: 12px 14px !important;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }
  .btn-login {
    padding: 14px !important;
    font-size: 15px !important;
    border-radius: 10px !important;
  }

  .lb-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .lb-item { padding: 10px !important; }
  .lb-label { font-size: 12px !important; }
  .lb-desc { font-size: 10px !important; }

  .login-footer {
    margin-top: 20px !important;
  }

  /* Floating Chat Button */
  .floating-contact-btn {
    top: auto !important;
    bottom: 16px !important;
    right: 16px !important;
    padding: 10px 18px !important;
    font-size: 12px !important;
    border-radius: 40px !important;
    box-shadow: 0 4px 16px rgba(212,165,116,0.3) !important;
    z-index: 100001 !important;
  }
  .floating-contact-btn i { font-size: 14px !important; }

  /* ── New Addictive Login Elements (Mobile) ──────────── */
  .fomo-banner { height: 34px !important; }
  .fomo-scroll { font-size: 11px !important; gap: 20px !important; }

  .login-live-counter {
    flex-wrap: wrap !important; gap: 8px !important;
    padding: 12px 14px !important;
  }
  .llc-value { font-size: 14px !important; }
  .llc-label { font-size: 9px !important; }
  .llc-divider { display: none !important; }

  .lvp-hook { font-size: 12px !important; }
  .urgency-counter { padding: 10px 14px !important; gap: 10px !important; }
  .uc-amount { font-size: 18px !important; }
  .uc-title { font-size: 10px !important; }

  .login-testimonials { padding: 16px !important; }
  .lt-carousel { min-height: 120px !important; }
  .lt-quote { font-size: 12px !important; }
  .lt-avatar { width: 32px !important; height: 32px !important; font-size: 12px !important; }

  .trust-badges { gap: 12px !important; padding: 8px 10px !important; flex-wrap: wrap !important; }
  .tb-item { font-size: 9px !important; }

  .login-urgency-box { padding: 12px 14px !important; }
  .lub-title { font-size: 11px !important; }
  .lub-spots { font-size: 11px !important; }

  .login-btn-sub { font-size: 10px !important; }

  .wp-badge { font-size: 10px !important; padding: 3px 8px !important; }
  .tm-popular, .tm-hot { font-size: 8px !important; padding: 2px 8px !important; }

  /* Registration Overlay */
  .register-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 24px 16px !important;
  }
  .register-header h2 { font-size: 18px !important; }
  .tier-options {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }
  .tier-opt {
    padding: 10px 4px 8px !important;
  }
  .tier-opt .tier-icon { font-size: 16px !important; }
  .tier-opt .tier-name { font-size: 9px !important; }
  .tier-opt .tier-apy { font-size: 9px !important; }
}


/* ═══════════════════════════════════════════════════════
   SMALL PHONE (≤480px) — Tight squeeze optimization
═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  html { font-size: 12.5px !important; }

  .login-brand-section {
    padding: 20px 12px !important;
    gap: 16px !important;
  }

  .login-form-section {
    padding: 20px 12px !important;
  }

  .logo-main { font-size: 18px !important; letter-spacing: 2px !important; }
  .logo-icon { width: 38px !important; height: 38px !important; font-size: 22px !important; }

  .lvp-title { font-size: 16px !important; }

  .comparison-block {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 12px !important;
  }
  .cb-icon {
    width: 32px !important; height: 32px !important;
    font-size: 14px !important;
  }
  .cb-rate { font-size: 15px !important; }
  .cb-reality { font-size: 11px !important; }

  .rbd-range { font-size: 14px !important; }
  .rbd-profit { font-size: 13px !important; }
  .rbd-item { padding: 10px !important; }
  .rbd-footnote {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  .rbd-footnote span { font-size: 11px !important; }

  .wp-amount { font-size: 13px !important; }
  .wp-insight {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  .wp-insight span { font-size: 10px !important; }

  .ic-title { font-size: 14px !important; }
  .icf-formula { font-size: 13px !important; padding: 10px 8px !important; }

  .tier-mini { min-width: 100px !important; padding: 10px 6px !important; }
  .tm-tier { font-size: 9px !important; }
  .tm-return { font-size: 12px !important; }

  .login-title { font-size: 20px !important; }

  .floating-contact-btn span { display: none !important; }
  .floating-contact-btn {
    width: 48px !important; height: 48px !important;
    padding: 0 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    border-radius: 50% !important;
  }
  .floating-contact-btn i { font-size: 18px !important; }

  .goals-preview-strip {
    padding: 14px 12px !important;
  }
  .gps-item {
    font-size: 11px !important;
  }
  .gps-item i {
    width: 28px !important; height: 28px !important;
    font-size: 12px !important;
  }
}


/* ═══════════════════════════════════════════════════════
   ULTRA-SMALL / SE (≤360px)
═══════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  .login-brand-section { padding: 16px 10px !important; }
  .login-form-section { padding: 16px 10px !important; }
  .logo-main { font-size: 16px !important; }
  .lvp-title { font-size: 15px !important; }
  .cb-rate { font-size: 14px !important; }
  .login-title { font-size: 18px !important; }
  .tier-options { grid-template-columns: repeat(2, 1fr) !important; }
}


/* ═══════════════════════════════════════════════════════
   PERFORMANCE — GPU & Scroll Optimization
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {

  /* Force GPU layers for smooth scrolling */
  .login-screen {
    will-change: scroll-position;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  /* Optimize scrolling containers */
  .login-brand-section,
  .login-form-section,
  .tier-modal-content,
  .register-card {
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
  }

  /* Remove hover transforms on touch devices (prevents 300ms delay feel) */
  .tier-mini:hover,
  .rbd-item:hover,
  .ici-box:hover,
  .comparison-block:hover,
  .tier-card:hover,
  .fund-method-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  /* Active state for touch feedback instead */
  .tier-mini:active,
  .rbd-item:active,
  .ici-box:active,
  .btn-login:active,
  .btn-register:active,
  .btn-tier:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s ease !important;
  }

  /* Remove ambient background effects */
  .login-ambient {
    display: none !important;
  }

  /* Optimize box-shadows → simpler on mobile */
  .login-container {
    box-shadow: none !important;
  }

  /* Prevent layout shifts */
  img, svg, canvas {
    max-width: 100%;
    height: auto;
  }
}


/* ═══════════════════════════════════════════════════════
   TOUCH SCROLLING BEHAVIOR
═══════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
  /* True touch devices */

  /* Smooth momentum scrolling */
  .login-screen,
  .login-brand-section,
  .login-form-section,
  .tier-modal-content,
  .register-card,
  .ic-examples {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
  }

  /* Larger touch targets (44px minimum per Apple HIG) */
  .btn-login,
  .btn-register,
  .btn-tier,
  .ic-tab,
  .tier-opt,
  .floating-contact-btn,
  .link-text,
  .link-text-bright,
  .checkbox-label {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .form-input {
    min-height: 44px !important;
  }

  /* Disable text select on interactive elements */
  .tier-mini,
  .rbd-item,
  .ic-tab,
  .tier-opt {
    -webkit-user-select: none;
    user-select: none;
  }

  /* Fix iOS input zoom */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }
}


/* ═══════════════════════════════════════════════════════
   LANDSCAPE PHONE
═══════════════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
  .login-brand-section {
    padding: 16px !important;
    gap: 12px !important;
  }
  .login-form-section {
    padding: 16px !important;
  }
  .login-logo { gap: 8px !important; }
  .logo-icon { width: 32px !important; height: 32px !important; font-size: 18px !important; }
  .logo-main { font-size: 16px !important; }
  .lvp-title { font-size: 14px !important; }
  .comparison-block { padding: 8px !important; }
  .rbd-grid { gap: 6px !important; }
  .rbd-item { padding: 8px !important; }
  .login-title { font-size: 18px !important; }
}


/* ═══════════════════════════════════════════════════════
   DARK SCROLLBAR — Universal
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .login-screen::-webkit-scrollbar,
  .login-brand-section::-webkit-scrollbar,
  .login-form-section::-webkit-scrollbar {
    width: 0 !important;
    display: none !important;
  }
  .login-screen,
  .login-brand-section,
  .login-form-section {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
  }
}


/* ═══════════════════════════════════════════════════════
   SAFE AREA (Notch / Dynamic Island)
═══════════════════════════════════════════════════════ */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    .login-screen {
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
    }
    .floating-contact-btn {
      bottom: calc(16px + env(safe-area-inset-bottom)) !important;
      right: calc(16px + env(safe-area-inset-right)) !important;
    }
    .goals-preview-strip {
      padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
  }
}


/* ═══════════════════════════════════════════════════════
   PRINT — Hide unnecessary elements when printing
═══════════════════════════════════════════════════════ */
@media print {
  .floating-contact-btn,
  .login-ambient,
  .goals-preview-strip,
  .boot-scanlines,
  .boot-grid-overlay,
  .mobile-bottom-nav {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION BAR
   Visible only on mobile (≤768px) when sidebar is hidden
═══════════════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: rgba(10, 14, 22, 0.97);
    border-top: 1px solid rgba(0, 212, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 4px 0;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  }

  .mbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px 4px;
    cursor: pointer;
    color: #4a6080;
    font-size: 10px;
    gap: 2px;
    transition: color 0.2s ease, transform 0.15s ease;
    flex: 1;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .mbn-item i {
    font-size: 18px;
    transition: color 0.2s ease;
  }

  .mbn-item span {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    letter-spacing: 0.3px;
  }

  .mbn-item.active {
    color: #00d4ff;
  }

  .mbn-item:active {
    transform: scale(0.92);
  }

  /* Push main content up to not be hidden by bottom nav */
  #main-content {
    padding-bottom: 72px !important;
  }

  /* Move floating chat button above bottom nav */
  .floating-contact-btn {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
}

/* ═══════════════════════════════════════════════════════
   MOBILE MORE MENU (slide-up panel)
═══════════════════════════════════════════════════════ */
.mobile-more-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.mobile-more-menu.open {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.mmm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: mmm-fade-in 0.2s ease;
}

@keyframes mmm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mmm-panel {
  position: relative;
  background: rgba(15, 20, 30, 0.98);
  border-top: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  animation: mmm-slide-up 0.25s ease;
  max-height: 60vh;
  overflow-y: auto;
}

@keyframes mmm-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mmm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
}

.mmm-header span {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: #e0e8f5;
}

.mmm-header .icon-btn {
  background: rgba(255,255,255,0.06);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #8899aa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mmm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mmm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mmm-item i {
  font-size: 20px;
  color: #00d4ff;
}

.mmm-item span {
  font-size: 11px;
  color: #a0b0c0;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-align: center;
}

.mmm-item:active {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  transform: scale(0.95);
}

/* ═══ Portfolio Intelligence Mobile ═══ */
@media (max-width: 1024px) {
  .port-intel-row { grid-template-columns: 1fr 1fr; }
  .port-intel-card:first-child { grid-column: 1 / -1; }
  .health-score-container { flex-direction: row; justify-content: center; gap: 16px; }
}
@media (max-width: 768px) {
  .port-intel-row { grid-template-columns: 1fr; }
  .attr-row { grid-template-columns: 90px 70px 50px 1fr; font-size: 11px; }
}

/* ═══ Mobile Chart & Fund Manager Fixes ═══ */
@media (max-width: 768px) {
  /* Give chart more vertical space on phone */
  .chart-wrap { height: 320px !important; }

  /* Processing overlay card — fit mobile screen */
  .fm-process-card {
    min-width: 280px !important;
    max-width: 90vw !important;
    padding: 2rem 1.5rem !important;
  }
  .fm-process-amount { font-size: 1.6rem !important; }
  .fm-process-steps { gap: 0.6rem !important; font-size: 0.55rem !important; }
}
