/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        width: 95%;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
    }
    
    .hero h2 {
        font-size: 2.8rem;
    }
}

@media (max-width: 992px) {
    header .container {
        flex-direction: column;
        text-align: center;
        padding: 1rem 0;
    }
    
    .logo {
        margin-bottom: 1rem;
        justify-content: center;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 1rem;
    }
    
    nav ul li {
        margin: 0 1rem 0.5rem;
    }
    
    .hero {
        padding: 4rem 0;
    }
    
    .hero h2 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-image {
        order: -1;
    }
    
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 2rem;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 0;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .products h2 {
        font-size: 2rem;
    }
    
    .about h2,
    .contact h2 {
        font-size: 2rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
        width: 95%;
    }
    
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        text-align: left;
    }
    
    .cart-item-info {
        width: 100%;
    }
    
    .cart-item-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .filter-btn {
        margin: 0.3rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .social-icons {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .container {
        width: 100%;
        padding: 0 1rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo img {
        height: 40px;
        margin-right: 10px;
    }
    
    nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    nav ul li {
        margin: 0;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .products,
    .about,
    .contact {
        padding: 3rem 0;
    }
    
    .products h2,
    .about h2,
    .contact h2 {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-card {
        margin: 0 auto;
        max-width: 300px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 1rem;
        border-radius: 10px;
    }
    
    .cart-item-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .cart-item-image {
        margin-right: 0;
    }
    
    .filter-btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
    }
}

/* Mobile First Approach for Extra Small Devices */
@media (max-width: 400px) {
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .products h2 {
        font-size: 1.6rem;
    }
    
    .product-info h3 {
        font-size: 1.1rem;
    }
    
    .product-price {
        font-size: 1.2rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .cart-item-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .quantity-btn {
        width: 30px;
        height: 30px;
    }
    
    .quantity {
        margin: 0 0.5rem;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
    }
    
    .product-image img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Print Styles */
@media print {
    header, 
    footer, 
    .cart-icon, 
    .btn,
    .product-filters,
    .social-icons {
        display: none !important;
    }
    
    .products,
    .about,
    .contact {
        padding: 0;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .hero {
        background: none !important;
        color: black !important;
        padding: 1rem 0;
    }
    
    .hero h2 {
        color: black !important;
        text-shadow: none !important;
    }
    
    .hero p {
        color: black !important;
        text-shadow: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .products {
        background-color: #2d2d2d;
    }
    
    .product-card {
        background-color: #3d3d3d;
        border-color: #4d4d4d;
    }
    
    .product-info h3 {
        color: #e0e0e0;
    }
    
    .product-info p {
        color: #b0b0b0;
    }
    
    .about {
        background-color: #2d2d2d;
    }
    
    .contact-card {
        background-color: #3d3d3d;
    }
    
    .form-control,
    .form-select {
        background-color: #2d2d2d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #3d3d3d;
        border-color: #3498db;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .product-card:hover,
    .btn:hover,
    .cart-icon:hover,
    .contact-card:hover {
        transform: none;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    nav ul li a::after {
        display: none;
    }
    
    .cart-icon:hover {
        transform: none;
    }
    
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .filter-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .quantity-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .add-to-cart {
        min-height: 44px;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 2rem 0;
    }
    
    .modal-content {
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .products,
    .about,
    .contact {
        padding: 2rem 0;
    }
}

/* Very large screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

/* Fix for Bootstrap modal backdrop */
.modal-backdrop.show {
    opacity: 0.5;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}