/* ============================================================
   MOBILE NAVIGATION & RESPONSIVE FIX
   Overrides inline styles across all pages
   ============================================================ */

/* Nav actions container (cart + hamburger) - always visible */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ===== DESKTOP (769px+) ===== */
@media (min-width: 769px) {
    .nav-hamburger { display: none !important; }
    .nav-actions {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
    }
    .nav-actions .nav-cart {
        display: block !important;
        position: relative !important;
    }
    .nav-actions .nav-cart svg {
        width: 22px !important;
        height: 22px !important;
        stroke: white !important;
        fill: none !important;
        stroke-width: 1.5 !important;
    }
    .nav-actions .cart-badge {
        position: absolute !important;
        top: -8px !important;
        right: -10px !important;
        background: #c9a96e !important;
        color: #0a0a0a !important;
        font-size: 0.65rem !important;
        font-weight: 700 !important;
        width: 18px !important;
        height: 18px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

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

    /* --- Global overflow prevention --- */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    *, *::before, *::after {
        max-width: 100vw;
    }
    img, video, iframe, svg {
        max-width: 100% !important;
        height: auto;
    }

    /* --- Nav Bar --- */
    .nav {
        padding: 14px 20px !important;
    }
    .nav.scrolled {
        padding: 12px 20px !important;
    }

    /* Logo stays above overlay */
    .nav-logo {
        z-index: 10001 !important;
        position: relative !important;
        font-size: 1.4rem !important;
    }

    /* --- Fullscreen Overlay Menu --- */
    .nav-links {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: #0a0a0a !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 !important;
        z-index: 10000 !important;
        padding: 80px 40px !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.35s ease, visibility 0.35s ease !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .nav-links.open {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Menu links */
    .nav-links a {
        font-size: 1.1rem !important;
        letter-spacing: 4px !important;
        text-transform: uppercase !important;
        color: rgba(255,255,255,0.75) !important;
        padding: 18px 0 !important;
        width: 100% !important;
        max-width: 320px !important;
        text-align: center !important;
        border-bottom: 1px solid rgba(255,255,255,0.06) !important;
        text-decoration: none !important;
        transition: color 0.3s ease !important;
        display: block !important;
        font-weight: 500 !important;
    }

    .nav-links a:last-child {
        border-bottom: none !important;
    }

    .nav-links a:hover,
    .nav-links a:active {
        color: #c9a96e !important;
    }

    /* Remove underline pseudo-element on mobile */
    .nav-links a::after {
        display: none !important;
    }

    /* Hide cart inside nav-links on mobile (shown in nav-actions instead) */
    .nav-links .nav-cart {
        display: none !important;
    }

    /* --- Nav Actions (Cart + Hamburger) --- */
    .nav-actions {
        display: flex !important;
        align-items: center !important;
        gap: 18px !important;
        z-index: 10001 !important;
        position: relative !important;
    }

    .nav-actions .nav-cart {
        display: block !important;
        position: relative !important;
        z-index: 10001 !important;
    }

    .nav-actions .nav-cart svg {
        width: 22px !important;
        height: 22px !important;
        stroke: white !important;
        fill: none !important;
        stroke-width: 1.5 !important;
    }

    .nav-actions .cart-badge {
        position: absolute !important;
        top: -8px !important;
        right: -10px !important;
        background: #c9a96e !important;
        color: #0a0a0a !important;
        font-size: 0.6rem !important;
        font-weight: 700 !important;
        width: 16px !important;
        height: 16px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* --- Hamburger Button --- */
    .nav-hamburger {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        position: relative !important;
        width: 26px !important;
        height: 20px !important;
        gap: 0 !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .nav-hamburger span {
        display: block !important;
        width: 24px !important;
        height: 2px !important;
        background: white !important;
        transition: all 0.3s ease !important;
        transform-origin: center !important;
        position: absolute !important;
        left: 0 !important;
    }

    .nav-hamburger span:nth-child(1) { top: 0; }
    .nav-hamburger span:nth-child(2) { top: 9px; }
    .nav-hamburger span:nth-child(3) { top: 18px; }

    /* X animation when active */
    .nav-hamburger.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg) !important;
    }
    .nav-hamburger.active span:nth-child(2) {
        opacity: 0 !important;
        transform: scaleX(0) !important;
    }
    .nav-hamburger.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg) !important;
    }

    /* --- Body Scroll Lock --- */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    /* ===== PAGE-SPECIFIC MOBILE FIXES ===== */

    /* Hero section */
    .hero-content {
        padding: 0 24px !important;
    }
    .hero-title {
        font-size: 2.6rem !important;
    }
    .hero-sub {
        font-size: 0.9rem !important;
    }
    .hero-btns {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    .btn-primary, .btn-outline {
        width: 260px !important;
        text-align: center !important;
        padding: 14px 32px !important;
    }
    .hero-scroll {
        bottom: 24px !important;
    }

    /* Category cards */
    .cat-section {
        padding: 60px 20px !important;
    }
    .cat-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .cat-card {
        height: 300px !important;
    }
    .cat-card-content {
        padding: 24px !important;
    }
    .cat-card-name {
        font-size: 1.6rem !important;
    }
    .cat-card-desc {
        font-size: 0.82rem !important;
    }

    /* Product grid */
    .products-section,
    .shop-container {
        padding: 40px 16px 60px !important;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .product-card:hover {
        transform: none !important;
    }
    .product-info {
        padding: 10px 12px !important;
    }
    .product-name {
        font-size: 0.82rem !important;
        line-height: 1.3 !important;
    }
    .product-price {
        font-size: 0.9rem !important;
    }
    .product-original-price {
        font-size: 0.75rem !important;
    }
    .product-category {
        font-size: 0.65rem !important;
    }

    /* Shop toolbar */
    .shop-toolbar {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
    }
    .shop-filters {
        width: 100% !important;
        flex-wrap: wrap !important;
    }
    .cat-pills {
        width: 100% !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 8px !important;
    }
    .cat-pill {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* Page hero (sub-pages) */
    .page-hero {
        padding: 100px 20px 50px !important;
    }
    .page-hero h1 {
        font-size: 1.8rem !important;
    }

    /* Page content */
    .page-content {
        padding: 32px 20px !important;
        font-size: 0.9rem !important;
    }
    .page-content h2 {
        font-size: 1.3rem !important;
    }

    /* Features section */
    .features-section {
        padding: 60px 20px !important;
    }
    .features-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
    }
    .feature-item {
        padding: 24px 16px !important;
    }

    /* Newsletter */
    .newsletter-section {
        padding: 60px 20px !important;
    }
    .newsletter-form {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .newsletter-form input,
    .newsletter-form button {
        width: 100% !important;
    }

    /* Parallax banner */
    .parallax-banner {
        height: 40vh !important;
    }
    .parallax-banner-bg {
        background-attachment: scroll !important;
    }

    /* Footer - index.php style */
    .footer {
        padding: 40px 20px 24px !important;
    }
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    .footer-bottom {
        flex-direction: column !important;
        gap: 8px !important;
        text-align: center !important;
    }

    /* Footer - template.php style */
    .site-footer .footer-main {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
        padding: 40px 20px 24px !important;
    }
    .site-footer .footer-bottom {
        padding: 16px 20px !important;
    }

    /* Checkout page */
    .checkout-nav {
        padding: 14px 20px !important;
    }
    .checkout-nav a {
        font-size: 1.3rem !important;
    }
    .checkout-container {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
        padding: 20px 16px 50px !important;
    }
    .form-row {
        grid-template-columns: 1fr !important;
    }
    .order-summary {
        position: static !important;
    }
    .section-title {
        font-size: 1.3rem !important;
    }

    /* Cart page */
    .cart-container {
        padding: 20px 16px 60px !important;
    }
    .cart-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .cart-item {
        grid-template-columns: 80px 1fr !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    .cart-item-img {
        width: 80px !important;
        height: 100px !important;
    }
    .cart-summary {
        position: static !important;
    }

    /* Product detail page */
    .product-page {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        padding: 16px 16px 60px !important;
    }
    .product-detail-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        padding: 20px 16px 60px !important;
    }
    .gallery {
        position: static !important;
    }
    .gallery-main {
        aspect-ratio: 1/1 !important;
        max-height: 400px !important;
    }
    .gallery-main:hover img {
        transform: none !important;
    }
    .gallery-thumbs {
        gap: 8px !important;
    }
    .gallery-thumb {
        width: 60px !important;
        height: 60px !important;
        flex-shrink: 0 !important;
    }
    .details {
        padding: 0 !important;
        overflow: hidden !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    .details-title {
        font-size: 1.5rem !important;
        word-wrap: break-word !important;
    }
    .details-price {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    .cta-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .btn-add-cart, .btn-buy-now {
        width: 100% !important;
        padding: 16px !important;
        font-size: 0.8rem !important;
    }
    .trust-signals {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .product-gallery {
        max-height: 400px !important;
    }
    .product-detail-info {
        padding: 0 !important;
    }
    .product-detail-title {
        font-size: 1.6rem !important;
    }
    .breadcrumb {
        padding: 76px 16px 0 !important;
        font-size: 0.75rem !important;
    }
    .related-section {
        padding: 48px 16px !important;
    }
    .related-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .related-title {
        font-size: 1.4rem !important;
        margin-bottom: 28px !important;
    }
    .desc-toggle {
        font-size: 0.78rem !important;
        padding: 14px 0 !important;
    }
    .desc-content {
        font-size: 0.85rem !important;
    }

    /* Track order page */
    .track-container {
        padding: 20px 16px 60px !important;
    }

    /* Contact form */
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* Section headers */
    .section-header {
        margin-bottom: 40px !important;
    }
    .section-title {
        font-size: 1.8rem !important;
    }

    /* General touch-friendly */
    a, button, .cat-pill, .filter-select {
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
    }
}

/* ===== EXTRA SMALL (480px and below) ===== */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.2rem !important;
    }
    .nav-logo {
        font-size: 1.2rem !important;
    }
    .product-grid {
        gap: 8px !important;
    }
    .product-info {
        padding: 8px 10px !important;
    }
    .product-name {
        font-size: 0.78rem !important;
    }
    .features-grid {
        grid-template-columns: 1fr !important;
    }
    .cat-card {
        height: 260px !important;
    }
    .cat-card-name {
        font-size: 1.3rem !important;
    }
}
