/* ===== RESPONSIVE STYLES ===== */

/* Tablet Landscape (1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 960px;
    }
    
    .hero-title-main {
        font-size: 3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .security-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .security-left {
        margin-bottom: 2rem;
    }
    
    .security-icon {
        margin: 0 auto 2rem;
    }
}

/* Tablet Portrait (768px) */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        max-width: 100%;
        padding-top: 120px; /* Space for fixed header */
    }
    
    * {
        max-width: 100vw;
    }
    
    /* Fixed Header on Mobile */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-primary);
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    /* Header */
    .header-top {
        padding: 0.75rem 0;
    }
    
    .header-left {
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .header-right {
        gap: 0.75rem;
    }
    
    .header-link span {
        display: none;
    }
    
    .auth-btn span:not(.cart-badge):not(.favorites-badge) {
        display: none;
    }
    
    /* Ensure badges are visible on mobile */
    .cart-badge, .favorites-badge {
        position: absolute;
        top: -8px;
        right: -8px;
        min-width: 18px;
        height: 18px;
        font-size: 0.65rem;
        z-index: 100;
    }
    
    .cart-btn, .favorites-btn {
        padding: 0.4rem 0.6rem;
    }
    
    .mobile-app {
        padding: 0.5rem;
    }
    
    .lang-btn {
        padding: 0.5rem;
    }
    
    .lang-text {
        display: none;
    }
    
    .register-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Navigation */
    .nav-menu {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
        margin-left: auto;
    }
    
    /* Hide duplicate menu button on right */
    .header-right .mobile-menu-btn {
        display: none;
    }
    
    .category-btn {
        padding: 0.75rem 1rem;
    }
    
    .category-btn span {
        display: none;
    }
    
    /* Hero */
    .hero {
        padding: 3rem 0 4rem;
        margin-top: -120px; /* Compensate for fixed header */
        padding-top: 140px; /* Add padding to push content down */
    }
    
    .hero-title-main {
        font-size: 2.5rem;
    }
    
    .hero-title-sub {
        font-size: 1.25rem;
    }
    
    .search-box {
        flex-direction: column;
        padding: 1rem;
    }
    
    .search-input {
        padding: 1rem;
        width: 100%;
    }
    
    .search-icon {
        display: none;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Products */
    .products-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .products-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* Mobile (640px) */
@media (max-width: 640px) {
    /* Typography */
    .section-title {
        font-size: 2rem;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    /* Statistics */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    /* Categories */
    .categories-carousel {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
    
    .category-icon {
        width: 60px;
        height: 60px;
    }
    
    .category-icon i {
        font-size: 1.5rem;
    }
    
    /* Products */
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Security */
    .security-steps {
        padding: 0 1rem;
    }
    
    /* CTA */
    .cta {
        padding: 4rem 0;
    }
    
    .cta-title {
        font-size: 2rem;
    }
    
    .cta-subtitle {
        font-size: 1rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 10px;
    }
    
    /* Fix header layout on small screens */
    .header-right {
        gap: 0.5rem;
    }
    
    .register-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .header-link {
        display: none;
    }
    
    /* Categories */
    .categories-carousel {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    /* Hero */
    .hero-title-main {
        font-size: 2rem;
    }
    
    .hero-title-sub {
        font-size: 1rem;
    }
    
    .suggestion-label {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    /* Modal */
    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
}

/* Mobile Navigation Menu */
@media (max-width: 768px) {
    .mobile-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg-primary);
        box-shadow: var(--shadow-2xl);
        transition: var(--transition-base);
        z-index: var(--z-fixed);
        overflow-y: auto;
    }
    
    .mobile-nav.active {
        right: 0;
    }
    
    .mobile-nav-header {
        padding: 1.5rem;
        border-bottom: 1px solid var(--border-light);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .mobile-nav-close {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-nav-menu {
        padding: 1.5rem;
    }
    
    .mobile-nav-menu a {
        display: block;
        padding: 1rem;
        color: var(--text-primary);
        font-weight: var(--font-medium);
        border-radius: var(--radius-md);
        transition: var(--transition-base);
    }
    
    .mobile-nav-menu a:hover {
        background: var(--bg-secondary);
        color: var(--primary);
    }
    
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-base);
        z-index: var(--z-fixed);
    }
    
    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }
    
    .search-btn,
    .auth-btn,
    .form-btn,
    .cta-btn {
        padding: 1rem 1.5rem;
    }
    
    .tab-btn {
        padding: 0.75rem 1.25rem;
    }
}

/* Print styles */
@media print {
    .promo-banner,
    .header,
    .search-container,
    .categories,
    .cta,
    .footer,
    .modal {
        display: none;
    }
    
    body {
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .product-card {
        break-inside: avoid;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #0050b3;
        --text-primary: #000;
        --text-secondary: #333;
        --bg-primary: #fff;
        --bg-secondary: #f5f5f5;
        --border-light: #ccc;
    }
    
    .auth-btn,
    .form-btn,
    .cta-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}