/* =============================================================
 * tema/css/responsive.css  —  P3 mobile/tablet/desktop fixes
 *
 * Loaded AFTER style.css and cls-fix.css so the cascade lets us
 * override without touching the 110 KB legacy CSS.
 *
 * Breakpoint strategy:
 *   <480 small phone     480–767 phone     768–1023 tablet
 *   1024–1399 laptop     ≥1400 desktop
 *
 * Audit anchors (Phase 1 findings):
 *   - WhatsApp float (.whatsapp-float) overlaps mobile bottom nav
 *   - cls-fix.css 991 vs 768 header conflict
 *   - kategoridetay product card fixed 220px image
 *   - Touch targets <44px on mobile bottom nav
 *   - Tablet (768–1023) had virtually no rules
 * ============================================================= */


/* ---------- 1. WhatsApp float button (z-index + position) ---- */
/* On desktop keep existing style (bottom:30px / left:30px / z:999).
   On mobile lift it above the bottom nav (z:9999) so it remains
   reachable without overlapping nav icons.                       */
@media (max-width: 991px) {
    .whatsapp-float {
        bottom: 80px !important;        /* clear bottom nav (60–70 px) */
        left: auto !important;
        right: 16px !important;         /* right-side feels more thumb-friendly */
        padding: 10px 14px !important;
        font-size: 13px !important;
        z-index: 998 !important;        /* below nav (9999) but above content */
    }
}
@media (max-width: 480px) {
    .whatsapp-float {
        bottom: 78px !important;
        right: 12px !important;
        padding: 8px 12px !important;
        font-size: 0 !important;        /* hide label, show only icon */
        gap: 0 !important;
    }
    .whatsapp-float i {
        font-size: 22px !important;
        margin: 0 !important;
    }
    .whatsapp-float span { display: none !important; }
}


/* ---------- 2. cls-fix.css header conflict (991 vs 768) ------ */
/* Original cls-fix.css line 232-238: forces .mid-header { height:140px }
   at 768px while line 179 sets height:auto at 991px. Result is jank in
   the 768–991 window. Normalize: min-height (not fixed height).       */
@media (max-width: 991px) {
    .mid-header,
    .header-middle,
    .header-main {
        height: auto !important;
        min-height: 56px;
    }
}


/* ---------- 3. Product card image: aspect-ratio not fixed px - */
/* kategoridetay.php inline CSS used .product-image img{height:220px}
   which overflows narrow phones. aspect-ratio + object-fit:cover keeps
   the square crop responsive.                                          */
.product-image,
.modern-card-img-container,
.product-card-min-image {
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
}
.product-image img,
.modern-card-img-container img,
.modern-card-img,
.product-card-min-image img,
.product-card-min > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}


/* ---------- 4. Bottom-nav touch targets (≥48 px) ------------- */
.mobile-bottom-nav .mobile-nav-item,
.bottom-nav-item {
    min-height: 48px !important;
    min-width: 48px !important;
    padding: 6px 4px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.cart-badge-mobile,
.cart-circle .badge {
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    font-size: 11px;
    border-radius: 11px;
}


/* ---------- 5. Hero / slider responsive height -------------- */
.hero-swiper,
.hero-section,
.main-slider {
    aspect-ratio: 21 / 9;
    height: auto !important;
    max-height: 600px;
}
@media (max-width: 991px) {
    .hero-swiper,
    .hero-section,
    .main-slider {
        aspect-ratio: 16 / 9;
        max-height: 420px;
    }
}
@media (max-width: 575px) {
    .hero-swiper,
    .hero-section,
    .main-slider {
        aspect-ratio: 4 / 3;
        max-height: 280px;
    }
}


/* ---------- 6. Grid breakpoints (1-2-3-4 columns) ----------- */
/* Replaces ambiguous col-6 col-md-4 col-lg-4 with a saner ladder.
   We only target containers that have the .pcols-* helper or are
   plain Bootstrap col-X-* siblings on category pages.            */
@media (max-width: 575px) {
    .pcols-xs-2 > [class^="col-"] { flex: 0 0 50%; max-width: 50%; }
    .product-grid > [class^="col-"] { flex: 0 0 50%; max-width: 50%; }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .product-grid > [class^="col-"] { flex: 0 0 50%; max-width: 50%; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
    .product-grid > [class^="col-"] { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .pcols-md-3 > [class^="col-"] { flex: 0 0 33.3333%; max-width: 33.3333%; }
}
@media (min-width: 1024px) {
    .product-grid > [class^="col-"] { flex: 0 0 25%; max-width: 25%; }
    .pcols-lg-3 > [class^="col-"] { flex: 0 0 25%; max-width: 25%; }
}


/* ---------- 7. Tablet block (768–1023) — was uncovered ------- */
@media (min-width: 768px) and (max-width: 1023.98px) {
    /* Container: full width, less padding waste */
    .container-fluid,
    .container { padding-left: 16px !important; padding-right: 16px !important; }

    /* Header search should claim full width */
    .header-search,
    .ps-search-input { max-width: 100% !important; width: 100% !important; }

    /* Sidebar filter slides as drawer on tablet too */
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        height: 100vh;
        width: 320px;
        background: #fff;
        z-index: 10001;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }
    .filter-sidebar.open { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10000;
    }
    .sidebar-overlay.open { display: block; }

    /* Product detail two-column → still side-by-side at tablet */
    .product-gallery,
    .product-info { flex: 0 0 50%; max-width: 50%; }

    /* Cart summary stacks below items, full width */
    .cart-container-right { margin-left: 0 !important; width: 100% !important; }

    /* Footer columns: 2 instead of 1 or 4 */
    .footer-col { flex: 0 0 50%; max-width: 50%; margin-bottom: 24px; }

    /* Larger touch targets on tablet nav */
    .navbar .nav-link { padding: 12px 16px; }

    /* Buttons sized for finger-tap */
    .btn { min-height: 44px; }

    /* Headings scale */
    h1, .page-title { font-size: 26px; line-height: 1.3; }
    h2 { font-size: 22px; }
}


/* ---------- 8. Phone block (<768) — touch + spacing --------- */
@media (max-width: 767.98px) {
    body { font-size: 15px; line-height: 1.55; }
    .btn, .submit-btn { min-height: 44px; padding: 10px 16px; }
    .form-control, input[type="text"], input[type="email"],
    input[type="tel"], input[type="password"], textarea {
        min-height: 44px;
        font-size: 16px;   /* iOS auto-zoom guard */
    }
    .product-card-min-title { white-space: normal; height: auto; }
    /* Reduce excessive vertical padding from desktop hero */
    .page-top, .page-header-6 { padding: 16px 0 !important; }
    /* Cart actions stack */
    .cart-container-left,
    .cart-container-right { width: 100% !important; float: none !important; margin-left: 0 !important; }
    /* Prevent horizontal scroll from over-wide tables */
    .table-responsive-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Safe area for notched devices */
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
    }
}


/* ---------- 9. Small phone (<480) — micro adjustments -------- */
@media (max-width: 479.98px) {
    .container, .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }
    .product-card-min-title { font-size: 12px; padding: 0 6px; }
    .product-card-min-price1,
    .product-card-min-price2 { font-size: 13px; }
    .badge { width: auto !important; padding: 8px 10px !important; }
}


/* ---------- 10. Large desktop (≥1400) — content max-width ---- */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
    .container-fluid { max-width: 1600px; margin-left: auto; margin-right: auto; }
}


/* ---------- 11. Prevent horizontal overflow (defense) -------- */
html, body { overflow-x: hidden; max-width: 100vw; }
img, video, iframe { max-width: 100%; height: auto; }

/* ---------- 12. Mobile başlık taşma fix (Mart 2026) ---------- */
@media (max-width: 575.98px) {
    /* Blog / Kampanya / Elementor sayfalarında başlıklar ekran kenarına yapışmasın */
    .elementor-heading-title,
    .section-title,
    .page-title,
    .c-title,
    h1, h2, h3 {
        padding-left: 12px !important;
        padding-right: 12px !important;
        word-break: break-word;
        overflow-wrap: anywhere;
        max-width: 100%;
        box-sizing: border-box;
    }
    /* Çok büyük h3 başlıkları küçült */
    .section-title, .c-title { font-size: 22px !important; line-height: 1.25; }
    /* Elementor blog container default 100% padding değildi */
    .elementor-widget-container { padding-left: 0; padding-right: 0; }
}
