/* ==========================================================================
   RAFAA - MOBILE & RESPONSIVE STYLES
   ========================================================================== */

/* 1. Large Desktops (Fluid container padding) */
@media (max-width: 1400px) {
    :root {
        --container-pad: 3%;
    }
}

/* 2. Smaller Desktops / Horizontal Tablets (1200px) */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    .hero-title {
        font-size: 4rem;
    }
}

/* 3. Tablets and Large Phones (1024px) */
@media (max-width: 1024px) {
    :root {
        --container-pad: 4%;
        --section-pad: 4rem;
    }

    .hero-title {
        font-size: clamp(2.8rem, 8vw, 4.5rem);
    }

    .promo-grid {
        grid-template-columns: 1fr;
        gap: 4rem;
        padding: 4rem 2rem;
    }

    .shop-layout {
        gap: 2rem;
        grid-template-columns: 240px 1fr;
    }

    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 3.5rem;
    }

    .product-page-wrapper {
        padding-top: 6rem;
    }

    .product-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .gallery-nav {
        display: none !important;
    }
}

/* 4. Small Tablets (900px) */
@media (max-width: 900px) {

    .desktop-only,
    .desktop-only-links {
        display: none !important;
    }

    .mobile-menu {
        display: block;
    }

    .promo-section {
        display: none !important;
    }

    .section-title {
        font-size: 1.7rem;
        white-space: nowrap;
        margin-bottom: 2.5rem !important;
    }

    .popular-picks {
        padding-top: 2.2rem !important;
        padding-bottom: 0.68rem !important;
    }

    .popular-picks .section-title {
        margin-bottom: 1.2rem !important;
    }

    .popular-picks .products-grid {
        margin-top: 0 !important;
    }

    .view-all-container {
        margin-top: 2rem !important;
    }

    /* MINIMALIST PREMIUM SIDE DRAWER (Pure Clean Style) */
    .mobile-nav-links {
        display: flex;
        position: fixed;
        top: 0;
        left: -85%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #0d0c0f !important;
        z-index: 99999 !important;
        flex-direction: column;
        justify-content: flex-start;
        padding: 0;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
    }

    .mobile-nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99998;
        backdrop-filter: blur(2px);
    }

    .mobile-nav-overlay.active {
        display: block;
    }

    .mobile-nav-links.open {
        transform: translateX(100%);
    }

    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem 1rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .mobile-nav-logo {
        font-family: var(--font-serif);
        font-size: 1.4rem;
        color: var(--gold-accent);
        letter-spacing: 0.08em;
        text-transform: uppercase;
        margin: 0;
        line-height: 1;
    }

    .close-mobile-menu {
        align-self: auto;
        padding: 0.4rem;
        color: #fcfcfc !important;
        font-size: 2rem !important;
        cursor: pointer;
        display: block !important;
        background: transparent;
        border: none;
        outline: none;
    }

    .mobile-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .mobile-nav-list li {
        margin-bottom: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        padding: 0 1.5rem;
    }

    .mobile-nav-list li:first-child {
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .mobile-nav-list a {
        font-size: 0.95rem;
        font-family: var(--font-serif);
        color: #fcfcfc !important;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        font-weight: 500;
        display: block;
        padding: 1.5rem 0;
        transition: color 0.3s ease;
    }

    .logout-item a {
        color: #ff4d4d !important;
        opacity: 0.85;
    }

    .mobile-nav-list li:last-child {
        border-bottom: none;
    }

    .navbar {
        grid-template-columns: auto 1fr auto;
        padding: 0.8rem 1rem;
        gap: 0.5rem;
    }

    .categories-section {
        padding-bottom: 0.34rem !important;
    }

    .categories-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 1.5rem;
        margin-top: 0.6rem !important;
    }

    .style-span-2x2,
    .style-span-1x1 {
        grid-column: span 1;
        grid-row: span 1;
    }

    .popular-picks.container {
        padding: 0 1rem !important; /* Restore some padding for title and buttons */
        max-width: 100vw !important;
    }

    .products-grid,
    .popular-picks .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        margin-top: 0 !important;
        padding: 0 !important;
        margin-left: -1rem !important; /* Negative margin to go edge-to-edge */
        margin-right: -1rem !important;
        width: calc(100% + 2rem) !important; /* Adjust width to match negative margins */
    }

    .product-card,
    .product-image-container,
    .product-image,
    .category-card,
    .category-img-wrapper,
    .category-image {
        border-radius: 0 !important;
    }

    .product-card {
        padding-bottom: 1.2rem;
        background-color: transparent !important;
        overflow: hidden;
        width: 100%;
    }

    .product-card:hover .product-image {
        transform: none !important;
    }

    .product-card:hover {
        transform: none !important;
    }

    .product-info {
        padding: 0.8rem 0.4rem 0.4rem 0.4rem !important;
        align-items: flex-start !important;
        text-align: left !important;
        gap: 0.1rem !important;
    }

    .product-title {
        font-size: 0.7rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.1rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100%;
        display: block !important;
        font-weight: 500 !important;
    }

    .product-price-row {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0 !important;
        flex-wrap: nowrap !important;
        overflow: hidden;
        width: 100%;
    }

    .product-old-price {
        font-size: 0.6rem !important;
        color: var(--text-muted) !important;
        text-decoration: line-through;
        white-space: nowrap !important;
        margin: 0 !important;
        padding: 0 !important;
        margin-right: 3px !important; /* Minimal manual space */
    }

    .product-price {
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        color: var(--gold-accent) !important;
        white-space: nowrap !important;
        margin: 0 !important;
        padding: 0 !important;
        margin-right: 3px !important;
    }

    .product-discount {
        font-size: 0.6rem !important;
        color: #ff4d4d !important;
        font-weight: 500;
        white-space: nowrap !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .product-sizes-list {
        font-size: 0.65rem !important;
        color: var(--text-muted) !important;
        letter-spacing: 0.05em;
        margin-top: 0.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .product-badge {
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
        background-color: var(--gold-accent) !important;
        color: #000 !important;
        font-size: 0.6rem !important;
        font-weight: 600 !important;
        padding: 0.3rem 0.6rem !important;
        z-index: 10;
        border-radius: 2px !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .wishlist-heart-btn {
        position: absolute;
        bottom: 12px;
        right: 12px;
        background: none;
        border: none;
        color: #fff;
        z-index: 10;
        padding: 0;
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    }

    .wishlist-heart-btn i {
        width: 22px;
        height: 22px;
    }

    .product-actions {
        display: none !important;
    }

    .mobile-filter-container {
        z-index: 90;
        position: relative;
    }

    /* Show filter bar on mobile, hide sidebar */
    .mobile-filter-bar {
        position: sticky;
        top: 58px;
        z-index: 90;
        display: flex;
        align-items: stretch;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        margin: 0 1rem 0.6rem 1rem;
        overflow: hidden;
        background: rgba(13, 12, 15, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    }

    .mobile-filter-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        padding: 0.85rem 0.5rem;
        font-size: 0.75rem;
        font-weight: 500;
        letter-spacing: 0.15em;
        text-transform: uppercase;
        color: var(--text-main);
        font-family: var(--font-serif);
        background: transparent;
        border: none;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .grid-switcher-mobile {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        padding: 0 1rem;
        flex: none;
    }

    .mobile-filter-divider {
        width: 1px;
        background: rgba(255, 255, 255, 0.15);
        margin: 1rem 0;
        align-self: stretch;
    }

    .grid-btn {
        color: var(--text-muted);
        opacity: 0.5;
        transition: all 0.3s ease;
        padding: 0.4rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .grid-btn.active {
        color: var(--gold-accent);
        opacity: 1;
        transform: scale(1.1);
    }

    .products-grid.grid-cols-1 {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .products-grid.grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
    }

    .products-grid.grid-cols-2 .product-title {
        font-size: 0.85rem;
    }

    .products-grid.grid-cols-2 .product-price {
        font-size: 0.8rem;
    }

    .products-grid.grid-cols-1 .product-title {
        font-size: 1.1rem;
    }

    .products-grid.grid-cols-1 .product-image-container {
        height: 480px;
    }

    .products-grid.grid-cols-4 .product-price {
        font-size: 0.75rem;
    }

    .mobile-filter-btn:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .product-price-row {
        gap: 1rem;
        justify-content: flex-start;
    }

    .shop-layout {
        grid-template-columns: 1fr;
    }

    .shop-sidebar {
        display: none;
    }

    .shop-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .shop-page-title {
        font-size: 2rem;
    }

    .cart-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .cart-summary {
        position: relative;
        top: 0;
    }

    .checkout-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .reviews-tab-container {
        grid-template-columns: 1fr;
    }

    .review-summary-card {
        position: relative;
        top: 0;
    }

    .review-form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-full {
        grid-column: span 1;
    }

}

/* 5. Smartphones & Small Tablets (768px) */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    :root {
        --container-pad: 5%;
        --section-pad: 3.5rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .promo-section {
        padding-top: 2.6rem;
    }

    .promo-grid {
        padding: 1.5rem;
        gap: 2rem;
    }

    .slider-slide {
        min-width: 100%;
        aspect-ratio: 1 / 1.5;
    }

    .promo-title {
        font-size: 2.8rem;
    }

    .footer {
        padding-top: 1.75rem !important;
    }

    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 1.8rem 1.5rem;
        text-align: left;
    }

    .footer-brand,
    .footer-links-group:last-child {
        grid-column: span 2;
        text-align: center;
        align-items: center;
    }

    .footer-links-group {
        align-items: flex-start;
        display: flex;
        flex-direction: column;
    }

    .footer-brand {
        align-items: center;
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
    }

    .social-links {
        justify-content: center;
    }

    .newsletter-form {
        flex-direction: row !important;
        gap: 0.4rem !important;
        width: 100%;
        margin-bottom: 0.75rem !important;
    }

    .newsletter-input {
        width: calc(75% - 0.4rem) !important;
        border-radius: 4px !important;
        height: 45px !important;
        padding: 0 1rem !important;
    }

    .subscribe-btn {
        width: 25% !important;
        border-radius: 4px !important;
        height: 45px !important;
        padding: 0 !important;
        font-size: 0.75rem !important;
    }

    .footer-bottom-inner {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .legal-links {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem 1rem;
        padding-bottom: 0.6rem;
    }

    .legal-links li a {
        white-space: nowrap !important;
        font-size: 0.8rem !important;
    }

    .cart-item-row {
        grid-template-columns: 90px 1fr;
        gap: 1rem;
    }

    .cart-item-actions {
        grid-column: 1 / -1;
        text-align: left;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.5rem;
        padding-top: 1rem;
        border-top: 1px dashed var(--border-color);
    }

    .checkout-container {
        padding-top: 100px;
    }

    .checkout-form-container {
        padding: 1.5rem;
    }

    .checkout-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .checkout-summary-container {
        padding: 1.5rem;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-body-wrapper {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-body {
        padding: 1.5rem 1rem;
    }

    .table-responsive {
        margin-bottom: 2rem;
        width: 100%;
        overflow: hidden !important;
    }

    .size-chart-table {
        table-layout: fixed !important;
        width: 100% !important;
        min-width: 100% !important;
    }

    .size-chart-table th,
    .size-chart-table td {
        padding: 0.4rem 0.1rem !important;
        font-size: 0.6rem !important;
        word-wrap: break-word !important;
        white-space: normal !important;
    }

    .modal-tab {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .navbar {
        grid-template-columns: auto 1fr auto;
        padding: 0.8rem 1rem !important;
        gap: 0.5rem !important;
        max-width: 100vw;
        overflow: hidden;
    }

    .nav-brand {
        font-size: 1.1rem !important;
        white-space: nowrap;
        letter-spacing: normal;
    }

    .header-search-form {
        display: flex;
        align-items: center;
        width: auto;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        padding: 0.1rem 0.3rem;
    }

    .header-search-input {
        display: block;
        width: 60px;
        padding: 0.2rem;
        font-size: 0.8rem;
    }

    .header-search-input:focus {
        width: 100px;
    }

    .icon-group {
        gap: 0.5rem !important;
    }

    .product-page-wrapper {
        padding-top: 0 !important;
        padding-bottom: 2rem;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .product-gallery {
        flex-direction: column-reverse;
        gap: 1rem;
        width: 100%;
        align-items: stretch;
    }

    .product-thumbnails {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        gap: 0.8rem;
        scrollbar-width: none;
    }

    .product-thumbnails .thumb {
        width: 70px;
        flex: 0 0 auto;
        background: transparent;
    }

    .product-main-image {
        width: 100vw;
        max-width: 100vw;
        height: auto;
        background-color: transparent;
        margin-left: 50%;
        margin-right: 0;
        transform: translateX(-50%);
    }

    .product-main-image .product-badge {
        left: 25px !important;
        top: 0.5rem !important;
        transform: scale(1.5);
        transform-origin: left top;
    }

    .image-zoom-container {
        display: block;
        width: 100%;
        height: auto;
        max-height: none !important;
    }

    .product-main-image img,
    .image-zoom-container img {
        width: 100%;
        height: auto;
        max-height: none !important;
        object-fit: cover;
        display: block;
    }

    .product-details {
        width: 100%;
        overflow-x: hidden;
    }

    .product-details .product-title {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        width: 100%;
    }

    .product-price-large {
        font-size: 1.3rem;
    }

    .quantity-selector-row {
        gap: 0.3rem;
    }

    .qty-label {
        font-size: 0.75rem !important;
    }

    .quantity-selector {
        width: 80px !important;
        height: 32px !important;
    }

    .qty-btn {
        width: 25px !important;
        font-size: 0.85rem !important;
    }

    .qty-input {
        width: 30px !important;
        font-size: 0.85rem !important;
    }

    .action-buttons-group {
        width: 100% !important;
    }

    .add-to-cart-btn-large,
    .buy-now-btn {
        height: 38px !important;
        font-size: 0.9rem !important;
        border-radius: 4px !important;
    }

    .container {
        width: 100% !important;
        max-width: 100vw !important;
        padding: 0 1rem !important;
        margin: 0 !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .product-layout {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
        overflow-x: hidden;
    }

    .floating-wishlist-btn {
        top: 0.5rem;
        right: 0.5rem;
        width: 32px;
        height: 32px;
    }

    .floating-wishlist-btn i {
        width: 15px;
        height: 15px;
    }

    .wishlist-hero {
        padding: 8rem 0 3rem;
    }

    .wishlist-remove-overlay {
        opacity: 1;
    }

    .product-price-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .hero {
        padding-top: 100px;
        min-height: 70vh;
        margin-bottom: 1.1rem !important;
    }

    .hero-bg .hero-overlay {
        background: rgba(0, 0, 0, 0.5);
    }

    .hero-image {
        object-position: 80% center;
    }

    .hero-content {
        margin-top: 0;
        max-width: 100%;
        padding-right: 0;
    }

    .hero-title {
        font-size: clamp(2.5rem, 12vw, 3.5rem);
        margin-bottom: 2rem;
    }

    .hero-desc {
        font-size: 1rem;
        margin-bottom: 2.5rem;
        line-height: 1.7;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    }
}

/* 6. Very Small Screens (600px, 500px, 480px) */
@media (max-width: 600px) {
    .modal-branding h3 {
        font-size: 1.1rem;
    }

    .modal-branding p {
        font-size: 0.9rem;
    }

    .modal-notes li {
        font-size: 0.85rem;
        padding-left: 1.2rem;
    }
}

@media (max-width: 500px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .navbar {
        grid-template-columns: auto 1fr auto;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        gap: 0.3rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .header-search-form {
        max-width: 100px;
        padding: 0.1rem 0.4rem;
    }

    .header-search-input {
        width: 40px;
        font-size: 0.75rem;
    }

    .header-search-input:focus {
        width: 60px;
    }

    .icon-group {
        gap: 0.4rem;
    }

    .hero-title {
        font-size: 2.4rem;
    }

    .btn {
        width: 100%;
        padding: 1.2rem;
    }

    .hero-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 1rem;
    }

    .product-actions-row {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .quantity-selector {
        width: 100% !important;
        justify-content: center;
    }

    .add-to-cart-btn-large {
        width: 100% !important;
        padding: 1rem;
    }

    .side-cart-drawer {
        max-width: 100%;
    }

    .cart-drawer-img {
        width: 70px;
        height: 95px;
    }
}