/* Mobile Responsive Design - Enhanced for oraimo-style layout */
/* This file enhances the existing mobile design for better responsiveness */

/* ===== MOBILE-FIRST APPROACH ===== */

/* Base mobile styles (up to 768px) */
@media (max-width: 768px) {
    /* Container adjustments */
    .store-main {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    /* Enhanced Product Cards for Mobile */
    .product-card {
        width: 280px;
        margin: 0 auto;
    }
    
    .product-image {
        height: 200px;
    }
    
    .product-content {
        padding: 16px;
    }
    
    .product-title {
        font-size: 14px;
        min-height: 38px;
    }
    
    .product-price .current-price {
        font-size: 16px;
    }
    
    .product-price .original-price {
        font-size: 11px;
    }
    
    .product-badge {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .stock-badge {
        padding: 4px 8px;
        font-size: 9px;
    }
    
    /* Main content adjustments */
    .store-main {
        padding-top: 20px; /* Reduced padding since header is not fixed */
        padding-bottom: 20px; /* Reduced padding since no bottom navigation */
    }
    
    /* Category scroll optimization */
    .category-scroll-container {
        margin: 1rem 0;
        padding: 0;
    }
    
    .category-scroll {
        display: flex;
        overflow-x: auto;
        gap: 0.75rem;
        padding: 0.5rem 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .category-scroll::-webkit-scrollbar {
        display: none;
    }
    
    .category-card {
        flex: 0 0 120px;
        min-height: 100px;
        padding: 0.75rem;
        border-radius: 0.75rem;
        background: var(--white);
        border: 1px solid var(--gray-200);
        cursor: pointer;
        transition: all 0.2s ease;
        scroll-snap-align: start;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .category-card.active {
        background: var(--primary-color);
        color: var(--white);
        border-color: var(--primary-color);
    }
    
    .category-card-image {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0.5rem;
        background: var(--gray-100);
    }
    
    .category-card.active .category-card-image {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .category-card-label {
        font-size: 0.75rem;
        font-weight: 500;
        text-align: center;
        line-height: 1.2;
    }
    
    /* Search and sort section mobile optimization */
    .search-sort-section {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
        border-bottom: 1px solid var(--gray-200);
        margin-bottom: 1rem;
        background: var(--white);
        border-radius: 1rem;
        padding: 1.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .search-sort-section {
            gap: 0.75rem;
            padding: 1rem;
            margin-bottom: 0.75rem;
        }
    }
    
    .search-container {
        width: 100%;
        position: relative;
    }
    
    .search-input {
        width: 100%;
        padding: 1rem 1.25rem;
        padding-right: 3.5rem;
        border: 2px solid var(--gray-200);
        border-radius: 1rem;
        font-size: 1rem;
        background: var(--white);
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .search-input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .search-btn {
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--gray-500);
        padding: 0.5rem;
        cursor: pointer;
    }
    
    .sort-container {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }
    
    .sort-select {
        flex: 1;
        padding: 1rem 1.25rem;
        border: 2px solid var(--gray-200);
        border-radius: 1rem;
        font-size: 1rem;
        background: var(--white);
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .sort-select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .view-options {
        display: flex;
        gap: 0.5rem;
    }
    
    .view-btn {
        padding: 1rem;
        border: 2px solid var(--gray-200);
        background: var(--white);
        border-radius: 0.75rem;
        cursor: pointer;
        transition: all 0.2s ease;
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .view-btn:hover {
        border-color: var(--gray-300);
        background: var(--gray-50);
        transform: translateY(-1px);
    }
    
    .view-btn.active {
        background: var(--primary-color);
        color: var(--white);
        border-color: var(--primary-color);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* Products section mobile optimization */
    .products-section {
        margin: 0;
        padding: 0;
    }
    
    .section-header {
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--gray-200);
        margin-bottom: 0.5rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 0.25rem;
    }
    
    .section-subtitle {
        font-size: 0.875rem;
        color: var(--gray-600);
        margin-bottom: 0.5rem;
    }
    
    .results-info {
        font-size: 0.875rem;
        color: var(--gray-600);
    }
    
    /* Products grid mobile optimization */
    .products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1.5rem 0;
    }
    
    /* Featured products carousel mobile optimization - Oraimo Style */
    .product-showcase-grid {
        scroll-snap-type: x mandatory;
        scroll-padding: 0 0.5rem;
        gap: 0.75rem; /* Reduced gap for more compact feel */
        padding: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .product-showcase-grid::-webkit-scrollbar {
        display: none;
    }
    
    .product-showcase-grid .product-card {
        scroll-snap-align: center;
        flex: 0 0 240px; /* Reduced from 280px */
        max-width: 240px;
        min-height: 300px; /* Significantly reduced from 380px */
        transition: transform 0.2s ease;
        border-radius: 0.75rem; /* Smaller radius */
    }
    
    .product-showcase-grid .product-card:active {
        transform: scale(0.98);
    }
    
    /* Carousel indicator mobile styling */
    .carousel-indicator {
        margin: 1.5rem 1rem 0 1rem;
        padding: 0.75rem;
        max-width: 280px;
    }
    
    .indicator-text {
        font-size: 0.8rem;
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .products-grid {
            gap: 0.75rem;
            padding: 1rem 0;
        }
        
        /* Enhanced Product Cards for Small Mobile */
        .product-card {
            width: 260px;
        }
        
        .product-image {
            height: 180px;
        }
        
        .product-content {
            padding: 12px;
        }
        
        .product-title {
            font-size: 13px;
            min-height: 36px;
        }
        
        .product-price .current-price {
            font-size: 15px;
        }
        
        .product-price .original-price {
            font-size: 10px;
        }
        
        .product-badge {
            padding: 3px 6px;
            font-size: 9px;
        }
        
        .stock-badge {
            padding: 3px 6px;
            font-size: 8px;
        }
    }
    
    /* Product cards mobile optimization - Oraimo Style Compact */
    .product-card {
        min-height: 280px; /* Reduced from 340px */
        border-radius: 0.75rem; /* Smaller radius */
        background: var(--white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* Lighter shadow */
        overflow: hidden;
        position: relative;
        transition: all 0.3s ease;
        border: 1px solid var(--gray-100);
        margin-bottom: 0.5rem;
    }
    
    .product-card:hover {
        transform: translateY(-2px); /* Reduced hover effect */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-color: var(--primary);
    }
    
    .product-image {
        height: 120px; /* Reduced from 160px */
        position: relative;
        overflow: hidden;
        background: var(--gray-50);
    }
    
    .product-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        transition: transform 0.3s ease;
    }
    
    .product-content {
        padding: 0.75rem; /* Reduced from 1.25rem */
        display: flex;
        flex-direction: column;
        gap: 0.5rem; /* Reduced gap */
    }
    
    /* Hide product features on mobile for compactness */
    .product-features {
        display: none;
    }
    
    /* Hide product description on mobile */
    .product-description {
        display: none;
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .product-content {
            padding: 0.6rem; /* Even more compact */
            gap: 0.4rem;
        }
    }
    
    .product-title {
        font-size: 0.85rem; /* Reduced from 1rem */
        font-weight: 600; /* Reduced from 700 */
        line-height: 1.3; /* Tighter line height */
        color: var(--gray-900);
        margin: 0 0 0.25rem 0; /* Reduced margin */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 2.2em; /* Reduced min-height */
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .product-title {
            font-size: 0.8rem;
            min-height: 2em;
        }
    }
    
    /* Mobile price styling - Compact like Oraimo */
    .product-price {
        margin-bottom: 0.5rem;
    }
    
    .current-price {
        font-size: 1rem; /* Reduced size */
        font-weight: 700;
        color: var(--primary);
    }
    
    .original-price {
        font-size: 0.75rem;
        color: var(--gray-500);
        text-decoration: line-through;
    }
    
    .discount-percentage {
        font-size: 0.7rem;
        background: var(--red-100);
        color: var(--red-600);
        padding: 0.1rem 0.3rem;
        border-radius: 0.25rem;
        margin-left: 0.25rem;
    }
    
    /* Mobile actions - Single button like Oraimo */
    .product-actions {
        gap: 0.5rem;
    }
    
    .btn-primary {
        padding: 0.5rem 0.75rem; /* Reduced padding */
        font-size: 0.75rem; /* Smaller font */
        min-height: 36px; /* Reduced height */
        border-radius: 0.5rem;
        width: 100%;
    }
    
    .btn-secondary {
        display: none; /* Hide secondary button on mobile */
    }
    
    /* Hide badges on mobile for cleaner look */
    .product-badges {
        display: none;
    }
    
    .stock-badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.25rem;
        bottom: 0.25rem;
        left: 0.25rem;
    }
    
    /* Very small screens */
    @media (max-width: 480px) {
        .current-price {
            font-size: 0.9rem;
        }
        
        .btn-primary {
            padding: 0.4rem 0.6rem;
            font-size: 0.7rem;
            min-height: 32px;
        }
    }
    

    
    .product-features {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin: 0.5rem 0;
    }
    
    .feature-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 0.875rem;
        color: var(--gray-600);
        padding: 0.25rem 0;
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .product-features {
            gap: 0.5rem;
            margin: 0.25rem 0;
        }
        
        .feature-item {
            font-size: 0.8rem;
            gap: 0.5rem;
        }
    }
    
    .feature-icon {
        width: 14px;
        height: 14px;
        color: var(--gray-500);
        flex-shrink: 0;
    }
    
    .product-price {
        display: flex;
        align-items: baseline;
        gap: 0.75rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
    }
    
    .current-price {
        font-size: 1.25rem;
        font-weight: 800;
        color: var(--primary);
    }
    
    .original-price {
        font-size: 0.875rem;
        color: var(--gray-500);
        text-decoration: line-through;
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .product-price {
            gap: 0.5rem;
            margin-top: 0.25rem;
        }
        
        .current-price {
            font-size: 1.125rem;
        }
        
        .original-price {
            font-size: 0.8rem;
        }
    }
    
    .discount-percentage {
        font-size: 0.625rem;
        color: #dc2626;
        font-weight: 600;
        background: #fef2f2;
        padding: 0.125rem 0.375rem;
        border-radius: 0.25rem;
    }
    
    /* Action buttons mobile optimization */
    .product-actions {
        display: flex;
        gap: 0.75rem;
        margin-top: auto;
        opacity: 1;
        transform: translateY(0);
        transition: all 0.3s ease;
        padding-top: 0.75rem;
    }
    
    .product-card:hover .product-actions {
        opacity: 1;
        transform: translateY(0);
    }
    
    /* Better spacing for small mobile devices */
    @media (max-width: 480px) {
        .product-actions {
            gap: 0.5rem;
            padding-top: 0.5rem;
        }
    }
    
    .btn-primary, .btn-secondary {
        flex: 1;
        padding: 0.875rem 1.25rem;
        border-radius: 0.875rem;
        font-weight: 700;
        font-size: 0.875rem;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        min-height: 48px;
        border: none;
        text-decoration: none;
    }
    
    .btn-primary {
        background: var(--gray-900);
        color: var(--white);
    }
    
    .btn-primary:hover {
        background: var(--primary-color);
        transform: translateY(-1px);
    }
    
    .btn-secondary {
        background: var(--white);
        color: var(--gray-700);
        border: 1px solid var(--gray-200);
    }
    
    .btn-secondary:hover {
        background: var(--gray-50);
        border-color: var(--gray-400);
        color: var(--gray-900);
    }
    
    /* Quick actions mobile optimization */
    .quick-actions {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        opacity: 0;
        transform: translateX(10px);
        transition: all 0.3s ease;
        z-index: 4;
    }
    
    .product-card:hover .quick-actions {
        opacity: 1;
        transform: translateX(0);
    }
    
    .quick-action-btn {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        border: none;
        background: var(--white);
        color: var(--gray-700);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
        font-size: 0.75rem;
    }
    
    .quick-action-btn:hover {
        background: var(--gray-900);
        color: var(--white);
        transform: scale(1.1);
    }
    
    /* Stock badge mobile optimization */
    .product-card .stock-badge {
        position: absolute !important;
        bottom: 0.5rem !important;
        left: 0.5rem !important;
        top: auto !important;
        right: auto !important;
        padding: 0.125rem 0.375rem !important;
        border-radius: 0.25rem !important;
        font-size: 0.625rem !important;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.025em;
        line-height: 1;
        z-index: 3;
        color: var(--white);
        box-shadow: none !important;
    }
    
    .product-card .stock-badge.in-stock {
        background: linear-gradient(135deg, #10b981, #059669) !important;
    }
    
    .product-card .stock-badge.out-of-stock {
        background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    }
    
    /* Product badges mobile optimization */
    .product-badges {
        position: absolute;
        top: 0.75rem;
        left: 0.75rem;
        display: flex;
        gap: 0.25rem;
        z-index: 3;
    }
    
    .product-badge {
        padding: 0.25rem 0.5rem;
        border-radius: 0.5rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.025em;
        line-height: 1;
        color: var(--white);
    }
    
    .product-badge.new {
        background: linear-gradient(135deg, #10b981, #059669);
    }
    
    .product-badge.sale {
        background: linear-gradient(135deg, #ef4444, #dc2626);
    }
    
    .product-badge.hot {
        background: linear-gradient(135deg, #f59e0b, #d97706);
    }
    

    
    /* Loading state mobile optimization */
    .loading-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 3rem 1rem;
        text-align: center;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border: 3px solid var(--gray-200);
        border-top: 3px solid var(--primary-color);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 1rem;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    

}

/* ===== TABLET OPTIMIZATION (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .store-main {
        padding: 0 2rem;
    }
    
    .product-card {
        flex: 0 0 320px;
        min-height: 420px;
    }
    
    .product-image {
        height: 200px;
    }
    
    .category-card {
        flex: 0 0 140px;
        min-height: 120px;
    }
    
    .search-sort-section {
        flex-direction: row;
        align-items: center;
    }
    
    .search-container {
        flex: 1;
    }
    
    .sort-container {
        flex: 0 0 auto;
    }
}

/* ===== DESKTOP ENHANCEMENTS (1025px+) ===== */
@media (min-width: 1025px) {
    .store-main {
        max-width: var(--container-max-width);
        margin: 0 auto;
        padding: 0 2rem;
    }
    
    .products-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
        overflow: visible;
        padding: 1.5rem 0;
    }
    
    .product-card {
        flex: none;
        min-height: 450px;
    }
    
    .product-image {
        height: 220px;
    }
    
    .category-scroll {
        justify-content: center;
        gap: 1rem;
    }
    
    .category-card {
        flex: 0 0 160px;
        min-height: 140px;
    }
}

/* ===== LARGE DESKTOP (1400px+) ===== */
@media (min-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2rem;
    }
    
    .product-card {
        min-height: 480px;
    }
    
    .product-image {
        height: 240px;
    }
}

/* ===== ACCESSIBILITY & TOUCH OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .product-card:hover {
        transform: none;
    }
    
    .product-actions {
        opacity: 1;
        transform: translateY(0);
    }
    
    .quick-actions {
        opacity: 1;
        transform: translateX(0);
    }
    
    .btn-primary, .btn-secondary {
        min-height: 44px; /* Minimum touch target size */
    }
    
    .quick-action-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .category-card {
        min-height: 44px;
    }
}

/* ===== DARK MODE SUPPORT ===== */
/* Dark mode disabled - keeping white background */

/* ===== PRINT STYLES ===== */
@media print {
    .bottom-navigation,
    .quick-actions,
    .product-actions {
        display: none !important;
    }
    
    .store-main {
        padding: 0;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}

/* Modal responsive adjustments for side-by-side */
@media (max-width: 1024px) {
    .modal-content[style*="max-width: 1200px"] {
        max-width: 95% !important;
        width: 95% !important;
    }
    
    .modal-content[style*="max-width: 1200px"] > div[style*="display: flex"] {
        flex-direction: column;
    }
    
    .search-results {
        max-height: 400px;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .modal-content[style*="max-width: 1200px"] {
        max-width: 98% !important;
        width: 98% !important;
        margin: 10px;
    }
    
    .modal-content[style*="max-width: 1200px"] > div[style*="display: flex"] {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-results {
        max-height: 300px;
        margin-top: 15px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .image-result {
        min-height: 120px;
    }
    
    .image-result img {
        height: 80px;
    }
}
