/* ========================================
   Responsive Design Fixes - All Breakpoints
   ======================================== */

/* ========================================
   Mobile First Base Styles (up to 480px)
   ======================================== */
@media (max-width: 480px) {
    /* Container adjustments */
    .container {
        padding: 0 0.75rem;
    }

    /* Hero section mobile optimization */
    .hero {
        min-height: 83vh;
        padding: 1rem 0;
        padding-top: 110px; /* Consistent navbar clearance: 40px + 70px */
    }

    .hero-content {
        padding: 1rem 0;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-description {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-buttons .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    /* Hero categories showcase */
    .hero-categories {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-top: 2rem;
    }

    .hero-category-card {
        padding: 0.75rem;
    }

    .hero-category-card img {
        height: 80px;
        margin-bottom: 0.5rem;
    }

    .hero-category-card h3 {
        font-size: 0.875rem;
    }

    .hero-category-card p {
        font-size: 0.75rem;
    }

    /* Features section */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 2rem 0;
    }

    .feature-card {
        padding: 1.25rem;
        text-align: center;
    }

    .feature-icon {
        width: 48px;
        height: 48px;
        margin: 0 auto 0.75rem;
    }

    .feature-card h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .feature-card p {
        font-size: 0.875rem;
    }

    /* Product cards mobile */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .product-card {
        padding: 0.75rem;
    }

    .product-image {
        height: 200px;
    }

    .product-title {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 1.125rem;
    }

    /* Category cards mobile */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .category-card {
        min-height: 120px;
    }

    .category-card h3 {
        font-size: 1rem;
    }

    /* Testimonials mobile */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .testimonial-card {
        padding: 1.25rem;
    }

    /* Blog cards mobile */
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .blog-card {
        margin-bottom: 1rem;
    }

    .blog-image {
        height: 180px;
    }

    .blog-title {
        font-size: 1rem;
        margin: 0.75rem 0 0.5rem;
    }

    .blog-excerpt {
        font-size: 0.875rem;
    }

    /* Newsletter mobile */
    .newsletter-section {
        padding: 2rem 1rem;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .newsletter-form input {
        width: 100%;
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    .newsletter-form button {
        width: 100%;
        padding: 0.875rem;
    }

    /* FAQ mobile */
    .faq-container {
        padding: 1rem 0;
    }

    .faq-item {
        margin-bottom: 0.75rem;
    }

    .faq-question {
        font-size: 0.95rem;
        padding: 1rem;
    }

    .faq-answer {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }

    /* Footer mobile */
    footer {
        padding: 2rem 0 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-column h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .footer-column ul {
        margin-bottom: 1rem;
    }

    .footer-column li {
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        padding-top: 1.5rem;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }

    .footer-links a {
        font-size: 0.75rem;
    }

    /* Section headings mobile */
    section h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    section .section-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }
}

/* ========================================
   Large Mobile / Small Tablet (481px - 768px)
   ======================================== */
@media (min-width: 481px) and (max-width: 768px) {
    /* Container */
    .container {
        padding: 0 1rem;
    }

    /* Hero adjustments */
    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Features grid */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* Products grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        text-align: left;
    }
}

/* ========================================
   Tablet (769px - 1024px)
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Container */
    .container {
        padding: 0 1.5rem;
    }

    /* Hero section */
    .hero-content {
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: 2rem;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .hero-categories {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Products grid */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Testimonials grid */
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* ========================================
   Small Desktop (1025px - 1280px)
   ======================================== */
@media (min-width: 1025px) and (max-width: 1280px) {
    /* Container */
    .container {
        max-width: 1140px;
    }

    /* Products grid */
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    /* Testimonials grid */
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* ========================================
   Large Desktop (1281px and up)
   ======================================== */
@media (min-width: 1281px) {
    /* Container */
    .container {
        max-width: 1280px;
    }

    /* Hero section */
    .hero h1 {
        font-size: 3.5rem;
    }

    /* Products grid */
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }

    /* Features grid */
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    /* Testimonials grid */
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* ========================================
   Touch Device Optimizations
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .product-card:hover,
    .category-card:hover,
    .blog-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }

    /* Improve form inputs for touch */
    input,
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    /* Hide unnecessary elements for printing */
    .navbar,
    .announcement-bar,
    .newsletter-section,
    footer,
    .hero-buttons,
    .add-to-cart,
    .back-to-top {
        display: none !important;
    }

    /* Optimize for printing */
    body {
        padding-top: 0;
        font-size: 12pt;
        line-height: 1.5;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Ensure images don't break across pages */
    img {
        page-break-inside: avoid;
    }

    /* Add page breaks where appropriate */
    section {
        page-break-inside: avoid;
    }
}

/* ========================================
   Accessibility Improvements
   ======================================== */
@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;
    }
}

/* ========================================
   Dark Mode Support
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
}

/* ========================================
   High Contrast Mode
   ======================================== */
@media (prefers-contrast: high) {
    /* Increase contrast for accessibility */
    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    button,
    .btn {
        border: 2px solid currentColor;
    }
}

/* ========================================
   Specific Breakpoint Fixes
   ======================================== */

/* iPhone SE and similar small phones */
@media (max-width: 375px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero-description {
        font-size: 0.875rem;
    }

    .product-card {
        padding: 0.625rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.75rem 1.25rem;
    }
}

/* iPad and similar tablets in portrait */
@media (min-width: 768px) and (max-width: 834px) and (orientation: portrait) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* iPad Pro and larger tablets */
@media (min-width: 1024px) and (max-width: 1366px) {
    .container {
        max-width: 960px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Navbar Mobile Menu Fixes
   ======================================== */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: white;
        flex-direction: column;
        padding: 2rem 1rem;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-link {
        padding: 0.75rem 0;
        font-size: 1.125rem;
        border-bottom: 1px solid var(--gray-100);
        width: 100%;
        text-align: left;
    }

    .nav-icons {
        margin-top: auto;
        padding-top: 1rem;
        border-top: 1px solid var(--gray-200);
        display: flex;
        gap: 1.5rem;
        justify-content: center;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
    }

    .nav-toggle span {
        width: 24px;
        height: 2px;
        background: var(--gray-700);
        transition: all 0.3s ease;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

/* ========================================
   Utility Classes for Responsive
   ======================================== */
.mobile-only {
    display: block;
}

.tablet-only {
    display: none;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
    
    .tablet-only {
        display: block;
    }
}

@media (min-width: 1024px) {
    .tablet-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
}

/* ========================================
   Responsive Typography Scale
   ======================================== */
@media (max-width: 640px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.875rem; }
    
    p { font-size: 0.95rem; }
    small { font-size: 0.8rem; }
}

@media (min-width: 641px) and (max-width: 1024px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.125rem; }
    h6 { font-size: 1rem; }
}

@media (min-width: 1025px) {
    h1 { font-size: 3rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 1.75rem; }
    h4 { font-size: 1.5rem; }
    h5 { font-size: 1.25rem; }
    h6 { font-size: 1.125rem; }
}