/* ============================================================
   CoachKit — Mobile Responsive Stylesheet (mobile.css)
   Include on every page: <link rel="stylesheet" href="mobile.css"/>
   Breakpoints:
     tablet : max-width 900px
     mobile : max-width 600px
     small  : max-width 380px
   ============================================================ */

/* ── GLOBAL RESETS ─────────────────────────────────────────── */
*, *::before, *::after { -webkit-tap-highlight-color: transparent; }
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Minimum tap target size for all interactive elements */
button, a, input, select, textarea,
[role="button"], [onclick] {
  min-height: 44px;
  min-width: 44px;
}
/* Exceptions: inline badges, decorative */
.pm-badge, .dc-time, .dc-pl, .dc-yt,
.cat-cnt, .dur-lbl, .ev-card-meta { min-height: unset; min-width: unset; }

/* ── TOP BAR ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .bar { padding: 0 .6rem; gap: .3rem; height: 48px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .bar::-webkit-scrollbar { display: none; }
  .bar .tag { display: none; }
  .bar .sep { display: none; }
  .tb { padding: .28rem .6rem; font-size: .7rem; flex-shrink: 0; }
  .logo { font-size: 1.05rem; flex-shrink: 0; }
}

/* ── MODALS & POPUPS ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .popup-bg, .modal-bg { padding: 0; align-items: flex-end; }
  .popup, .modal {
    border-radius: 18px 18px 0 0;
    max-height: 94vh;
    max-width: 100%;
    width: 100%;
    animation: slideUp .28s ease !important;
  }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .popup-body { flex-direction: column; max-height: 75vh; overflow-y: auto; }
  .popup-field { border-right: none; border-bottom: 1px solid var(--bd, #1a2330); }
  .popup-field-wrap { min-height: 220px; }
  .popup-info { width: 100%; }
  .popup-hdr { padding: .75rem 1rem; }
  .popup-title { font-size: 1.05rem; }
  .popup-ctrl { padding: .4rem .75rem; gap: .4rem; }
  .pop-btn { padding: .3rem .65rem; font-size: .7rem; }
  .modal-body { padding: .85rem 1rem; }
  .modal-hdr { padding: .75rem 1rem; }
  .modal-foot { padding: .75rem 1rem; }
  .form-row-2 { grid-template-columns: 1fr; }
}

/* ── PRACTICE BUILDER ────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Hide planner panel on tablet — accessible via bottom sheet */
  .plan { display: none; }
  .lib { width: 220px; }
}
@media (max-width: 600px) {
  /* Stack the 3-column layout vertically */
  .main { flex-direction: column; overflow: visible; }
  html, body { overflow: visible !important; height: auto !important; }
  .lib { width: 100%; height: auto; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--bd, #1a2330); }
  .lib-body { max-height: 30vh; }
  .canvas { min-height: 50vw; }
  .field-wrap { min-height: 50vw; }
  .cc { flex-wrap: wrap; gap: .3rem; padding: .4rem .6rem; }
  .cc-name { font-size: .72rem; }
  /* Drill cards — bigger tap targets */
  .dc { padding: .55rem .65rem; margin-bottom: .3rem; }
  .dc-name { font-size: .8rem; }
  /* Category headers */
  .cat-hdr { padding: .6rem .75rem; }
  /* Mobile planner bottom sheet */
  .plan-mobile-btn {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(6,8,9,.96); border-top: 1px solid var(--bd, #1a2330);
    padding: .6rem 1rem; z-index: 200; gap: .5rem; align-items: center;
    backdrop-filter: blur(12px);
  }
}
.plan-mobile-btn { display: none; }

/* ── SCHEDULER ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 220px; }
}
@media (max-width: 600px) {
  /* Full-width calendar, sidebar becomes bottom drawer */
  .main { flex-direction: column; overflow: visible; }
  html, body { overflow: visible !important; height: auto !important; }
  .sidebar {
    width: 100%; border-right: none; border-bottom: 1px solid var(--bd, #1a2330);
    max-height: 200px; overflow-y: auto;
  }
  .sb-head { padding: .5rem .75rem; }
  .legend { flex-direction: row; flex-wrap: wrap; gap: .3rem; }
  .leg-item { font-size: .65rem; }
  .upcoming { display: none; } /* hidden on mobile — use list view */
  .cal-wrap { width: 100%; }
  .cal-top { padding: .45rem .6rem; gap: .35rem; flex-wrap: wrap; }
  .cal-month { font-size: .9rem; min-width: 140px; }
  .view-btns { gap: .2rem; }
  .vb { padding: .22rem .5rem; font-size: .62rem; }
  /* Month grid — smaller cells */
  .day-cell { min-height: 58px; padding: .2rem; }
  .day-num { font-size: .68rem; }
  .cal-ev { font-size: .54rem; padding: .06rem .18rem; }
  /* Week grid — scrollable */
  .week-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 540px; }
  /* Event modal */
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .add-ev-btn { margin: .4rem; width: calc(100% - .8rem); }
  .stats-row { padding: .2rem .4rem; }
  .stat-chip { font-size: .56rem; padding: .08rem .3rem; }
}

/* ── TOURNAMENT FINDER ───────────────────────────────────────── */
@media (max-width: 900px) {
  .filters { width: 220px; }
}
@media (max-width: 600px) {
  .main { flex-direction: column; overflow: visible; }
  html, body { overflow: visible !important; height: auto !important; }
  /* Filters collapse into an accordion */
  .filters {
    width: 100%; border-right: none; border-bottom: 1px solid var(--bd, #1a2330);
    padding: .6rem; max-height: none; overflow: visible;
  }
  .filters-toggle-btn {
    display: flex !important;
    width: 100%; padding: .5rem .6rem; background: var(--card, #12181f);
    border: 1px solid var(--bd, #1a2330); border-radius: 8px;
    color: var(--wh, #eef2f7); font-family: Barlow Condensed, sans-serif;
    font-weight: 700; font-size: .78rem; letter-spacing: .05em;
    text-transform: uppercase; cursor: pointer; margin-bottom: .6rem;
    justify-content: space-between; align-items: center;
  }
  .filters-body { display: none; }
  .filters-body.open { display: block; }
  .results { width: 100%; }
  .results-top { padding: .45rem .6rem; }
  .t-card { flex-wrap: wrap; gap: .5rem; }
  .t-date-block { width: 48px; }
  .t-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .t-save, .t-add-cal { flex: 1; text-align: center; justify-content: center; display: flex; align-items: center; }
  .age-grid { grid-template-columns: repeat(5, 1fr); }
  .results-grid { padding: .5rem .6rem; gap: .4rem; }
  .t-name { font-size: .88rem; }
}
.filters-toggle-btn { display: none; }

/* ── DASHBOARD ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main-content { padding: 1.25rem 1rem; }
}
@media (max-width: 680px) {
  /* Sidebar becomes slide-in drawer — toggled by hamburger */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%); z-index: 200;
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; padding: 1rem .75rem; }
  .hamburger { display: flex !important; }
  .mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 199;
  }
  .mobile-overlay.open { display: block; }
  /* Stat cards — 2 wide on mobile */
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .tool-grid { grid-template-columns: 1fr 1fr !important; }
  .page-title { font-size: 1.3rem; }
}
.hamburger { display: none; }

/* ── LOGIN PAGE ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .login-split { flex-direction: column; }
  .login-left { display: none; } /* hide hero on mobile */
  .login-right { width: 100%; min-height: 100vh; padding: 1.5rem 1rem; }
  .auth-card { padding: 1.5rem 1.2rem; margin: 0; border-radius: 12px; }
  .form-input, .form-input-icon input { font-size: 16px !important; } /* prevents iOS zoom */
  .google-btn { font-size: .8rem; padding: .6rem 1rem; }
}

/* ── PRICING PAGE ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .plans-grid { grid-template-columns: 1fr 1fr !important; }
  .club-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 600px) {
  .plans-grid { grid-template-columns: 1fr !important; }
  .club-grid { grid-template-columns: 1fr !important; }
  .plan-card { margin: 0; }
  .plan-price { font-size: 2.4rem; }
  .compare-table { overflow-x: auto; -webkit-overflow-scrolling: touch; display: block; }
  .compare-table table { min-width: 520px; }
  .pricing-hero h1 { font-size: 2.2rem; }
  .vertical-switch { flex-wrap: wrap; gap: .3rem; }
  .vsw-btn { font-size: .72rem; padding: .3rem .65rem; }
}

/* ── TACTICAL BOARD ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .tb-sidebar { width: 180px; }
}
@media (max-width: 600px) {
  .main { flex-direction: column; }
  html, body { overflow: visible !important; height: auto !important; }
  .tb-sidebar {
    width: 100%; border-right: none; border-bottom: 1px solid var(--bd, #1a2330);
    flex-direction: row; flex-wrap: wrap; padding: .5rem; gap: .4rem;
    overflow-x: auto; max-height: none;
  }
  .tb-field-wrap { min-height: 60vw; }
}

/* ── GAME DAY BUILDER ────────────────────────────────────────── */
@media (max-width: 900px) {
  .gd-layout { flex-direction: column !important; }
  .gd-sidebar { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--bd, #1a2330); max-height: 280px; overflow-y: auto; }
}
@media (max-width: 600px) {
  .gd-col { padding: .75rem !important; }
  .slot-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .player-pill { font-size: .65rem; padding: .25rem .4rem; }
  section { padding: 1rem !important; }
}

/* ── SESSION PLANNER ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .sp-layout { flex-direction: column !important; }
  .sp-sidebar { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--bd, #1a2330); }
  .sp-canvas { padding: .75rem !important; }
  .block-card { padding: .6rem .75rem !important; }
}

/* ── INDEX / LANDING ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-inner { padding: 3rem 1.25rem 2rem; }
  .hero-inner h1 { font-size: 2.6rem; }
  .hero-actions { flex-wrap: wrap; gap: .5rem; }
  .features-grid { grid-template-columns: 1fr !important; }
  .programs-grid { grid-template-columns: 1fr !important; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: block !important; }
}
@media (max-width: 480px) {
  .hero-inner h1 { font-size: 2rem; }
  .hero-sub { font-size: .9rem; }
}
.mobile-menu-btn { display: none; }

/* ── MY SAVES ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page { padding: 1rem .75rem; }
  .items-grid { grid-template-columns: 1fr; }
  .storage-card { flex-wrap: wrap; gap: .75rem; }
  .page-hdr { flex-direction: column; gap: .5rem; }
  .type-tabs { gap: .25rem; }
  .type-tab { font-size: .65rem; padding: .28rem .6rem; }
  .sc-actions { flex-wrap: wrap; gap: .3rem; }
}

/* ── SUCCESS PAGE ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .success-card { padding: 1.5rem 1rem !important; margin: 1rem !important; }
}

/* ── SHARED UTILITY CLASSES ──────────────────────────────────── */
/* Safe scroll areas */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* iOS input zoom prevention — 16px minimum */
@media (max-width: 600px) {
  input, select, textarea { font-size: 16px !important; }
  /* Exception: very small decorative inputs */
  .slot-dur { font-size: 14px !important; }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .plan-mobile-btn, .bar {
    padding-left: max(.6rem, env(safe-area-inset-left));
    padding-right: max(.6rem, env(safe-area-inset-right));
  }
  .plan-mobile-btn { padding-bottom: max(.6rem, env(safe-area-inset-bottom)); }
}

/* Prevent body scroll when modal is open */
body.modal-open { overflow: hidden !important; position: fixed; width: 100%; }

/* ── iOS SELECT STYLING ──────────────────────────────────────── */
@media (max-width: 900px) {
  select,
  .f-select, .form-select, .sort-sel, .slot-dur, .f-input[type="date"], .f-input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23718096'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .65rem center;
    padding-right: 2rem;
  }
  /* Date/time inputs don't need the arrow */
  input[type="date"], input[type="time"] {
    background-image: none;
    padding-right: .65rem;
  }
}
