/* ============================================================
   VM FITNESS - COMPREHENSIVE RESPONSIVE DESIGN SYSTEM
   Pixel-perfect alignment across Mobile, Tablet, and Desktop
   ============================================================ */

:root {
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-tap-highlight-color: transparent;
}

a, button, input, select, textarea {
  touch-action: manipulation;
}

/* Hide desktop mouse glow on mobile & touch screens */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  .mouse-cursor-glow {
    display: none !important;
  }
}

/* ------------------------------------------------------------
   UNIVERSAL FORM & GRID UTILITIES (ALL DEVICES)
   ------------------------------------------------------------ */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.why-us-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
}

.sticky-story-wrapper {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 50px;
  align-items: start;
}

.sticky-story-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 30px);
}

.sticky-story-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.story-block {
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: 30px;
  transition: all 0.3s ease;
}

.story-block.active {
  border-color: #000000;
  background: #FFFFFF;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.horizontal-scroll-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 24px 30px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.horizontal-scroll-track {
  display: flex;
  gap: 24px;
  width: max-content;
}

.horizontal-card {
  width: 320px;
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: all 0.3s ease;
}

.horizontal-card:hover {
  transform: translateY(-6px);
  border-color: #000000;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

/* ------------------------------------------------------------
   1. LAPTOPS & SMALL DESKTOPS (<= 1200px)
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .container {
    max-width: 1120px;
    padding: 0 24px;
  }

  .section-title {
    font-size: 2.25rem;
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 30px;
  }

  .pricing-grid {
    gap: 24px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .admin-main {
    padding: 30px 32px;
  }

  .sticky-story-wrapper {
    grid-template-columns: 320px 1fr;
    gap: 36px;
  }
}

/* ------------------------------------------------------------
   2. TABLETS & SMALL LAPTOPS (<= 1100px)
   ------------------------------------------------------------ */
@media (max-width: 1100px) {
  :root {
    --nav-height: 74px;
  }

  /* Header & Navigation */
  .nav-container {
    padding: 0 20px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  /* Coordinate Navbar toggle and Mobile Drawer Close Button */
  body.menu-open .nav-toggle {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* Full Screen Slide-out Navigation Drawer (Clean Minimal Monochrome) */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(350px, 88vw);
    height: 100vh;
    height: 100dvh;
    background: #FFFFFF;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 20px 20px 30px;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    z-index: 1001;
  }

  .nav-menu.active {
    right: 0;
  }

  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
  }

  .drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .drawer-logo {
    height: 32px;
    width: auto;
  }

  .drawer-brand-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    line-height: 1.1;
    color: #1D1D1F;
  }

  .drawer-sub {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--apple-grey-700);
    text-transform: uppercase;
  }

  .drawer-close-btn {
    background: #F5F5F7;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1D1D1F;
    width: 34px;
    height: 34px;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .drawer-close-btn:hover {
    background: #000000;
    color: #FFFFFF;
    border-color: #000000;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    flex-grow: 1;
  }

  .nav-link {
    font-size: 0.88rem;
    padding: 9px 12px;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    color: var(--apple-grey-700);
    border: 1px solid transparent;
  }

  .nav-icon {
    display: inline-flex;
    color: #1D1D1F;
  }

  .nav-link:hover, .nav-link.active {
    background: #F5F5F7;
    border-color: rgba(0, 0, 0, 0.08);
    color: #000000;
    padding-left: 16px;
  }

  .nav-link::after {
    display: none;
  }

  .mobile-drawer-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
  }

  .drawer-contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--apple-grey-700);
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.2s ease;
  }

  .drawer-contact-link:hover {
    color: #000000;
  }

  /* Storytelling Stack on Tablets */
  .sticky-story-wrapper {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .sticky-story-sidebar {
    position: relative;
    top: 0;
  }

  /* Grids Reflow for Tablets */
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800px;
    margin: 0 auto 50px;
  }

  .pricing-grid .pricing-card:last-child {
    grid-column: span 2;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }

  .about-story-grid,
  .contact-grid,
  .calc-layout,
  .free-trial-layout {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }

  .about-story-grid [style*="order: 1"],
  .about-story-grid [style*="order: 2"] {
    order: unset !important;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }

  /* Admin Layout on Tablets */
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .admin-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 8px;
  }

  .admin-nav-item {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .admin-main {
    max-width: 100%;
    padding: 24px;
  }
}



/* ------------------------------------------------------------
   3. MOBILE PHONES (<= 768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  :root {
    --nav-height: 68px;
  }

  body {
    padding-bottom: calc(72px + var(--safe-area-bottom)) !important; /* Offset for Mobile Bottom Dock + iOS Safe Area */
  }

  .mobile-bottom-dock {
    display: flex;
    padding-bottom: max(6px, var(--safe-area-bottom));
    height: calc(64px + var(--safe-area-bottom));
  }


  /* Move Botpress chatbot above mobile bottom dock */
#mobileBottomDock ~ .ai-chatbot-icon, 
.ai-chatbot-icon {
  position: fixed !important;
  right: 1px !important;
  bottom: calc(64px + max(6px, var(--safe-area-bottom)) + 10px) !important;
  z-index: 9999 !important;
}

  .section {
    padding: 44px 0 !important;
  }

  .container {
    padding: 0 16px;
  }

  /* Section Titles */
  .section-header {
    margin-bottom: 32px;
  }

  .section-title {
    font-size: 1.85rem;
    line-height: 1.2;
  }

  .section-subtitle {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .section-tag {
    font-size: 0.76rem;
    letter-spacing: 2px;
  }

  /* Hero Section Mobile Optimization */
  .hero-stage {
    min-height: auto;
    padding-top: calc(var(--nav-height) + 16px);
    padding-bottom: 32px;
  }

  .hero-rotating-logo-wrap {
    width: min(320px, 76vw) !important;
    height: min(320px, 76vw) !important;
  }

  .hero-golden-aura-glow,
  .hero-golden-orbit-ring {
    width: min(300px, 72vw) !important;
    height: min(300px, 72vw) !important;
  }

  .hero-golden-logo-glow,
  .hero-golden-vertical-logo {
    width: min(230px, 56vw) !important;
    height: min(230px, 56vw) !important;
  }

  .hero-slogan-top {
    letter-spacing: 2.5px;
    font-size: 0.72rem;
  }

.hero-main-title {
  font-family: var(--font-heading);
  font-size: clamp(3.2rem, 7.5vw, 6.2rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  margin: 0 0 14px 0;
  color: #1D1D1F;
}

  .hero-sub-text {
    letter-spacing: 2px;
    font-size: 0.75rem;
  }

  .hero-bottom-bar {
    margin-top: 20px;
    margin-bottom: 12px;
    gap: 16px;
  }

  .hero-cta-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    gap: 12px;
  }

  .btn-hero-trial,
  .btn-hero-join {
    width: 100%;
    padding: 14px 20px;
    font-size: 0.92rem;
    text-align: center;
    justify-content: center;
  }

  .hero-priority-seal {
    padding: 8px 16px;
    width: 100%;
    max-width: 100%;
  }

  .seal-text {
    font-size: 0.72rem;
    letter-spacing: 1px;
  }

  /* Form Grids Stacking Cleanly on Mobile */
  .form-grid-2,
  .form-grid-3,
  form [style*="grid-template-columns: 1fr 1fr"],
  form [style*="grid-template-columns: 1fr 1.2fr"],
  form [style*="grid-template-columns: 1.15fr 0.85fr"],
  form [style*="grid-template-columns: 0.85fr 1.15fr"] {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .form-control {
    font-size: 16px; /* Prevents auto-zoom in iOS Safari */
    padding: 12px 14px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  /* Modals on Mobile */
  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    padding: 24px 18px;
    border-radius: var(--radius-lg);
    max-height: 94vh;
  }

  .modal-close-btn {
    top: 12px;
    right: 12px;
  }

  /* Grids Reflow for Mobile */
  .why-us-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 24px;
  }

  .pricing-grid .pricing-card:last-child {
    grid-column: span 1;
    max-width: 100%;
  }

  .specialized-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .results-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .results-grid .result-card,
  .results-grid .macros-card,
  .results-grid [style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }

  .duration-switcher-wrap {
    padding: 0 8px;
    margin-bottom: 30px;
  }

  .duration-switcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: var(--radius-lg);
    padding: 4px;
    width: 100%;
    gap: 4px;
  }

  .duration-btn {
    padding: 8px 12px;
    font-size: 0.78rem;
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    justify-content: center;
  }

  /* Gallery Filters on Mobile */
  .gallery-filter-wrap {
    margin-bottom: 28px;
    padding: 0;
  }

  .gallery-filter-nav {
    border-radius: var(--radius-lg);
    gap: 6px;
    padding: 6px;
    width: 100%;
  }

  .gallery-filter-btn {
    padding: 8px 12px;
    font-size: 0.74rem;
    flex: 1 1 auto;
    text-align: center;
  }

  .gallery-img-box {
    height: 240px;
  }

  /* Horizontal Showcase Cards */
  .horizontal-card {
    width: min(290px, 78vw);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }

  .developed-by-credit {
    justify-content: center;
  }

  /* About Page Mobile Optimizations */
  .about-story-img {
    height: 240px !important;
    width: 100% !important;
    object-fit: cover !important;
  }

  .about-stat-strip {
    display: flex !important;
    justify-content: space-around !important;
    gap: 12px !important;
    text-align: center;
  }

  /* Gallery Grid on Mobile */
  #galleryGrid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    gap: 16px !important;
  }

  /* Tables & Horizontal Scroll */
  .horizontal-scroll-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .horizontal-scroll-container::-webkit-scrollbar {
    display: none;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Admin Cards & Login */
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .admin-login-card {
    padding: 30px 18px;
  }
}

/* ------------------------------------------------------------
   4. SMALL MOBILE PHONES (<= 480px)
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }

  .section-title {
    font-size: 1.55rem;
  }

  .btn {
    padding: 12px 18px;
    font-size: 0.84rem;
  }

  .nav-brand-text {
    font-size: 1.15rem;
    letter-spacing: 1px;
  }

  .nav-logo {
    height: 34px;
  }

  .card-glass {
    padding: 20px 16px;
  }

  .pricing-card {
    padding: 26px 16px;
  }

  .pricing-amount {
    font-size: 2.2rem;
  }

  .calc-input-card {
    padding: 20px 14px;
  }

  .result-card-value {
    font-size: 1.6rem;
  }

  .contact-action-btns,
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* About Philosophy Badges & Stat Strip */
  [style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(240px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .about-stat-strip,
  [style*="display: flex; gap: 28px; border-top"] {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    text-align: center;
  }

  .about-stat-strip > div > div:first-child {
    font-size: 1.6rem !important;
  }

  .about-stat-strip > div > div:last-child {
    font-size: 0.65rem !important;
    letter-spacing: 0.5px !important;
  }

  #galleryGrid {
    grid-template-columns: 1fr !important;
  }
}

/* ------------------------------------------------------------
   5. EXTRA COMPACT PHONES (<= 360px)
   ------------------------------------------------------------ */
@media (max-width: 360px) {
  .section-title {
    font-size: 1.4rem;
  }

  .hero-main-title {
    font-size: 2.1rem;
  }

  .hero-slogan-top,
  .hero-sub-text {
    letter-spacing: 1.5px;
  }

  .duration-btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    flex: 1 1 100%;
  }
}
