/* 
   Responsive Design Overrides 
   Strictly for resolutions < 1025px
   Preserves Desktop Design 100%
*/

/* =========================================
   1. Laptop (769px - 1024px)
   ========================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95% !important;
        padding: 0 15px !important;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }

    .categories-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .stores-modern-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* =========================================
   2. Tablet (481px - 768px)
   ========================================= */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        max-width: 100% !important;
        padding: 0 20px !important;
    }

    /* Header Adjustments */
    .header-main {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 15px !important;
    }

    .search-box {
        width: 100% !important;
        margin: 10px 0 !important;
        max-width: 100% !important;
    }

    /* Navigation */
    .nav-links {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding-bottom: 5px !important;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch;
    }

    .nav-link {
        padding: 12px 15px !important;
        font-size: 0.9rem !important;
    }

    /* Grids */
    .products-grid,
    .stores-grid,
    .subcategories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .stores-modern-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* =========================================
   3. Mobile (0px - 480px)
   ========================================= */
@media (max-width: 480px) {
    body {
        overflow-x: hidden !important;
    }

    .container {
        padding: 0 15px !important;
        width: 100% !important;
    }

    /* Header Compact Mode */
    .header-main {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px !important;
        gap: 12px !important;
    }

    .logo {
        justify-content: center !important;
        margin-bottom: 5px !important;
    }

    .search-box {
        width: 100% !important;
        margin: 5px 0 15px !important;
        max-width: none !important;
    }

    .user-actions {
        justify-content: space-between !important;
        width: 100% !important;
        background: #f8f9fa;
        padding: 10px;
        border-radius: 8px;
    }

    /* Navigation Scrollable */
    .nav-bar .container {
        padding: 0 !important;
    }

    .nav-links {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding: 0 10px 5px !important;
        gap: 5px !important;
        justify-content: flex-start !important;
    }

    .nav-link {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
        border: 1px solid #eee !important;
        border-radius: 20px !important;
        margin-bottom: 5px !important;
    }

    /* Hero Section */
    .hero {
        height: auto !important;
        min-height: 250px !important;
    }

    .hero-content {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: -50px !important;
        /* Overlap effect */
        margin-bottom: 20px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    }

    .hero h1 {
        font-size: 1.5rem !important;
    }

    /* Grids - 2 Columns for Products (Amazon style), 1 for Stores */
    .products-grid,
    .stores-grid,
    .subcategories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .product-card {
        border-radius: 8px !important;
    }

    .product-image {
        height: 140px !important;
    }

    .product-info {
        padding: 10px !important;
    }

    .product-title {
        font-size: 0.9rem !important;
        height: 2.7em !important;
        /* Limit lines */
        overflow: hidden !important;
        margin-bottom: 5px !important;
    }

    .price {
        font-size: 1rem !important;
    }

    .details-btn {
        padding: 5px 10px !important;
        font-size: 0.75rem !important;
    }

    /* Categories - 2 Columns */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .category-card {
        padding: 15px 10px !important;
    }

    .category-icon {
        font-size: 1.5rem !important;
        margin-bottom: 8px !important;
    }

    .category-card h3 {
        font-size: 0.9rem !important;
    }

    /* Stores - 1 Column prominent */
    .stores-modern-grid {
        grid-template-columns: 1fr !important;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: center !important;
    }

    .footer-col h3::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }

    .footer-col ul li {
        justify-content: center !important;
    }

    /* Modals & Dropdowns */
    .user-menu-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        z-index: 9999 !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
    }

    /* Auth Pages Responsiveness */
    .auth-page-wrapper {
        min-height: auto !important;
        padding: 20px 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .auth-card {
        display: flex !important;
        flex-direction: column !important;
        max-width: 100% !important;
        border-radius: 15px !important;
        background: white !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
        overflow: hidden !important;
    }

    .auth-form-side {
        padding: 30px 20px !important;
        width: 100% !important;
        order: 1 !important;
    }

    .auth-image-side {
        display: none !important; /* Hide image side on mobile for space */
    }

    .logo-area i {
        font-size: 2rem !important;
    }

    .logo-area h2 {
        font-size: 1.4rem !important;
    }

    .form-group {
        margin-bottom: 15px !important;
    }

    .form-control {
        padding: 10px !important;
    }

    .auth-btn {
        padding: 12px !important;
        font-size: 1rem !important;
    }

    .auth-footer {
        margin-top: 25px !important;
        padding-top: 15px !important;
    }
}

/* Tablet view for Auth */
@media (min-width: 481px) and (max-width: 992px) {
    .auth-card {
        max-width: 700px !important;
        display: block !important;
    }
    .auth-image-side {
        display: none !important;
    }
}

/* Base Auth Styles (Desktop & General) */
.auth-page-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.auth-form-side {
    padding: 45px;
}

.auth-image-side {
    background: linear-gradient(135deg, var(--primary-color) 0%, #a29bfe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: white;
    text-align: center;
}

.auth-image-side .image-content img {
    width: 70%;
    max-width: 300px;
    margin: 0 auto 20px;
}

.auth-image-side h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.logo-area {
    text-align: center;
    margin-bottom: 35px;
}

.logo-area i {
    font-size: 2.8rem;
    color: var(--primary-color);
}

.logo-area h2 {
    margin-top: 10px;
    color: #1a202c;
    font-weight: 800;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    transition: 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.pass-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    left: 15px;
    top: 45px;
    cursor: pointer;
    color: #a0aec0;
    transition: 0.3s;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #4a5568;
}

.forgot-link, .login-link, .register-link {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    border-radius: 12px;
}

.auth-footer {
    text-align: center;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #718096;
}

.footer-action {
    margin-top: 10px;
}

.error-text {
    color: #e53e3e;
    font-size: 0.82rem;
    margin-top: 5px;
    display: block;
}


/* =========================================
   Fixes for specific Components
   ========================================= */

/* Single Ad Slider Responsive */
@media (max-width: 768px) {
    .single-ad-slider-container {
        height: 200px !important;
        margin: 10px 0 !important;
    }

    .ad-title {
        font-size: 1.1rem !important;
    }

    .ad-description {
        display: none !important;
        /* Hide description on mobile to save space */
    }

    .ad-overlay {
        padding: 15px !important;
    }
}

/* Store Header Responsive */
@media (max-width: 768px) {
    .store-header {
        height: 150px !important;
    }
}