/* ===================================================================
   RESPONSIVE OPTIMIZATION - Desktop, Tablet, Mobile
   Micro Forest Designs - Enhanced Multi-Device Support
   =================================================================== */

/* ===================================
   RESPONSIVE BREAKPOINTS
   =================================== */
/*
   Mobile:  320px - 767px
   Tablet:  768px - 1024px
   Desktop: 1025px+
   
   Optimized for:
   - iPhone SE (375px)
   - iPhone 12/13/14 (390px)
   - iPhone Pro Max (428px)
   - iPad (768px)
   - iPad Pro (1024px)
   - Desktop (1280px, 1440px, 1920px)
*/

/* ===================================
   BASE RESPONSIVE TYPOGRAPHY
   =================================== */

/* Desktop (Default) */
:root {
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --h1-size: 3.5rem;
    --h2-size: 2.5rem;
    --h3-size: 2rem;
    --h4-size: 1.5rem;
    --h5-size: 1.25rem;
    --h6-size: 1rem;
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
    :root {
        --font-size-base: 15px;
        --h1-size: 3rem;
        --h2-size: 2.25rem;
        --h3-size: 1.75rem;
        --h4-size: 1.375rem;
        --h5-size: 1.125rem;
    }
}

/* Mobile */
@media (max-width: 767px) {
    :root {
        --font-size-base: 14px;
        --h1-size: 2.5rem;
        --h2-size: 2rem;
        --h3-size: 1.5rem;
        --h4-size: 1.25rem;
        --h5-size: 1.125rem;
    }
}

/* Small Mobile */
@media (max-width: 375px) {
    :root {
        --font-size-base: 14px;
        --h1-size: 2rem;
        --h2-size: 1.75rem;
        --h3-size: 1.375rem;
    }
}

/* ===================================
   CONTAINER RESPONSIVE WIDTHS
   =================================== */

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Desktop Large */
@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }
}

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

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 0 var(--spacing-sm);
    }
}

/* Mobile */
@media (max-width: 767px) {
    .container {
        padding: 0 1rem;
    }
}

/* ===================================
   NAVIGATION RESPONSIVE
   =================================== */

/* Tablet Navigation */
@media (max-width: 1024px) and (min-width: 768px) {
    .nav-wrapper {
        padding: 1rem 0;
    }

    .nav-menu {
        gap: 1.5rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .logo span {
        font-size: 1.25rem;
    }
}

/* Mobile Navigation */
@media (max-width: 767px) {
    .nav-wrapper {
        height: 60px;
        /* Force smaller height for mobile */
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.125rem;
    }

    .logo i {
        font-size: 1.25rem;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        /* Matches mobile header height */
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--white);
        flex-direction: column;
        padding: 2rem 1rem;
        transition: left 0.3s ease;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
        z-index: 999;
        overflow-y: auto;
    }

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

    .nav-menu li {
        width: 100%;
        text-align: center;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-link {
        font-size: 1.125rem;
        padding: 0.5rem 1rem;
        display: block;
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        padding: 0.5rem;
    }

    .hamburger span {
        width: 25px;
        height: 3px;
        background: var(--primary);
        border-radius: 2px;
        transition: 0.3s;
    }

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

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

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

/* ===================================
   HERO SECTION RESPONSIVE
   =================================== */

/* Tablet Hero */
@media (max-width: 1024px) and (min-width: 768px) {
    .hero {
        min-height: 70vh;
        padding: 6rem 0 4rem;
    }

    .hero-content h1 {
        font-size: 3rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Mobile Hero */
@media (max-width: 767px) {
    .hero {
        min-height: 60vh;
        padding: 5rem 0 3rem;
    }

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

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-cta {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .hero-cta .btn-primary,
    .hero-cta .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 2rem;
        background: rgba(255, 255, 255, 0.1);
        padding: 1rem;
        border-radius: 12px;
        backdrop-filter: blur(5px);
    }

    .stat-item {
        padding: 0.5rem;
    }

    .stat-number {
        font-size: 1.5rem;
        margin-bottom: 0px;
    }

    .stat-label {
        font-size: 0.65rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}

/* ===================================
   GRID LAYOUTS RESPONSIVE
   =================================== */

/* Services Grid */
@media (max-width: 1024px) and (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 767px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* Products Grid */
@media (max-width: 1024px) and (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 767px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Gallery Grid */
@media (max-width: 1024px) and (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   CARDS RESPONSIVE
   =================================== */

/* Tablet Cards */
@media (max-width: 1024px) and (min-width: 768px) {

    .service-card,
    .product-card {
        padding: 1.75rem;
    }

    .service-icon {
        font-size: 2.5rem;
        width: 70px;
        height: 70px;
    }
}

/* Mobile Cards */
@media (max-width: 767px) {

    .service-card,
    .product-card {
        padding: 1.5rem;
    }

    .service-card h3,
    .product-card h3 {
        font-size: 1.25rem;
    }

    .service-icon {
        font-size: 2rem;
        width: 60px;
        height: 60px;
    }

    .product-image {
        height: 200px;
    }
}

/* ===================================
   BUTTONS RESPONSIVE
   =================================== */

/* Tablet Buttons */
@media (max-width: 1024px) and (min-width: 768px) {

    .btn-primary,
    .btn-secondary {
        padding: 0.875rem 1.75rem;
        font-size: 0.9375rem;
    }

    .btn-large {
        padding: 1.125rem 2.25rem;
        font-size: 1.0625rem;
    }
}

/* Mobile Buttons */
@media (max-width: 767px) {

    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }

    .btn-large {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ===================================
   FORMS RESPONSIVE
   =================================== */

/* Tablet Forms */
@media (max-width: 1024px) and (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

/* Mobile Forms */
@media (max-width: 767px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .contact-form {
        padding: 1.5rem;
    }
}

/* ===================================
   FOOTER RESPONSIVE
   =================================== */

/* Tablet Footer */
@media (max-width: 1024px) and (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .footer-col:first-child {
        grid-column: 1 / -1;
    }
}

/* Mobile Footer */
@media (max-width: 767px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-logo {
        justify-content: center;
    }

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

    .footer-links {
        justify-content: center;
    }
}

/* ===================================
   SECTIONS SPACING RESPONSIVE
   =================================== */

/* Tablet Spacing */
@media (max-width: 1024px) and (min-width: 768px) {
    section {
        padding: 4rem 0;
    }

    .section-header {
        margin-bottom: 3rem;
    }
}

/* Mobile Spacing */
@media (max-width: 767px) {
    section {
        padding: 3rem 0;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Compact Footer */
    .footer {
        padding: 3rem 0;
    }

    .footer-col h4 {
        margin-bottom: 1rem;
        font-size: 1.125rem;
    }

    .contact-list li {
        justify-content: center;
    }
}

/* ===================================
   TABLET-SPECIFIC OPTIMIZATIONS
   =================================== */

@media (min-width: 768px) and (max-width: 1024px) {

    /* Touch-friendly spacing */
    .nav-link {
        padding: 0.75rem 1rem;
    }

    /* Optimized card layouts */
    .why-choose-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Better image sizing */
    .about-image,
    .why-choose-image {
        max-height: 400px;
        object-fit: cover;
    }

    /* Tablet-optimized stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================
   MOBILE-SPECIFIC OPTIMIZATIONS
   =================================== */

@media (max-width: 767px) {

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Touch-friendly tap targets */
    a,
    button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile-optimized images */
    img {
        width: 100%;
        height: auto;
    }

    /* Stack all two-column layouts */
    .two-column,
    .about-content,
    .why-choose-content,
    .contact-content {
        grid-template-columns: 1fr !important;
    }

    /* Mobile cart badge */
    .cart-badge {
        font-size: 0.625rem;
        min-width: 18px;
        height: 18px;
        top: -6px;
        right: -6px;
    }

    /* Mobile-friendly modals */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem;
    }

    /* Floating Action Buttons (New) */
    .mobile-actions {
        position: fixed;
        bottom: 140px;
        /* Above scroll top */
        right: 20px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        z-index: 1001;
        transition: transform 0.3s ease;
    }

    .scroll-top {
        bottom: 85px;
        /* Above bottom nav */
        right: 20px;
        width: 44px;
        height: 44px;
        z-index: 1001;
    }

    .fab-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        font-size: 1.5rem;
        text-decoration: none;
    }

    .fab-whatsapp {
        background: #25d366;
    }

    .fab-call {
        background: var(--primary);
    }

    /* Bottom Navigation Bar (New) */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 65px;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        z-index: 1002;
        border-top: 1px solid #eee;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--gray);
        font-size: 0.75rem;
        font-weight: 500;
        text-decoration: none;
        flex: 1;
        transition: color 0.3s ease;
    }

    .bottom-nav-item i {
        font-size: 1.25rem;
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    /* Hide Desktop-only elements */
    .hide-mobile {
        display: none !important;
    }
}

/* ===================================
   LANDSCAPE MOBILE OPTIMIZATION
   =================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 3rem 0 2rem;
    }

    .nav-menu {
        height: auto;
        max-height: calc(100vh - 60px);
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===================================
   HIGH-DPI DISPLAYS (RETINA)
   =================================== */

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Sharper borders */
    .service-card,
    .product-card,
    .btn-primary,
    .btn-secondary {
        border-width: 0.5px;
    }

    /* Crisper shadows */
    .card-shadow {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
            0 4px 8px rgba(0, 0, 0, 0.08);
    }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {

    .navbar,
    .hero-cta,
    .footer,
    .btn-primary,
    .btn-secondary,
    .scroll-indicator {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    .container {
        max-width: 100%;
    }

    section {
        page-break-inside: avoid;
    }

    .mobile-actions,
    .bottom-nav {
        display: none !important;
    }
}

/* ===================================
   ACCESSIBILITY ENHANCEMENTS
   =================================== */

/* Focus visible for keyboard navigation */
@media (prefers-reduced-motion: no-preference) {
    *:focus-visible {
        outline: 3px solid var(--secondary);
        outline-offset: 2px;
    }
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #1a3009;
        --secondary: #7aa32e;
    }

    .btn-primary,
    .btn-secondary {
        border: 2px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
    /* Currently keeping light theme for brand consistency */
}

/* ===================================
   PERFORMANCE OPTIMIZATIONS
   =================================== */

/* Optimize animations on mobile */
@media (max-width: 767px) {

    /* Reduce animation complexity */
    .fade-in,
    .slide-in {
        animation-duration: 0.3s;
    }

    /* Disable parallax on mobile */
    .parallax {
        background-attachment: scroll !important;
    }

    /* Optimize transforms */
    .card-hover {
        will-change: auto;
    }
}

/* ===================================
   DEVICE-SPECIFIC FIXES
   =================================== */

/* iOS Safari fixes */
@supports (-webkit-touch-callout: none) {

    /* Fix for iOS Safari bottom bar */
    .hero {
        min-height: -webkit-fill-available;
    }

    /* Prevent zoom on input focus */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Android Chrome fixes */
@media screen and (max-width: 767px) {

    /* Fix for Android keyboard overlap */
    .contact-form {
        padding-bottom: 100px;
    }
}

/* ===================================
   RESPONSIVE UTILITIES
   =================================== */

/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
.hide-tablet {
    display: block;
}

@media (min-width: 768px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on desktop */
.hide-desktop {
    display: none;
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block !important;
    }
}

/* Show only on tablet */
.show-tablet {
    display: none;
}

@media (min-width: 768px) and (max-width: 1024px) {
    .show-tablet {
        display: block !important;
    }
}

/* Show only on desktop */
.show-desktop {
    display: none;
}

@media (min-width: 1025px) {
    .show-desktop {
        display: block !important;
    }
}