/* ==========================================================================
   MOGO X+ — RESPONSIVE & TOUCH LAYER   (load AFTER mobile-nav.css)
   Breakpoints:  Mobile <=480  |  Tablet 481-768  |  Laptop 769-1024  |  Desktop >1024
   Rules outside a media query are desktop-safe. Layout changes are scoped to
   <=1024px so the existing desktop design is untouched.
   ========================================================================== */

/* ---------- 1. Base: box model, overflow, media, text inflation ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* Global Custom Dark Obsidian Scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) #040508;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #040508;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  border: 2px solid #040508;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.38);
}

::-webkit-scrollbar-corner {
  background: #040508;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;              /* stop iOS/Android auto-inflating text */
  overflow-x: hidden;
  overflow-x: clip;                    /* clip keeps position:sticky working */
  scroll-padding-top: 88px;            /* anchor jumps clear the floating nav */
}
body {
  min-width: 320px;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-wrap: break-word;
}
img, video, canvas, svg, iframe { max-width: 100%; }
img, video { height: auto; }
pre, code { overflow-wrap: anywhere; }
pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 2. Touch behaviour ---------- */
a, button, input, select, textarea, label, summary, [role="button"] {
  touch-action: manipulation;          /* removes 300ms double-tap-zoom delay */
  -webkit-tap-highlight-color: transparent;
}
:focus-visible { outline: 2px solid #7C65E8; outline-offset: 2px; }
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible,
.hero-input:focus,
.hero-input:focus-visible,
.search-input:focus,
.search-input:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

/* 44x44px minimum targets on touch devices */
@media (pointer: coarse) {
  button, [type="button"], [type="submit"], [type="reset"], select, summary,
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  .nav-profile-pill, .swap-action-btn {
    min-height: 44px;
  }
  button[aria-label], .mobile-drawer-close { min-width: 44px; }
  .footer-nav-link { display: flex; align-items: center; min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
}

/* Scrollable table wrapper (also injected by mobile-nav.js around bare tables) */
.table-scroll, .table-responsive, .overflow-x-auto {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll > table { min-width: 100%; }

/* ---------- 3. Laptop & below (<=1024px): fluid layout ---------- */
@media (max-width: 1024px) {
  .container { padding-inline: clamp(16px, 4vw, 32px) !important; }

  .bento-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)) !important;
  }
  .col-3, .col-4, .col-6 { grid-column: auto !important; }
  .col-8, .col-12        { grid-column: 1 / -1 !important; }
  .pricing-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)) !important;
  }
  .bento-grid > *, .pricing-grid > *, .checkout-grid > * { min-width: 0; }

  .page-title     { font-size: clamp(1.75rem, 1.2rem + 3vw, 3rem); line-height: 1.12; }
  .section-title  { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.25rem); line-height: 1.2; }
  .checkout-title { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.25rem); }
}

/* ---------- 4. Tablet & below (<=768px): navigation + forms ---------- */
@media (max-width: 768px) {
  /* Hide native scrollbars on mobile viewports & device emulator frames */
  html, body {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  ::-webkit-scrollbar {
    display: none !important;
    width: 0px !important;
    height: 0px !important;
  }

  .navbar-container {
    top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: none !important;
    z-index: 10000 !important;
  }
  .navbar-container.nav-scroll-hidden {
    transform: none !important;
    opacity: 1 !important;
    pointer-events: none !important;
  }
  .navbar-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    padding: 0 6px 0 14px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    max-width: calc(100% - 16px) !important;
    width: auto !important;
    border-radius: 9999px !important;
    background: rgba(18, 19, 26, 0.92) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7) !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
  }
  .navbar-pill > div {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .nav-brand {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 7px !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
    color: #FFFFFF !important;
    line-height: 1 !important;
  }
  .nav-brand-icon {
    width: 22px !important;
    height: 22px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }
  .nav-cta,
  .navbar-pill .nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    color: #000000;
    padding: 0 16px;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: 9999px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    line-height: 36px;
    white-space: nowrap;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    text-decoration: none;
    margin: 0;
    box-sizing: border-box;
    vertical-align: middle;
  }
  .nav-cta.hidden,
  .navbar-pill .nav-cta.hidden,
  .navbar-pill:has(.nav-profile-pill) .nav-cta,
  .navbar-pill.has-auth .nav-cta,
  body.customer-logged-in .nav-cta,
  .customer-logged-in .navbar-pill .nav-cta {
    display: none !important;
  }
  .mobile-hamburger,
  .navbar-pill .mobile-hamburger {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    color: #FFFFFF !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .mobile-drawer-close { width: 44px; height: 44px; }
  .mobile-drawer-overlay { height: 100dvh; }
  .mobile-drawer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  .mobile-drawer-links { gap: 4px; }
  .mobile-nav-item { min-height: 48px; }
  .nav-profile-pill { min-height: 44px; }

  /* 16px inputs: prevents iOS Safari zooming the page on focus */
  input, select, textarea { font-size: 16px !important; }

  /* Account table: readable text (643-768 keeps the real table, <=640 becomes cards below) */
  .accounts-table { width: 100% !important; }
  .accounts-table th, .accounts-table td { font-size: 12.5px !important; padding: 10px 8px !important; }
  .accounts-table th { font-size: 11px !important; }
  .swap-action-btn { font-size: 12px !important; padding: 8px 12px !important; }

  /* Section rhythm: fluid instead of 90-130px desktop gaps */
  .hero-section { min-height: auto !important; padding: 104px 20px clamp(40px, 9vw, 64px) !important; }
  .ticker-section { padding: 28px 0 clamp(32px, 8vw, 48px) !important; }
  .integrations-section { padding: clamp(32px, 7vw, 48px) 0 !important; }
  .apps-pill-row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px 10px !important;
    margin-top: 20px !important;
    max-width: 440px !important;
    margin-inline: auto !important;
  }
  .app-icon-pill {
    padding: 6px 13px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    gap: 7px !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
    flex: 0 1 auto !important;
  }
  .app-icon-pill span {
    font-size: 13px !important;
  }
  .pricing-section { padding: clamp(44px, 10vw, 72px) 0 !important; }
  .faq-section { margin: clamp(40px, 9vw, 64px) auto clamp(48px, 12vw, 80px) !important; }
  .faq-toggle-icon { flex-shrink: 0; min-width: 32px; text-align: center; font-size: 22px; line-height: 1; }

  .toast-box { max-width: calc(100vw - 24px); }
  .footer-section { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ---------- 4b. Phones (<=640px): account table -> stacked cards ---------- */
@media (max-width: 640px) {
  .accounts-table-wrap { overflow: visible; }
  .accounts-table, .accounts-table tbody { display: block; width: 100% !important; }
  .accounts-table thead {                          /* hidden visually, kept for screen readers */
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  }
  .accounts-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
    padding: 16px 4px; border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .accounts-table td {
    display: block; padding: 0 !important; border: 0 !important;
    text-align: left !important; font-size: 14px !important; min-width: 0;
  }
  .accounts-table td:first-child { grid-column: 1 / -1; font-size: 15px !important; font-weight: 700; }
  .accounts-table td:nth-child(n+2):nth-child(-n+4)::before {
    display: block; margin-bottom: 3px; font: 600 10.5px/1.2 'Plus Jakarta Sans', sans-serif;
    letter-spacing: .08em; text-transform: uppercase; color: #6B7280;
  }
  .accounts-table td:nth-child(2)::before { content: "Net Worth"; }
  .accounts-table td:nth-child(3)::before { content: "Dice Reserve"; }
  .accounts-table td:nth-child(4)::before { content: "Status"; }
  .accounts-table td:last-child { align-self: end; }
  .accounts-table .swap-action-btn { width: 100%; min-height: 44px; font-size: 13px !important; }
  .table-account-cell { white-space: normal !important; font-size: inherit !important; }

  /* Bento 4: Capsule Box on Phones (prevent button overflow & zero empty void) */
  .capsule-box {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 14px !important;
    padding: 16px !important;
    height: auto !important;
    min-height: auto !important;
  }
  .capsule-info {
    flex: initial !important;
    width: 100% !important;
    height: auto !important;
  }
  .capsule-box .swap-action-btn,
  .capsule-box .capsule-btn {
    width: 100% !important;
    min-height: 44px !important;
    text-align: center !important;
    justify-content: center !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: normal !important;
    padding: 10px 16px !important;
    margin-top: 0 !important;
  }
}

/* ---------- 5. Tablet only (481-768px) ---------- */
@media (min-width: 481px) and (max-width: 768px) {
  .container { padding-inline: 24px !important; }
}

/* ---------- 6. Mobile (<=480px) ---------- */
@media (max-width: 480px) {
  /* Hero key form: stack input over button so the placeholder is never cut */
  .hero-input-group { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border-radius: 24px; max-width: 100%; }
  .hero-input { width: 100%; min-width: 0; min-height: 48px; text-align: center; text-overflow: ellipsis; }
  .hero-submit-btn { width: 100%; min-height: 48px; }
  .bento-card, .pricing-card { padding: 18px 16px; }
  .hero-subtitle { font-size: clamp(0.875rem, 3.6vw, 1rem) !important; }
  h1 { overflow-wrap: anywhere; }

  .integrations-section { padding: 28px 0 34px !important; }
  .apps-pill-row {
    gap: 6px 8px !important;
    margin-top: 15px !important;
    max-width: 340px !important;
  }
  .app-icon-pill {
    padding: 5px 10px !important;
    font-size: 11px !important;
    gap: 5px !important;
  }
  .app-icon-pill span {
    font-size: 12px !important;
  }
}

/* ---------- 7. Small phones (<=360px): keep the pill on one row ---------- */
@media (max-width: 360px) {
  .navbar-pill { gap: 5px !important; padding: 4px 5px 4px 8px !important; }
  .nav-brand { font-size: 13px !important; gap: 5px !important; padding: 2px 2px !important; }
  .nav-brand-icon { width: 20px !important; height: 20px !important; font-size: 10px !important; }
  .nav-cta, .navbar-pill .nav-cta {
    display: inline-flex;
    padding: 5px 10px;
    font-size: 11px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
  }
  .nav-cta.hidden,
  .navbar-pill .nav-cta.hidden,
  .navbar-pill:has(.nav-profile-pill) .nav-cta,
  .navbar-pill.has-auth .nav-cta,
  body.customer-logged-in .nav-cta,
  .customer-logged-in .navbar-pill .nav-cta {
    display: none !important;
  }
  .mobile-hamburger, .navbar-pill .mobile-hamburger {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }
  .nav-profile-name { display: none; }
  .footer-container { padding-inline: 14px; }
}

/* ---------- 8. Landscape phones: short viewports ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .mobile-drawer { padding-top: 16px; }
  .mobile-nav-item { min-height: 44px; padding-block: 8px; }
}

/* ---------- 9. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   ADMIN PANEL — mobile menu (elements are injected by admin-mobile.js)
   ========================================================================== */
.admin-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
}
.admin-drawer-overlay {
  position: fixed; inset: 0; z-index: 99998; height: 100dvh;
  background: rgba(4,5,8,.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.admin-drawer-overlay.active { opacity: 1; visibility: visible; }
.admin-drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(86vw, 320px);
  background: #080A10; border-right: 1px solid rgba(255,255,255,.08);
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.admin-drawer-overlay.active .admin-drawer { transform: none; }
.admin-drawer-title { font: 700 11px/1 'JetBrains Mono', monospace; letter-spacing: .08em; color: #6B7280; padding: 8px 10px 12px; }
.admin-drawer-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: none;
  color: #D1D5DB; font: 600 14px 'Plus Jakarta Sans', sans-serif; text-align: left; cursor: pointer;
}
.admin-drawer-item:active { background: rgba(255,255,255,.06); }
.admin-drawer-item.active { background: rgba(124,101,232,.14); border-color: rgba(124,101,232,.35); color: #C5BBE8; }
.admin-drawer-item .material-symbols-outlined { font-size: 20px; }

@media (min-width: 768px) {                       /* matches Tailwind md: sidebar */
  .admin-menu-btn, .admin-drawer-overlay { display: none !important; }
}
@media (max-width: 767px) {
  main { min-width: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .modal-card { max-width: calc(100vw - 24px); max-height: 90dvh; overflow-y: auto; }
}

/* =========================================================
   MOBILE PRICING HORIZONTAL SNAP CAROUSEL (<= 768px)
   ========================================================= */
@media (max-width: 768px) {
  .pricing-section .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }
  .pricing-section .section-header,
  .pricing-section .pricing-toggle-wrap {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  .pricing-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 16px !important;
    padding: 16px 20px 24px 20px !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    scrollbar-width: none !important;
  }
  .pricing-grid::-webkit-scrollbar {
    display: none !important;
    width: 0px !important;
    height: 0px !important;
  }
  .pricing-card {
    flex: 0 0 84% !important;
    width: 84% !important;
    max-width: 330px !important;
    min-width: 275px !important;
    scroll-snap-align: center !important;
    scroll-snap-stop: always !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    padding: 26px 20px !important;
    border-radius: 24px !important;
  }
  .pricing-card.featured {
    border-color: rgba(124, 101, 232, 0.6) !important;
    box-shadow: 0 10px 32px rgba(124, 101, 232, 0.28) !important;
    transform: none !important;
  }
  .pricing-card .plan-name {
    font-size: 20px !important;
  }
  .pricing-card .plan-price {
    font-size: 34px !important;
  }
  .pricing-card .plan-features {
    margin: 20px 0 !important;
    gap: 12px !important;
  }
  .pricing-card .plan-feature-item {
    font-size: 12.5px !important;
  }

  /* Carousel Dots Indicator */
  .pricing-carousel-dots {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 8px !important;
    margin-bottom: 24px !important;
  }
  .pricing-carousel-dots .dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 9999px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .pricing-carousel-dots .dot.active {
    width: 28px !important;
    background: linear-gradient(135deg, var(--accent-emerald, #10b981), var(--accent-purple, #7c65e8)) !important;
    box-shadow: 0 0 14px rgba(124, 101, 232, 0.6) !important;
  }
}

@media (min-width: 769px) {
  .pricing-carousel-dots {
    display: none !important;
  }
}

/* =========================================================
   EXISTING CUSTOMER VAULT BANNER (DESKTOP + MOBILE)
   ========================================================= */
.existing-customer-banner {
  max-width: 780px;
  margin: 44px auto 24px;
  background: rgba(18, 19, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 14px 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.existing-customer-info {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.existing-customer-icon {
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  flex-shrink: 0;
}

.existing-customer-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #FFFFFF;
}

.existing-customer-desc {
  font-size: 12.5px;
  color: var(--text-muted, #94a3b8);
  margin-top: 2px;
}

.existing-customer-btn {
  background: linear-gradient(135deg, var(--accent-peach, #f5b8a8), var(--accent-purple, #7c65e8));
  color: #000000 !important;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 24px;
  border-radius: 9999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.existing-customer-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(124, 101, 232, 0.45);
}

/* Mobile & Tablet Adaptive Mode (<= 768px) */
@media (max-width: 768px) {
  .existing-customer-banner {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    border-radius: 24px !important;
    padding: 24px 20px !important;
    width: calc(100% - 32px) !important;
    max-width: 400px !important;
    margin: 28px auto !important;
    gap: 16px !important;
  }

  .existing-customer-info {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 12px !important;
  }

  .existing-customer-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
    font-size: 24px !important;
    margin-bottom: 2px !important;
  }

  .existing-customer-title {
    font-size: 16px !important;
    line-height: 1.3 !important;
  }

  .existing-customer-desc {
    font-size: 13px !important;
    max-width: 290px !important;
    margin: 4px auto 0 !important;
    line-height: 1.45 !important;
  }

  .existing-customer-btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 13px 20px !important;
    font-size: 14px !important;
    border-radius: 9999px !important;
    box-sizing: border-box !important;
  }
}

