/* ============================================================
   ChessWorld — Full Responsive CSS  (mobile-first overrides)
   Breakpoints:  xs ≤ 480px  |  sm ≤ 640px  |  md ≤ 768px
   ============================================================ */

/* ── 1. Box-sizing baseline ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* ── 2. Media (images / video) ───────────────────────────── */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* ── 3. iOS zoom-on-focus prevention ─────────────────────── */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ── 4. Disable parallax on mobile (iOS blank-bg bug) ────── */
@media (max-width: 768px) {
    * {
        background-attachment: scroll !important;
    }
}

/* ══════════════════════════════════════════════════════════
   GLOBAL SECTION PADDING  (py-20 = 5rem = 80px is too much)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Tailwind py-20 / py-16 → reduce on mobile */
    .py-20 { padding-top: 40px !important; padding-bottom: 40px !important; }
    .py-16 { padding-top: 32px !important; padding-bottom: 32px !important; }
    .py-12 { padding-top: 24px !important; padding-bottom: 24px !important; }
    .mb-16 { margin-bottom: 32px !important; }
    .mb-20 { margin-bottom: 40px !important; }
    .mt-10 { margin-top: 24px !important; }

    /* Horizontal container padding */
    .container,
    .page-container,
    .coach-detail-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    /* Tailwind px classes */
    .px-4 { padding-left: 16px !important; padding-right: 16px !important; }
}

/* ══════════════════════════════════════════════════════════
   GLOBAL TYPOGRAPHY
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    /* Tailwind text-* scale → clamp fluid sizes */
    .text-6xl, .text-7xl { font-size: clamp(28px, 8vw, 48px) !important; }
    .text-5xl            { font-size: clamp(26px, 7.5vw, 44px) !important; }
    .text-4xl            { font-size: clamp(24px, 7vw, 36px) !important; }
    .text-3xl            { font-size: clamp(22px, 6vw, 30px) !important; }
    .text-2xl            { font-size: clamp(18px, 5.5vw, 24px) !important; }
    /* Raw heading elements */
    h1 { font-size: clamp(24px, 7vw, 40px) !important; }
    h2 { font-size: clamp(22px, 6.5vw, 36px) !important; }
    h3 { font-size: clamp(18px, 5vw, 28px) !important; }
}

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    table:not(.no-scroll-table) {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        width: 100% !important;
    }
}

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .form-grid,
    .form-row {
        grid-template-columns: 1fr !important;
    }
}

/* ══════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Generic modals */
    #checkoutModal > div,
    .modal-inner {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 20px 16px !important;
    }

    /* Push notification modal */
    #push-modal-overlay > div {
        width: 92vw !important;
        padding: 28px 20px !important;
    }
}

/* ══════════════════════════════════════════════════════════
   NAVBAR  (header.php)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .logo-text { font-size: 15px !important; }
    .logo-img  { height: 46px !important; }
}

/* ══════════════════════════════════════════════════════════
   FOOTER  (footer.php)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    footer {
        padding: 40px 16px 20px !important;
    }
    /* Main grid: already uses auto-fit minmax(250px), fine on mobile */
    footer > div > div:first-child {   /* main columns grid */
        gap: 30px !important;
        margin-bottom: 30px !important;
    }
    /* Popular searches — wrap with smaller gap */
    footer a[href] {
        margin-right: 12px !important;
        display: inline-block;
        margin-bottom: 6px;
    }
    /* Trust-badges grid  */
    footer > div > div[style*="grid-template-columns: repeat(auto-fit, minmax(150px"] {
        gap: 16px !important;
    }
}

/* ══════════════════════════════════════════════════════════
   INDEX PAGE — hero offer section
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Drop fixed 600px height so card fits in flow */
    .hero-offer-wrap {
        height: auto !important;
        min-height: 0 !important;
        border-radius: 16px !important;
    }

    /* Gradient overlay change to work on stacked layout */
    .hero-offer-wrap > .absolute.inset-0 {
        background: linear-gradient(180deg,
            rgba(20,15,8,0) 40%,
            rgba(20,15,8,0.82) 100%) !important;
    }

    /* Card: pull out of absolute, full-width at bottom */
    .hero-cta-card {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        border-radius: 0 0 16px 16px !important;
        padding: 24px 20px !important;
        max-height: none !important;
    }

    .hero-cta-card h3 {
        font-size: 22px !important;
    }
    .hero-cta-card p {
        font-size: 14px !important;
    }
}

/* ══════════════════════════════════════════════════════════
   INDEX PAGE — coaching section (white card)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* "From Beginners to Tournament Players" white card inner padding */
    .grid.md\:grid-cols-2 > div[style*="padding: 48px 40px"] {
        padding: 24px 20px !important;
    }
}

/* ══════════════════════════════════════════════════════════
   INDEX/PRODUCTS FAQ SECTION
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .faq-section-wrap {
        height: auto !important;
        min-height: 0 !important;
        padding: 48px 16px !important;
        align-items: flex-start !important;
    }

    .faq-grid-inner {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }

    .faq-grid-inner h2 {
        font-size: 32px !important;
    }
}

/* ══════════════════════════════════════════════════════════
   COACHES PAGE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .coach-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ══════════════════════════════════════════════════════════
   COACH DETAIL PAGE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .coach-hero {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        padding: 24px 16px !important;
    }
    .coach-hero .coach-photo img {
        height: 260px !important;
    }
    .coach-info h1 { font-size: 26px !important; }
    .coach-stats   { gap: 10px !important; }
    .rate-display  { grid-template-columns: 1fr !important; }
    .rates-section { grid-template-columns: 1fr !important; }
    .sessions-section, .availability-grid {
        grid-template-columns: 1fr !important;
    }
    .section       { margin-bottom: 40px !important; }
    .bio-text      { padding: 16px !important; }
    .coach-detail-container { margin: 20px auto !important; padding: 0 16px !important; }
}

/* ══════════════════════════════════════════════════════════
   PRODUCTS PAGE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Product cards on index page */
@media (max-width: 640px) {
    .product-card {
        min-height: auto !important;
    }
}

/* ══════════════════════════════════════════════════════════
   PLAYER / COACH PROFILE PAGES
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .profile-header      { flex-direction: column !important; padding: 20px 16px !important; }
    .profile-photo       { width: 100px !important; height: 100px !important; }
    .profile-stats       { flex-wrap: wrap !important; gap: 12px !important; }
    .sections-container,
    .tab-content.active  { grid-template-columns: 1fr !important; }
    .edit-profile-btn    { top: 12px !important; right: 12px !important; }
}

/* ══════════════════════════════════════════════════════════
   CART PAGE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .cart-item-row   { flex-direction: column !important; align-items: flex-start !important; }
    .cart-item-image { width: 100% !important; height: 180px !important; }
}

/* ══════════════════════════════════════════════════════════
   CHAT PAGE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .chat-sidebar { width: 100% !important; position: relative !important; }
    .chat-layout  { flex-direction: column !important; }
}

/* ══════════════════════════════════════════════════════════
   TOURNAMENTS PAGE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .tournament-grid,
    .tournaments-list { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════════════════════
   BOOKING / SLOTS
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .slot-card    { padding: 16px !important; }
    .booking-grid { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════════════════════
   TOUCH TARGETS
   ══════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
    button, a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
    }
}
