@media (max-width: 479px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    
    /* Container */
    .container { padding: 0 1rem; }
    
    /* Buttons */
    .btn { padding: 0.75rem 1.25rem; font-size: 0.875rem; }
    .btn-lg { padding: 0.875rem 1.5rem; }
    
    /* Navigation */
    .navbar { padding: 0.75rem 0; }
    .mobile-menu { width: 100%; }
    
    /* Hero Sections */
    .hero-section { padding: 3rem 0; }
    .hero-section h1 { font-size: 2rem; }
    
    /* Grid System */
    .grid { gap: 1rem; }
    .grid-cols-1 { grid-template-columns: 1fr; }
    
    /* Cards */
    .card { padding: 1rem; }
    .card-body { padding: 1rem; }
    
    /* Forms */
    .form-control { padding: 0.75rem; }
    
    /* Product Cards */
    .product-card .quick-actions { 
        opacity: 1;
        transform: none;
    }
}

/* Small Mobile (480px - 639px) */
@media (min-width: 480px) and (max-width: 639px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .container { padding: 0 1.25rem; }
    .grid-cols-2-sm { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet Portrait (640px - 767px) */
@media (min-width: 640px) and (max-width: 767px) {
    .container { padding: 0 1.5rem; }
    .grid-cols-2-md { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3-md { grid-template-columns: repeat(3, 1fr); }
    
    .hero-section { padding: 4rem 0; }
    .hero-section h1 { font-size: 2.5rem; }
}

/* Tablet Landscape (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container { max-width: 720px; }
    .grid-cols-3-lg { grid-template-columns: repeat(3, 1fr); }
    
    /* Adjust mega menu for tablet */
    .mega-menu { width: 90%; right: 5%; }
    .mega-menu .grid { grid-template-columns: repeat(2, 1fr); }
}

/* Desktop Small (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .container { max-width: 960px; }
    .grid-cols-4-lg { grid-template-columns: repeat(4, 1fr); }
}

/* Desktop Large (1280px - 1535px) */
@media (min-width: 1280px) and (max-width: 1535px) {
    .container { max-width: 1200px; }
}

/* Desktop XL (1536px and up) */
@media (min-width: 1536px) {
    .container { max-width: 1400px; }
    .grid-cols-5-xl { grid-template-columns: repeat(5, 1fr); }
}

/* Orientation Specific Styles */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section { min-height: auto; padding: 2rem 0; }
    .hero-section h1 { font-size: 1.75rem; }
    .mobile-menu { height: 100vh; }
}

/* Print Styles */
@media print {
    .no-print { display: none !important; }
    body { font-size: 12pt; }
    .container { width: 100%; max-width: none; }
}

/* Touch Device Optimization */
@media (hover: none) and (pointer: coarse) {
    /* Improve touch targets */
    .btn, .nav-link, .form-control { min-height: 44px; }
    input, select, textarea { font-size: 16px; } /* Prevent zoom on iOS */
    
    /* Show hover effects on touch */
    .product-card:hover .quick-actions { opacity: 1; transform: none; }
    
    /* Larger touch targets */
    .cart-badge { width: 24px; height: 24px; font-size: 12px; }
    .ai-chat-btn { width: 56px; height: 56px; bottom: 20px; left: 20px; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #ffffff;
        --light-color: #1a1a1a;
        --gray-50: #2d2d2d;
        --gray-100: #333333;
        --gray-200: #404040;
        --gray-300: #4d4d4d;
        --gray-400: #666666;
        --gray-500: #808080;
        --gray-600: #999999;
        --gray-700: #b3b3b3;
        --gray-800: #cccccc;
        --gray-900: #e6e6e6;
    }
    
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .card {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .navbar {
        background: rgba(30, 30, 30, 0.95);
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img, .product-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}