/* Responsive Styles - AuraFarm */

/* ============================================
   CROSS-BROWSER BASE FIXES
   ============================================ */

/* Sidebar logo: only visible on very large screens */
@media (max-width: 1400px) {
    .sidebar-logo-card {
        display: none !important;
    }
}

/* aspect-ratio fallback for browsers that don't support it */
@supports not (aspect-ratio: 1) {
    .product-image {
        height: 0;
        padding-bottom: 75%;
    }
    .product-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ============================================
   BASE RESPONSIVE (Mobile First Approach)
   ============================================ */

/* Mobile Styles (max-width: 480px) */
@media (max-width: 480px) {
    :root {
        --container-padding: 1rem;
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    .container {
        padding: 0 var(--container-padding);
        max-width: 100%;
    }

    /* Header */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
    }

    .header-inner {
        padding: 0.75rem 0;
    }

    .logo img {
        height: 60px !important;
        width: 60px;
    }

    /* Mobile Menu Button */
    .mobile-menu-btn {
        display: flex !important;
        width: 40px;
        height: 40px;
        padding: 8px;
        background: var(--bg-light);
        border-radius: 8px;
        touch-action: manipulation;
    }

    .mobile-menu-btn span {
        width: 22px;
        height: 2px;
        background-color: var(--text-dark);
        border-radius: 2px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* Mobile Navigation */
    .nav-desktop {
        display: none !important;
    }

    .nav-mobile {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        background: white;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
        z-index: 9998;
    }

    .nav-mobile.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Mobile Language Section */
    .mobile-lang-section {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 1rem;
        background: var(--bg-light);
        border-bottom: 1px solid var(--border);
    }

    .mobile-lang-label {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--text-gray);
    }

    .mobile-lang-switcher {
        display: flex;
        gap: 0.375rem;
    }

    .mobile-lang-switcher .lang-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        font-weight: 600;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: white;
        color: var(--text-gray);
        cursor: pointer;
        transition: all 0.2s ease;
        min-width: 44px;
        text-align: center;
    }

    .mobile-lang-switcher .lang-btn:hover,
    .mobile-lang-switcher .lang-btn.active {
        border-color: var(--primary);
        background: var(--primary);
        color: white;
    }

    .mobile-lang-switcher .lang-btn img {
        display: none;
    }

    /* Desktop Language - Hide on mobile */
    .nav-actions .lang-switcher {
        display: none;
    }

    .nav-mobile .nav-link {
        display: block;
        padding: 1rem 1.25rem;
        border-bottom: 1px solid var(--border);
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-dark);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .nav-mobile .nav-link:last-child {
        border-bottom: none;
    }

    .nav-mobile .nav-link:hover,
    .nav-mobile .nav-link.active {
        background-color: var(--primary);
        color: white;
        padding-left: 1.5rem;
    }

    /* Hero Section */
    .hero {
        min-height: auto;
        padding: 90px 0 50px;
    }

    .hero .grid-2 {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-content {
        text-align: center;
        max-width: 100%;
        order: 2;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        margin-bottom: 1rem;
    }

    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.25;
        margin-bottom: 1rem;
    }

    .hero-description {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
        justify-content: center;
    }

    .hero-image {
        order: 1;
        margin-bottom: 0;
    }

    .hero-image img {
        border-radius: 12px;
        max-height: 250px;
        object-fit: cover;
    }

    /* About Section */
    .about-section {
        padding: 3rem 0;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image {
        order: -1;
    }

    .about-image img {
        border-radius: 12px;
    }

    .about-image::before {
        display: none;
    }

    .about-content {
        text-align: center;
    }

    .about-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .about-content p {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .about-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Features Section */
    .features-section {
        padding: 3rem 0;
    }

    .section-header {
        margin-bottom: 2rem;
        padding: 0 0.5rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .section-header p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .feature-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 1rem;
    }

    .feature-icon svg {
        width: 26px;
        height: 26px;
    }

    .feature-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .feature-card p {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    /* Products Section */
    .products-section {
        padding: 3rem 0;
    }

    .product-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* Products page - center 2 products on mobile */
    .products-center {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        max-width: 100%;
        margin: 0 auto;
    }

    .products-center .product-card {
        flex: 0 1 calc(50% - 0.5rem);
        max-width: 200px;
    }

    .product-card {
        border-radius: 12px;
    }

    .product-image {
        aspect-ratio: 4/3;
    }

    .product-info {
        padding: 1rem;
    }

    .product-category {
        font-size: 0.65rem;
    }

    .product-title {
        font-size: 1rem;
        margin-bottom: 0.375rem;
    }

    .product-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }

    /* CTA Section */
    .cta-section {
        padding: 3rem 0;
        text-align: center;
    }

    .cta-section h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .cta-section p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }

    /* Page Header */
    .page-header {
        padding: 90px 0 40px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
        gap: 0.375rem;
    }

    /* Contact Section */
    .contact-section {
        padding: 3rem 0;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-info h3 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .contact-info p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .contact-item {
        gap: 0.75rem;
    }

    .contact-icon {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .contact-icon svg {
        width: 20px;
        height: 20px;
    }

    .contact-details h4 {
        font-size: 0.95rem;
    }

    .contact-details p {
        font-size: 0.85rem;
    }

    .contact-map {
        height: 250px;
        border-radius: 12px;
    }

    /* Form Styles */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.375rem;
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .form-textarea {
        min-height: 120px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Product Detail */
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .product-gallery-main img {
        aspect-ratio: 1/1;
        border-radius: 12px;
    }

    .product-gallery-thumbnails {
        gap: 0.5rem;
    }

    .product-gallery-thumbnails img {
        width: 60px;
        height: 60px;
    }

    .product-detail-info h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .product-detail-info .product-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .product-specs {
        padding: 1rem;
        border-radius: 12px;
    }

    .product-specs table {
        font-size: 0.85rem;
    }

    .product-specs td {
        padding: 0.5rem 0;
    }

    /* Footer */
    .footer {
        padding: 2.5rem 0 1.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-logo {
        justify-content: center;
    }

    .footer-logo img {
        height: 108px;
        width: 108px;
    }

    .footer-brand p {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .footer-social {
        justify-content: center;
    }

    .footer-heading {
        font-size: 1rem;
        margin-bottom: 1rem;
        position: relative;
        padding-bottom: 0.5rem;
    }

    .footer-heading::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 2px;
        background: var(--primary);
    }

    .footer-links {
        text-align: center;
    }

    .footer-links li {
        margin-bottom: 0.5rem;
    }

    .footer-links a {
        font-size: 0.85rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        font-size: 0.8rem;
        padding-top: 1.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
        border-radius: 8px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* Section */
    .section {
        padding: 2.5rem 0;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    /* Text utilities */
    .text-center { text-align: center; }
    .mt-5 { margin-top: 2rem; }
    .mb-5 { margin-bottom: 2rem; }
}

/* ============================================
   TABLET STYLES (481px - 768px)
   ============================================ */
@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --container-padding: 1.25rem;
    }

    body {
        font-size: 15px;
    }

    .container {
        padding: 0 var(--container-padding);
        max-width: 700px;
    }

    /* Header */
    .header-inner {
        padding: 0.875rem 0;
    }

    .logo img {
        height: 70px !important;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    /* Mobile Navigation */
    .nav-desktop {
        display: none !important;
    }

    .nav-mobile {
        display: block;
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        background: white;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
        z-index: 9998;
    }

    .nav-mobile.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Mobile Language Section - Tablet */
    .mobile-lang-section {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        padding: 1.25rem;
        background: var(--bg-light);
        border-bottom: 1px solid var(--border);
    }

    .mobile-lang-label {
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-gray);
    }

    .mobile-lang-switcher {
        display: flex;
        gap: 0.5rem;
    }

    .mobile-lang-switcher .lang-btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
        font-weight: 600;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: white;
        color: var(--text-gray);
        cursor: pointer;
        transition: all 0.2s ease;
        min-width: 50px;
        text-align: center;
    }

    .mobile-lang-switcher .lang-btn:hover,
    .mobile-lang-switcher .lang-btn.active {
        border-color: var(--primary);
        background: var(--primary);
        color: white;
    }

    .mobile-lang-switcher .lang-btn img {
        display: none;
    }

    /* Desktop Language - Hide on tablet */
    .nav-actions .lang-switcher {
        display: none;
    }

    .nav-mobile .nav-link {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border);
        font-size: 1rem;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding: 100px 0 50px;
    }

    .hero .grid-2 {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .hero-content {
        text-align: center;
        max-width: 100%;
        order: 2;
    }

    .hero-title {
        font-size: 2rem !important;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-image {
        order: 1;
        margin-bottom: 0;
    }

    .hero-image img {
        max-height: 300px;
        border-radius: 16px;
    }

    /* About */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .about-image {
        order: -1;
    }

    .about-image::before {
        display: none;
    }

    .about-content h2 {
        font-size: 1.75rem;
    }

    .about-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    /* Features */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    /* Products */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* CTA */
    .cta-section h2 {
        font-size: 1.75rem;
    }

    /* Page Header */
    .page-header {
        padding: 110px 0 50px;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    /* Contact */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .contact-map {
        height: 300px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .footer-brand {
        grid-column: span 2;
        max-width: 100%;
    }

    /* Product Detail */
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Section */
    .section {
        padding: 3.5rem 0;
    }
}

/* ============================================
   DESKTOP & LARGE TABLET (769px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 900px;
        padding: 0 1.5rem;
    }

    /* Header */
    .nav-desktop {
        display: flex !important;
    }

    .mobile-menu-btn {
        display: none !important;
    }

    .nav-mobile {
        display: none !important;
    }

    /* Show language switcher on desktop */
    .nav-actions .lang-switcher {
        display: flex !important;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }

    .hero .grid-2 {
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    /* About */
    .about-grid {
        gap: 2.5rem;
    }

    /* Features */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Products */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    /* Products page - center 2 products on desktop */
    .products-center {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
        max-width: 900px;
        margin: 0 auto;
    }

    .products-center .product-card {
        flex: 0 1 calc(50% - 1rem);
        max-width: 400px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .footer-brand {
        grid-column: span 2;
    }

    /* Section */
    .section {
        padding: 4rem 0;
    }
}

/* ============================================
   LARGE DESKTOP (1025px+)
   ============================================ */
@media (min-width: 1025px) {
    .nav-desktop {
        display: flex !important;
    }

    .mobile-menu-btn {
        display: none !important;
    }

    .nav-mobile {
        display: none !important;
    }

    /* Show language switcher on desktop */
    .nav-actions .lang-switcher {
        display: flex !important;
    }

    /* Products page - center 2 products on large desktop */
    .products-center {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
        max-width: 1000px;
        margin: 0 auto;
    }

    .products-center .product-card {
        flex: 0 1 calc(50% - 1rem);
        max-width: 450px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
        box-shadow: none;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .feature-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .feature-card:active {
        box-shadow: var(--shadow);
    }

    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .product-card:active {
        transform: scale(0.99);
        box-shadow: var(--shadow);
    }

    .nav-link:hover::after,
    .nav-link:active::after {
        width: 100%;
    }

    .nav-link:hover,
    .nav-link:active {
        color: var(--primary);
    }

    /* Make touch targets larger */
    .nav-mobile .nav-link {
        min-height: 48px;
    }

    .lang-btn {
        min-width: 44px;
        min-height: 36px;
    }

    .mobile-menu-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .footer-links a {
        min-height: 36px;
        display: inline-block;
    }
}

/* ============================================
   SAFE AREA INSETS (Modern Mobile Browsers)
   ============================================ */
@supports (padding: max(0px)) {
    @media (max-width: 480px) {
        .nav-mobile {
            max-height: calc(100vh - 60px - env(safe-area-inset-bottom, 0px));
            padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        }

        .footer {
            padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
        }
    }
}

/* ============================================
   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;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    @media (max-width: 768px) {
        .nav-mobile {
            background: var(--text-dark);
        }

        .nav-mobile .nav-link {
            border-color: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .nav-mobile .nav-link:hover,
        .nav-mobile .nav-link.active {
            background: var(--primary);
            color: white;
        }
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    @media (max-width: 768px) {
        .hero {
            padding: 80px 0 40px;
            min-height: auto;
        }

        .hero .grid-2 {
            grid-template-columns: 1fr 1fr;
        }

        .hero-content {
            order: 1;
        }

        .hero-image {
            order: 2;
        }

        .hero-image img {
            max-height: 180px;
        }

        .hero-title {
            font-size: 1.5rem;
        }

        .hero-actions {
            flex-direction: row;
            flex-wrap: wrap;
        }

        .hero-actions .btn {
            width: auto;
        }

        .nav-mobile {
            max-height: calc(100vh - 50px);
        }
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .header,
    .footer,
    .mobile-menu-btn,
    .nav-mobile,
    .hero-actions,
    .btn {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: black;
        background: white;
    }

    .section {
        padding: 1rem 0;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .hero {
        padding: 0;
        min-height: auto;
    }

    .hero .grid-2 {
        grid-template-columns: 1fr;
    }
}
