/* ==========================================================
   ALANGKARA — Global Mobile Responsive Stylesheet
   Loaded on every page via includes/navbar.php
   ========================================================== */

/* ── 1. GLOBAL BASE ── */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
body { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
img, video, iframe { max-width: 100%; height: auto; }

/* ── 2. NAVBAR DROPDOWN FIXES ── */
@media (max-width: 767.98px) {
    /* Gemstones mega-dropdown: was 520px inline */
    .category-navbar .dropdown-menu,
    .navbar-modern .dropdown-menu {
        min-width: 0 !important;
        width: 95vw !important;
        max-width: 95vw !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }
    /* Language / currency panel */
    .lc-menu {
        min-width: 0 !important;
        width: 92vw !important;
        right: 0 !important;
        left: auto !important;
    }
    /* Dropdown columns → single column */
    .dropdown-menu .row { flex-direction: column; }
    .dropdown-menu .col-12.col-md-6 { width: 100% !important; max-width: 100% !important; }
}

/* ── 3. HERO SECTIONS (all pages) ── */
@media (max-width: 767px) {
    /* Shared hero class patterns */
    .gem-hero,
    .cat-hero,
    .page-hero,
    .luxury-hero,
    .hero-section,
    .products-header,
    .search-header,
    .section-hero {
        padding: 40px 0 28px !important;
    }
    .gem-hero h1,
    .cat-hero h1,
    .page-hero h1,
    .luxury-hero h1,
    .hero-section h1,
    .products-header h1 {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }
    .gem-hero p,
    .cat-hero p,
    .page-hero p,
    .lead { font-size: .9rem !important; }
}

/* ── 4. TYPOGRAPHY SCALING ── */
@media (max-width: 575px) {
    h1 { font-size: clamp(1.4rem, 6vw, 2rem) !important; }
    h2 { font-size: clamp(1.2rem, 5vw, 1.6rem) !important; }
    h3 { font-size: clamp(1rem, 4.5vw, 1.3rem) !important; }
    h4 { font-size: clamp(.95rem, 4vw, 1.1rem) !important; }
    .section-title  { font-size: clamp(1.3rem, 5vw, 1.8rem) !important; }
    .display-4, .display-5 { font-size: clamp(1.5rem, 6vw, 2.2rem) !important; }
}

/* ── 5. PRODUCT CARD GRIDS ── */
@media (max-width: 575px) {
    /* Force 2 columns for product card rows */
    .row.g-4 > [class*="col-6"],
    .row.g-3 > [class*="col-6"] {
        padding-left: 6px;
        padding-right: 6px;
    }
    .row.g-4 { --bs-gutter-x: 12px; --bs-gutter-y: 12px; }
    .row.g-3 { --bs-gutter-x: 10px; --bs-gutter-y: 10px; }

    /* Product card content tightening */
    .product-card .card-body { padding: .75rem !important; }
    .product-card .card-title { font-size: 1rem !important; }
    .product-card .card-text  { font-size: .85rem !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .price-regular { font-size: 1.1rem !important; }
    .price-sale    { font-size: 1.15rem !important; }
    .price-original{ font-size: .78rem !important; }
    .price-discount-pill { font-size: .65rem !important; padding: 2px 7px !important; }
    .btn-add-cart  { font-size: .82rem !important; padding: 9px 10px !important; }
    .product-card img,
    .product-image-wrapper img { height: 160px !important; }
    .soldout-ribbon { font-size: .55rem !important; width: 120px !important; top: 18px !important; right: -30px !important; }
    .shipping-info { font-size: .78rem !important; }
    .product-badges { top: 8px !important; left: 8px !important; gap: 4px !important; }
    .product-badge  { font-size: .65rem !important; padding: 4px 9px !important; }
}

/* ── 6. PRODUCT DETAIL PAGE (product.php) ── */
@media (max-width: 767px) {
    /* Main image */
    #mainImage { max-height: 320px; object-fit: contain; }

    /* Thumbnails strip → horizontal scroll */
    .thumbnail-container,
    .product-thumbnails {
        display: flex; overflow-x: auto; gap: 8px;
        flex-wrap: nowrap; padding-bottom: 6px;
        scrollbar-width: thin;
    }
    .product-thumbnails img,
    .thumbnail-container img { width: 64px !important; height: 64px !important; flex-shrink: 0; }

    /* Feature items → 2-column grid */
    .product-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .feature-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    .feature-icon { width: 36px !important; height: 36px !important; font-size: .9rem !important; }
    .feature-text strong { font-size: .82rem; }
    .feature-text span   { font-size: .75rem; }

    /* Action buttons */
    .action-buttons,
    .product-actions { flex-direction: column; gap: 10px; }
    .action-buttons .btn,
    .product-actions .btn { width: 100%; }

    /* Quantity selector */
    .quantity-selector,
    .qty-selector { gap: 6px; }
    .qty-btn { width: 36px !important; height: 36px !important; font-size: .9rem !important; }

    /* Ring size selector */
    .ring-size-selector select { max-width: 100% !important; }

    /* Specs table */
    .meta-row  { flex-direction: column; gap: 2px; }
    .meta-label { min-width: unset !important; font-size: .82rem; }
    .meta-value { font-size: .88rem; }

    /* Related products scroll on very small screens */
    .product-title { font-size: 1.4rem !important; }
}
@media (max-width: 575px) {
    .product-features { grid-template-columns: 1fr; }
    #mainImage { max-height: 260px; }
}

/* ── 7. CART PAGE (cart.php) ── */
@media (max-width: 767px) {
    /* Cart item row → stack */
    .cart-item { flex-direction: column !important; }
    .cart-item img { width: 100% !important; max-height: 180px; object-fit: cover; border-radius: 8px; }
    .cart-item .cart-item-details { width: 100% !important; }

    /* Order summary always full width */
    .order-summary { position: static !important; }

    /* Table-like cart → use smaller fonts */
    .cart-table td, .cart-table th { font-size: .82rem; padding: 8px 6px !important; }
    .cart-product-img { width: 60px !important; height: 60px !important; }
}

/* ── 8. INDEX PAGE ── */
@media (max-width: 767px) {
    /* Hero video/image section */
    .hero-slide,
    .hero-banner { min-height: 55vh !important; }
    .hero-content h1 { font-size: clamp(1.4rem, 6vw, 2rem) !important; }
    .hero-content p  { font-size: .88rem !important; }
    .hero-content .btn { padding: 10px 20px !important; font-size: .88rem !important; }

    /* Stats / info strip */
    .stats-section .col-6,
    .trust-badges .col-6 { margin-bottom: 8px; }

    /* Category grid on index */
    .category-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .category-grid-last-two { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .category-image { height: 130px !important; }

    /* Section headings */
    .section-header h2 { font-size: 1.5rem !important; }
    .ornament-line { display: none; }
}
@media (max-width: 575px) {
    .category-grid { gap: 8px !important; }
    .category-grid-last-two { gap: 8px !important; }
    .category-image { height: 110px !important; }
}

/* ── 9. GEMSTONE PAGE ── */
@media (max-width: 767px) {
    /* Browse cards → 3 per row on phones */
    #cat-gemstones .row.g-3 > div,
    .gem-browse-card-wrap { width: 33.33% !important; }

    /* Color cards */
    .gem-color-card { min-height: 100px !important; padding: 18px 8px !important; }
    .gem-color-icon  { font-size: 1.3rem !important; }
    .gem-color-card-name { font-size: .82rem !important; }
    .gem-color-card-count { font-size: .65rem !important; }
    .gem-browse-card { padding: 16px 8px 14px !important; }
    .gem-browse-card-icon { width: 48px !important; height: 48px !important; font-size: 1.1rem !important; }
    .gem-browse-card-name { font-size: .82rem !important; }

    /* Stats strip on categories.php */
    .stats-strip { padding: 20px 16px !important; }
    .stat-num { font-size: 1.5rem !important; }

    /* Browse section title */
    .browse-section-title { font-size: 1.3rem !important; }
    .section-gem-title { font-size: 1.1rem !important; }
}
@media (max-width: 575px) {
    /* Browse cards → 2 per row on very small phones */
    .col-6.col-sm-4.col-md-3.col-lg-2 { width: 50% !important; }
}

/* ── 10. CATEGORIES PAGE ── */
@media (max-width: 575px) {
    .cat-card-img-wrap { height: 150px !important; }
    .cat-featured-card .cat-card-img-wrap { height: 180px !important; }
    .cat-card-name { font-size: .95rem !important; }
    .cat-card-sub  { font-size: .72rem !important; }
    .cat-card-body { padding: 12px 14px 14px !important; }
    .quick-links { gap: 6px !important; padding: 12px 16px !important; }
    .quick-link-btn { font-size: .72rem !important; padding: 5px 10px !important; }
}

/* ── 11. LOGIN / SIGNUP PAGES ── */
@media (max-width: 575px) {
    .auth-card,
    .login-card,
    .signup-card { padding: 1.5rem 1.2rem !important; margin: 0 8px !important; }
    .auth-card h2,
    .login-header h2,
    .signup-header h2 { font-size: 1.4rem !important; }
    .form-control { font-size: .9rem !important; }
    .btn-auth,
    .btn-login,
    .btn-signup { padding: 11px 16px !important; font-size: .95rem !important; }
}

/* ── 12. CONTACT PAGE ── */
@media (max-width: 767px) {
    .contact-info-card { margin-bottom: 20px; }
    .contact-map { height: 250px !important; }
    .search-input { width: 100% !important; max-width: 100% !important; }
    .search-form  { width: 100% !important; }
}

/* ── 13. ACCOUNT / ORDERS PAGES ── */
@media (max-width: 767px) {
    .account-sidebar { margin-bottom: 20px; }
    .order-card      { padding: 14px !important; }
    .order-item-img  { width: 56px !important; height: 56px !important; }
}

/* ── 14. ABOUT / BLOG / STATIC PAGES ── */
@media (max-width: 767px) {
    .blog-card-img { height: 180px !important; }
    .team-member img { width: 100px !important; height: 100px !important; }
    .policy-card { padding: 20px 16px !important; }
    .policy-title { font-size: 1.6rem !important; }
    .policy-list li { font-size: .88rem !important; }
}

/* ── 15. SALE / NEW ARRIVALS PAGES ── */
@media (max-width: 575px) {
    .sale-badge,
    .new-badge { font-size: .65rem !important; padding: 4px 9px !important; }
}

/* ── 16. SEARCH PAGE ── */
@media (max-width: 767px) {
    .search-results-header { flex-direction: column; gap: 10px; align-items: flex-start; }
    .sort-bar { width: 100% !important; }
}

/* ── 17. MODALS & OVERLAYS ── */
@media (max-width: 575px) {
    .modal-dialog { margin: 8px !important; }
    .modal-body   { padding: 1rem !important; }
}

/* ── 18. FLOATING BUTTONS ── */
@media (max-width: 767px) {
    .floating-whatsapp { bottom: 80px !important; right: 16px !important; }
    .floating-whatsapp a { width: 50px !important; height: 50px !important; font-size: 22px !important; }
    .back-to-top { bottom: 90px !important; right: 14px !important; width: 40px !important; height: 40px !important; font-size: 14px !important; }
}

/* ── 19. TABLES ── */
@media (max-width: 767px) {
    .table-responsive-stack thead { display: none; }
    .table-responsive-stack tr    { display: block; border-bottom: 1px solid #dee2e6; padding: 8px 0; }
    .table-responsive-stack td    { display: block; text-align: right; padding: 4px 8px; }
    .table-responsive-stack td::before { content: attr(data-label); float: left; font-weight: 600; color: #6c757d; }
    /* Shrink normal tables */
    .table td, .table th { font-size: .82rem !important; padding: 8px 6px !important; }
    .table-sm td, .table-sm th { font-size: .78rem !important; }
}

/* ── 20. FOOTER ── */
@media (max-width: 767px) {
    footer .row > div { margin-bottom: 20px; }
    footer h5, footer h6 { font-size: 1rem !important; }
    footer p, footer a  { font-size: .83rem !important; }
    .footer-social a { width: 34px !important; height: 34px !important; font-size: 14px !important; }
    .payment-methods img { height: 22px !important; }
}

/* ── 21. UTILITIES ── */
@media (max-width: 575px) {
    .d-xs-none { display: none !important; }
    .text-xs-center { text-align: center !important; }
    .w-xs-100 { width: 100% !important; }
    .gap-xs-2 { gap: 8px !important; }
    /* Badge & pill text shrink */
    .badge { font-size: .7rem !important; }
    .btn   { font-size: .88rem; }
    .btn-sm { font-size: .78rem !important; }
    /* Reduce section padding globally */
    section { padding: 40px 0 !important; }
    .py-5   { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .py-4   { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
}

/* ── 22. TOUCH TARGETS ── */
@media (max-width: 767px) {
    a, button, [role="button"], input[type="submit"],
    input[type="button"], select {
        -webkit-tap-highlight-color: transparent;
    }
    /* Ensure minimum 44px touch target */
    .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .nav-link { min-height: 44px; display: flex !important; align-items: center; }
}

/* ── 23. SAFE AREA (iPhone notch) ── */
@supports (padding: max(0px)) {
    @media (max-width: 767px) {
        .mobile-bottom-nav { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
        body { padding-left:  max(0px, env(safe-area-inset-left));
               padding-right: max(0px, env(safe-area-inset-right)); }
    }
}
