/* Mobile Specific Styles */

/* Responsive Utilities & Base Styles */
.d-md-none {
    display: none !important;
}

.d-none {
    display: none !important;
}

@media (min-width: 769px) {
    .d-md-block {
        display: block !important;
    }

    .d-md-flex {
        display: flex !important;
    }
}

.side-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.side-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1001;
    transition: left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.side-drawer.open {
    left: 0;
}

.side-drawer-overlay.open {
    display: block;
    opacity: 1;
}

.drawer-profile {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.drawer-profile img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.drawer-links a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
    color: var(--dark-text);
    font-size: 0.95rem;
}

/* Base overrides */
@media (max-width: 992px) {
    .container {
        padding: 0 15px;
    }

    .hero-section {
        padding: 30px 15px;
        min-height: 250px;
        margin: 15px;
        width: auto;
        border-radius: var(--radius-md);
        background: linear-gradient(to right, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 100%), url('../images/banner.png') no-repeat 65% center/cover !important;
    }

    .hero-content {
        padding: 0;
    }

    .hero-content h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
        color: #ffffff;
    }

    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 20px;
        color: #f0f0f0;
    }

    .hero-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
        width: 100%;
    }

    .hero-buttons .btn {
        width: auto;
        min-width: 150px;
        text-align: center;
        font-weight: 700;
        letter-spacing: 0.5px;
    }
    
    .hero-buttons .btn-primary {
        background-color: #FFFFFF;
        color: #111111;
        border: none;
        transition: all 0.3s ease;
    }
    
    .hero-buttons .btn-primary:hover {
        background-color: #111111;
        color: #FFFFFF;
    }
    
    .hero-buttons .hero-btn {
        background-color: transparent;
        border: 2px solid #FFFFFF;
        color: #FFFFFF;
        font-weight: 700;
        transition: all 0.3s ease;
    }
    
    .hero-buttons .hero-btn:hover {
        background-color: #FFFFFF;
        color: #111111;
    }

    .product-grid,
    .collections-grid,
    .features-grid,
    .brand-carousel {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    /* Responsive Utility Overrides */
    .d-md-none {
        display: block !important;
    }

    div.mobile-header-actions.d-md-none,
    div.mobile-header-left.d-md-none,
    div.bottom-nav.d-md-none {
        display: flex !important;
    }

    .d-md-block {
        display: none !important;
    }

    .d-md-flex {
        display: none !important;
    }

    /* Hide Desktop Elements */
    .top-bar,
    .main-nav,
    .header-actions {
        display: none !important;
    }

    /* Header Adjustments */
    .header-main {
        padding: 15px 0;
        justify-content: center;
        position: relative;
    }

    .header-main .logo img {
        height: 40px !important;
    }

    .search-container {
        display: none !important;
        /* Hide default search bar on mobile, could add a search icon instead */
    }

    /* Mobile Header Icons */
    .mobile-header-actions {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        gap: 15px;
        align-items: center;
    }

    .mobile-header-left {
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        gap: 15px;
        align-items: center;
    }

    .mobile-header-icon {
        font-size: 1.2rem;
        color: var(--dark-text);
        position: relative;
    }

    /* Bottom Navigation Bar */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        display: flex;
        justify-content: space-around;
        padding: 10px 0;
        border-top: 1px solid var(--border-color);
        z-index: 999;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 0.7rem;
        color: var(--light-text);
        text-decoration: none;
    }

    .bottom-nav-item.active {
        color: var(--primary-red);
    }

    .bottom-nav-item i {
        font-size: 1.2rem;
    }

    /* Body padding for bottom nav */
    body {
        padding-bottom: 60px;
    }

    /* Layout Grids */
    .product-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 15px;
        -webkit-overflow-scrolling: touch;
        gap: 15px;
    }
    
    .product-grid > .product-card, 
    .product-grid > div {
        min-width: 260px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    
    /* Hide scrollbar for a cleaner look while maintaining functionality */
    .product-grid::-webkit-scrollbar {
        display: none;
    }
    .product-grid {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .categories-sidebar {
        display: none !important;
    }

    .categories-main>div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px;
    }

    .categories-main>div:first-child>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .features-grid {
        grid-template-columns: 1fr !important;
    }

    .main-footer {
        padding-top: 30px;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px 15px;
    }

    .footer-col.brand-col,
    .footer-col:last-child {
        grid-column: span 2;
    }

    .footer-col h4 {
        margin-bottom: 10px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .newsletter-content {
        flex-direction: column;
        text-align: center;
    }

    .newsletter-form {
        min-width: 100%;
        flex-direction: column;
    }

    .newsletter-form button {
        width: 100%;
    }

    /* Account & Checkout */
    .account-layout {
        flex-direction: column !important;
    }

    .account-sidebar {
        width: 100% !important;
        margin-bottom: 20px;
    }

    .cart-layout {
        grid-template-columns: 1fr !important;
    }

    .checkout-layout {
        grid-template-columns: 1fr !important;
    }

    .checkout-progress {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
    }

    .checkout-progress .step-line {
        flex: 1 !important;
        width: auto !important;
        height: 2px !important;
        min-width: 20px !important;
    }

    .cart-item {
        flex-direction: row;
        align-items: flex-start !important;
        gap: 15px;
    }

    .cart-item-img {
        width: 100px !important;
        height: 125px !important;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .wishlist-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .wishlist-card {
        display: grid;
        grid-template-columns: 100px 1fr;
        grid-template-areas:
            "img details"
            "btn btn";
        gap: 15px;
        align-items: flex-start;
        text-align: left;
    }

    .wishlist-card .product-img-wrapper {
        grid-area: img;
        height: 125px;
        margin-bottom: 0;
    }

    .wishlist-card .product-info {
        grid-area: details;
        padding-top: 5px;
    }

    .wishlist-card .btn-full {
        grid-area: btn;
    }

    /* Modals & Popups */
    #addressModal>div {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        padding: 20px !important;
    }

    /* Misc */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
    }

    body {
        overflow-wrap: break-word;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .category-grid {
        justify-content: flex-start;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
        scrollbar-width: none;
    }

    .category-grid::-webkit-scrollbar {
        display: none;
    }

    .brand-carousel {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 20px;
        justify-content: flex-start;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
        scrollbar-width: none;
    }

    .brand-carousel::-webkit-scrollbar {
        display: none;
    }

    .brand-card {
        flex: 0 0 200px;
        max-width: 200px;
    }

    /* Product Details */
    .product-details-container,
    .product-details-container.new-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    .product-gallery-new {
        flex-direction: column-reverse !important;
        gap: 15px !important;
    }

    .thumbnail-list-vertical {
        flex-direction: row !important;
        overflow-x: auto !important;
        width: 100% !important;
        height: auto !important;
    }

    .thumbnail-list-vertical .thumbnail {
        flex: 0 0 70px !important;
        width: 70px !important;
        height: 90px !important;
    }

    .main-image-wrapper {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 3/4 !important;
    }

    .product-info-new {
        padding: 0 !important;
    }

    /* Fixed Bottom Action Bar for Product */
    .product-actions-fixed-mobile {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        padding: 10px 15px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        gap: 10px;
    }

    /* Login & Signup form container */
    .container>div[style*="display: flex;"] {
        flex-direction: column-reverse !important;
        min-height: auto !important;
    }

    .container>div[style*="display: flex;"]>div {
        padding: 40px 20px !important;
    }
}