
/* ================================================================
   OSPITO MOBILE CSS - COMPLETE REWRITE
   Forces proper mobile layout on ALL pages
   ================================================================ */

:root {
  --ink: #1B3A2D; --cream: #F2FBF6; --mint: #B8F0D8;
  --sage: #81C784; --forest: #43A047; --muted: #6b8f7a;
  --radius: 12px; --nav-h: 60px; --bottom-h: 68px;
}

/* ---- GLOBAL ---- */
*, *::before, *::after { box-sizing: border-box !important; }
html {
  -webkit-text-size-adjust: 100% !important;
  -webkit-tap-highlight-color: transparent !important;
}
body { overflow-x: hidden !important; }
img, video, iframe { max-width: 100% !important; height: auto !important; }

/* ---- MOBILE NAV BAR ---- */
.ospito-mobile-nav {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--ink);
  z-index: 9999;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.ospito-mobile-nav .nav-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px; font-weight: 900;
  text-decoration: none;
}
.ospito-mobile-nav .nav-logo .os { color: #fff; }
.ospito-mobile-nav .nav-logo .pito { color: #81C784; }

.ospito-hamburger {
  width: 44px; height: 44px;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  gap: 5px; cursor: pointer;
  background: rgba(255,255,255,0.1);
  border: none; border-radius: 10px; padding: 0;
}
.ospito-hamburger span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: all 0.25s ease; transform-origin: center;
}
.ospito-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ospito-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.ospito-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- DRAWER ---- */
.ospito-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--ink);
  z-index: 9998;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.ospito-drawer.open { transform: translateX(0) !important; }
.ospito-drawer a {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.ospito-drawer a:hover, .ospito-drawer a.active {
  color: #B8F0D8; border-left-color: #B8F0D8;
  background: rgba(184,240,216,0.08);
}
.ospito-drawer a .drawer-icon { font-size: 20px; width: 28px; text-align: center; }
.ospito-drawer .drawer-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 24px; }
.ospito-drawer .drawer-cta {
  margin: 16px 24px 0; padding: 14px;
  background: var(--sage); color: var(--ink) !important;
  border-radius: var(--radius); font-weight: 700 !important;
  justify-content: center !important; border-left: none !important;
}

/* ---- BOTTOM NAV ---- */
.ospito-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: #fff;
  border-top: 1px solid rgba(27,58,45,0.1);
  z-index: 9997;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(27,58,45,0.08);
}
.ospito-bottom-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 10px; font-weight: 600;
  padding: 8px 4px;
  -webkit-tap-highlight-color: transparent;
}
.ospito-bottom-nav a.active { color: var(--ink); }
.ospito-bottom-nav a .bn-icon { font-size: 22px; }
.ospito-bottom-nav a.active .bn-icon { transform: scale(1.15); }

/* ---- TOAST ---- */
.ospito-toast {
  position: fixed;
  bottom: calc(var(--bottom-h) + 12px);
  left: 16px; right: 16px;
  background: var(--ink); color: #fff;
  border-radius: 14px; padding: 14px 18px;
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  z-index: 99999; opacity: 0; transform: translateY(16px);
  transition: all 0.3s ease; pointer-events: none;
  box-shadow: 0 8px 32px rgba(27,58,45,0.25);
}
.ospito-toast.show { opacity: 1 !important; transform: translateY(0) !important; }

/* ---- OFFLINE BAR ---- */
.ospito-offline-bar {
  display: none;
  position: fixed; top: var(--nav-h); left: 0; right: 0;
  background: #E65100; color: #fff;
  text-align: center; font-size: 13px; font-weight: 600;
  padding: 8px; z-index: 9996;
}

/* ================================================================
   MOBILE BREAKPOINT - Everything below 768px
   ================================================================ */
@media screen and (max-width: 768px) {

  /* Show mobile UI */
  .ospito-mobile-nav { display: flex !important; }
  .ospito-drawer { display: flex !important; }
  .ospito-bottom-nav { display: flex !important; }

  /* Body padding for fixed bars */
  body {
    padding-top: var(--nav-h) !important;
    padding-bottom: var(--bottom-h) !important;
  }

  /* Safe area support for iPhone notch */
  @supports (padding: env(safe-area-inset-top)) {
    body { padding-top: calc(var(--nav-h) + env(safe-area-inset-top)) !important; }
    .ospito-mobile-nav {
      height: calc(var(--nav-h) + env(safe-area-inset-top)) !important;
      padding-top: env(safe-area-inset-top) !important;
    }
    .ospito-bottom-nav {
      height: calc(var(--bottom-h) + env(safe-area-inset-bottom)) !important;
    }
  }

  /* ---- HIDE DESKTOP NAV ---- */
  nav:not(.ospito-mobile-nav):not(.ospito-bottom-nav) { display: none !important; }
  .nav-links, .nav-cta, .desktop-nav, .desktop-only { display: none !important; }

  /* ---- TYPOGRAPHY ---- */
  h1 { font-size: clamp(26px, 7.5vw, 40px) !important; line-height: 1.15 !important; }
  h2 { font-size: clamp(20px, 6vw, 30px) !important; line-height: 1.25 !important; }
  h3 { font-size: clamp(17px, 5vw, 22px) !important; }
  p  { font-size: 15px !important; line-height: 1.65 !important; }

  /* ---- ALL CONTAINERS ---- */
  .container, .wrapper, [class*="container"], [class*="wrapper"] {
    width: 100% !important; max-width: 100% !important;
    padding-left: 20px !important; padding-right: 20px !important;
  }

  /* ---- ALL SECTIONS ---- */
  section, .section, [class*="section"] {
    padding: 48px 20px !important;
  }

  /* ---- HERO ---- */
  .hero, [class*="hero"] {
    display: flex !important;
    flex-direction: column !important;
    padding: 40px 20px 48px !important;
    min-height: auto !important;
    text-align: center !important;
    gap: 32px !important;
  }
  .hero > * { width: 100% !important; }

  /* ---- ALL GRIDS -> SINGLE COLUMN ---- */
  [class*="grid"],
  [class*="cols"],
  [class*="features"],
  [class*="cards"],
  [class*="plans"],
  [class*="pricing"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* 2-col grids that can stay 2-col on mobile */
  [class*="stats"], .stat-row, .metrics-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  /* ---- ALL FLEX ROWS -> COLUMN ---- */
  [class*="flex-row"], [class*="row-"]:not([class*="grid"]) {
    flex-direction: column !important;
  }

  /* ---- HARDCODED WIDTHS - KILL THEM ---- */
  [style*="width: 480"], [style*="width: 560"],
  [style*="width: 500"], [style*="width: 600"],
  [style*="width: 400"], [style*="width: 700"],
  [style*="width: 800"], [style*="width: 900"],
  [style*="width: 1000"], [style*="width: 1100"],
  [style*="width: 1200"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ---- MAX-WIDTHS ---- */
  [style*="max-width"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* ---- DECORATIVE ELEMENTS - HIDE ---- */
  [class*="blob"], [class*="bg-blob"],
  [class*="decoration"], [class*="ornament"],
  [class*="particle"], [class*="shape"] {
    display: none !important;
  }

  /* ---- HERO IMAGE/VISUAL - HIDE ON TINY SCREENS ---- */
  .hero-visual, .hero-image, .hero-right,
  [class*="hero-img"], [class*="hero-visual"] {
    display: none !important;
  }

  /* ---- MONITOR / HOMIE ANIMATION ---- */
  .monitor-wrap, .homie-wrapper, .computer-scene,
  [class*="monitor"], [class*="computer"],
  [class*="animation-wrap"] {
    transform: scale(0.6) !important;
    transform-origin: top center !important;
    margin-bottom: -120px !important;
    overflow: visible !important;
  }

  /* ---- CARDS ---- */
  .card, [class*="-card"], [class*="card-"] {
    width: 100% !important;
    border-radius: 16px !important;
    padding: 20px !important;
    margin-bottom: 12px !important;
  }

  /* ---- BUTTONS ---- */
  button, .btn, a.btn, [class*="btn-"], [class*="-btn"] {
    min-height: 48px !important;
    font-size: 16px !important;
    border-radius: 12px !important;
    padding: 13px 22px !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  .hero button, .hero .btn, .hero a.btn,
  [class*="cta"] button, [class*="cta"] .btn {
    width: 100% !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
  }

  /* ---- INPUTS ---- */
  input, textarea, select {
    font-size: 16px !important;  /* CRITICAL: prevents iOS auto-zoom */
    padding: 14px 16px !important;
    border-radius: 12px !important;
    width: 100% !important;
    -webkit-appearance: none !important;
  }

  /* ---- TABLES ---- */
  table, .table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    font-size: 13px !important;
  }

  /* ---- TABS ---- */
  .tabs, [class*="tab-bar"], [class*="tabs"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .tabs::-webkit-scrollbar { display: none !important; }
  .tab, [class*="-tab"] { flex-shrink: 0 !important; white-space: nowrap !important; }

  /* ---- MODALS ---- */
  .modal, .dialog, [class*="modal"] {
    position: fixed !important; inset: 0 !important;
    border-radius: 0 !important; margin: 0 !important;
    max-width: 100% !important; max-height: 100% !important;
  }

  /* ---- SIDEBAR ---- */
  .sidebar, [class*="sidebar"] { display: none !important; }
  .main, .content, [class*="main-content"] { width: 100% !important; margin: 0 !important; }

  /* ---- FOOTER ---- */
  footer, .footer, [class*="footer"]:not(.footer-tagline) {
    padding: 40px 20px 100px !important;
    flex-direction: column !important;
    text-align: center !important;
    gap: 24px !important;
  }
  [class*="footer-grid"], [class*="footer-col"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }

  /* ---- CTA SECTIONS ---- */
  [class*="cta"], [class*="cta-section"] {
    padding: 48px 20px !important;
    text-align: center !important;
  }

  /* ---- PRICING ---- */
  [class*="pricing"], [class*="plan-"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* ---- SMOOTH SCROLLING ---- */
  * { -webkit-overflow-scrolling: touch !important; }

  /* ---- DASHBOARD SPECIFIC ---- */
  .pane, [class*="pane"] { padding: 16px !important; }
  [class*="section-head"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  [class*="live-stats"], [class*="dash-stats"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* ---- SCROLL HORIZONTAL FOR OVERFLOW ---- */
  [class*="scroll-x"], [class*="horizontal"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
  }

  /* ---- FOCUS STATES ---- */
  :focus-visible { outline: 2px solid var(--sage) !important; outline-offset: 2px !important; }

  /* ---- TOUCH TARGETS ---- */
  a, button { min-height: 44px !important; }

  /* ---- PWA BANNER ---- */
  .ospito-pwa-banner {
    display: flex;
    position: fixed;
    bottom: calc(var(--bottom-h) + 12px);
    left: 12px; right: 12px;
    background: var(--ink); color: #fff;
    border-radius: 16px; padding: 16px 18px;
    z-index: 9995; flex-direction: row;
    align-items: center; gap: 14px;
    box-shadow: 0 8px 32px rgba(27,58,45,0.3);
    animation: ospito-slideup 0.4s ease;
  }
  @keyframes ospito-slideup {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .ospito-pwa-banner .banner-icon { font-size: 32px; flex-shrink: 0; }
  .ospito-pwa-banner .banner-text { flex: 1; }
  .ospito-pwa-banner .banner-text strong { display: block; font-size: 14px; }
  .ospito-pwa-banner .banner-text span { font-size: 12px; opacity: 0.75; }
  .ospito-pwa-banner .banner-actions { display: flex; flex-direction: column; gap: 6px; }
  .ospito-pwa-banner .btn-install {
    background: var(--sage); color: var(--ink);
    border: none; border-radius: 8px;
    padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  }
  .ospito-pwa-banner .btn-dismiss {
    background: none; color: rgba(255,255,255,0.6);
    border: none; font-size: 12px; cursor: pointer; text-align: center;
  }
}

/* ---- TABLET (769-1024) ---- */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  [class*="grid-3"], [class*="grid-4"], [class*="cols-3"], [class*="cols-4"] {
    grid-template-columns: 1fr 1fr !important;
  }
  section, .section { padding: 60px 40px !important; }
}

/* ---- SMALL PHONES (< 375px) ---- */
@media screen and (max-width: 375px) {
  h1 { font-size: 24px !important; }
  .ospito-bottom-nav a .bn-label { display: none !important; }
  .ospito-bottom-nav a .bn-icon { font-size: 26px !important; }
}

/* ---- SCROLLBAR HIDE ---- */
@media screen and (max-width: 768px) {
  ::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
}

/* ---- KILL DESKTOP NAV ON MOBILE ---- */
@media screen and (max-width: 768px) {
  nav.desktop-nav,
  nav:not(.ospito-mobile-nav):not(.ospito-bottom-nav) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
  }
  
  /* Fix logo gap */
  .nav-logo { gap: 0 !important; }
  .logo-text { gap: 0 !important; letter-spacing: -0.5px !important; }
  .nav-logo-icon { display: none !important; }
  
  /* Fix body padding - only our mobile nav height */
  body { padding-top: 60px !important; }
}
