/* ============================================
   ViaLuma — Responsive Design
   Mobile-First Approach
   ============================================ */

/* ============================================
   MOBILE MENU RESPONSIVE STYLES
   ============================================ */

/* Show mobile menu toggle, hide desktop nav on mobile */
@media (max-width: 1024px) {
    .main-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-nav {
        display: flex;
    }

    .header-actions .btn-quote-nav {
        display: none;
    }

    .header-actions .account-link span {
        display: none;
    }
}

/* Tablet mobile menu adjustments */
@media (min-width: 480px) and (max-width: 767px) {
    .mobile-nav .nav-link {
        font-size: var(--text-2xl);
    }

    .mobile-nav-links {
        gap: var(--space-md);
    }
}

/* Tablet mobile menu adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .mobile-nav .nav-link {
        font-size: var(--text-3xl);
    }

    .mobile-nav-links {
        gap: var(--space-lg);
    }

    .mobile-nav-cta {
        margin-top: var(--space-2xl);
    }
}

/* Mobile menu footer padding for safe area */
@media (max-width: 767px) {
    .mobile-nav {
        padding-bottom: calc(var(--space-3xl) + env(safe-area-inset-bottom, 0px));
    }
    
    /* Nav links with icons */
    .mobile-nav .nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-sm);
    }
    
    .mobile-nav .nav-link svg,
    .mobile-nav .nav-link img {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
}

/* ============================================
   BASE MOBILE (320px - 479px)
   ============================================ */
@media (max-width: 479px) {
    /* Typography Scale Down */
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
    h4 { font-size: var(--text-lg); }

    /* Hero */
    .hero {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .hero-content {
        padding-top: 100px;
    }

    .hero-title .line-1 {
        font-size: var(--text-4xl);
        letter-spacing: -0.02em;
    }

    .hero-title .line-2 {
        font-size: var(--text-xl);
    }

    .hero-subtitle {
        font-size: var(--text-base);
    }

    /* Hero CTA & Scroll Indicator */
    .hero-cta {
        flex-direction: column;
        width: 100%;
        margin-bottom: var(--space-2xl);
    }

    .hero-cta .btn {
        width: 100%;
    }

    .hero-scroll-indicator {
        display: none !important;
    }

    /* Header */
    .site-header {
        padding: var(--space-md) 0;
    }

    .site-logo-text {
        font-size: var(--text-base);
    }

    .header-actions .btn-quote-nav {
        display: none;
    }

    .header-actions .account-link span {
        display: none;
    }

    /* Mobile nav adjustments for small screens */
    .mobile-nav .nav-link {
        font-size: var(--text-lg);
        padding: var(--space-sm) var(--space-md);
    }

    .mobile-nav-contact {
        padding-top: var(--space-md);
    }

    .mobile-nav-contact p {
        font-size: 10px;
    }

    /* Sections */
    .section {
        padding: var(--space-3xl) 0;
    }

    .section-lg {
        padding: var(--space-3xl) 0 var(--space-2xl);
    }

    .section-header {
        margin-bottom: var(--space-2xl);
    }

    .section-header h2 {
        font-size: var(--text-2xl);
    }

    /* Standard Product Grids */
    .products-grid,
    .commercial-grid,
    .benefits-grid {
        grid-template-columns: 1fr;
    }

    /* Packages Grid: Explicit 2-Column Grid on Mobile */
    .packages-grid,
    .products-grid.packages-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-sm) !important;
    }

    .packages-grid .product-card,
    .products-grid.packages-grid .product-card {
        padding: var(--space-md) var(--space-sm) !important;
        border-radius: var(--radius-lg) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .packages-grid .product-card h3,
    .products-grid.packages-grid .product-card h3 {
        font-size: var(--text-lg) !important;
        margin-bottom: 2px !important;
    }

    .packages-grid .product-card-capacity,
    .products-grid.packages-grid .product-card-capacity {
        font-size: var(--text-xs) !important;
        margin-bottom: var(--space-xs) !important;
        color: var(--color-lime) !important;
    }

    .packages-grid .product-card-desc,
    .products-grid.packages-grid .product-card-desc {
        font-size: 11px !important;
        line-height: 1.3 !important;
        margin-bottom: var(--space-sm) !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .packages-grid .product-card-features,
    .products-grid.packages-grid .product-card-features {
        font-size: 10px !important;
        margin-bottom: var(--space-md) !important;
        padding-left: 12px !important;
    }

    .packages-grid .product-card-features li,
    .products-grid.packages-grid .product-card-features li {
        margin-bottom: 2px !important;
    }

    .packages-grid .product-card .btn,
    .products-grid.packages-grid .product-card .btn {
        font-size: 11px !important;
        padding: 6px 8px !important;
        width: 100% !important;
        text-align: center !important;
    }

    /* Industries Grid Fix on Mobile */
    .industries-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-sm) !important;
    }

    .industry-card {
        position: relative !important;
        aspect-ratio: 3/4 !important;
        min-height: 210px !important;
        height: 100% !important;
        border-radius: var(--radius-lg) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
    }

    .industry-card-content {
        position: absolute !important;
        inset: 0 !important;
        padding: var(--space-md) var(--space-sm) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        z-index: 2 !important;
        background: linear-gradient(180deg, rgba(10,10,10,0.1) 0%, rgba(10,10,10,0.8) 55%, rgba(10,10,10,0.95) 100%) !important;
    }

    .industry-card h4 {
        font-size: var(--text-sm) !important;
        line-height: 1.2 !important;
        margin-bottom: 4px !important;
        color: var(--color-white) !important;
    }

    .industry-card p {
        font-size: 10px !important;
        line-height: 1.3 !important;
        color: var(--color-muted-light) !important;
        margin-bottom: 6px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .industry-card-zones {
        display: none !important;
    }

    .industry-card .btn {
        font-size: 10px !important;
        padding: 4px 8px !important;
        align-self: flex-start !important;
        margin-top: auto !important;
    }

    .option-grid {
        grid-template-columns: 1fr;
    }

    /* Process Steps (How It Works on Front Page) */
    .process-steps {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: var(--space-md) !important;
        width: 100% !important;
    }

    .process-steps::before {
        display: none !important;
    }

    .process-step {
        flex: none !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        gap: var(--space-md) !important;
        padding: var(--space-md) var(--space-lg) !important;
        background: var(--color-surface) !important;
        border-radius: var(--radius-lg) !important;
        border: 1px solid var(--color-border) !important;
    }

    .process-step-number {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        font-size: var(--text-sm) !important;
        margin-bottom: 0 !important;
        flex-shrink: 0 !important;
    }

    .process-step-label {
        font-size: var(--text-base) !important;
        margin-bottom: 2px !important;
    }

    .process-step-desc {
        font-size: var(--text-xs) !important;
        color: var(--color-muted-light) !important;
        max-width: none !important;
    }

    .process-step-arrow {
        display: none !important;
    }


    /* CTA Section */
    .cta-section {
        padding: var(--space-3xl) 0;
    }

    .cta-section h2 {
        font-size: var(--text-2xl);
    }

    .cta-section .cta-sub {
        font-size: var(--text-lg);
    }

    .cta-section p {
        font-size: var(--text-sm);
    }

    /* ViaZONE */
    .viazone-header h2 {
        font-size: var(--text-2xl);
    }

    .viazone-visual {
        aspect-ratio: 3/4;
        border-radius: var(--radius-lg);
    }

    .zone-marker {
        transform: scale(0.7);
    }

    .zone-marker:hover,
    .zone-marker.active {
        transform: scale(0.8);
    }

    .zone-label {
        font-size: 8px;
    }

    .zone-label .zone-tag {
        font-size: 7px;
    }

    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }

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

    .quote-form {
        padding: var(--space-xl);
    }

    /* Power Finder */
    .power-finder {
        padding: 100px 0 var(--space-2xl);
    }

    .wizard-step-title {
        font-size: var(--text-xl);
    }

    .wizard-step-subtitle {
        font-size: var(--text-sm);
    }

    .power-finder-progress {
        gap: 4px;
    }

    .progress-dot {
        width: 6px;
        height: 6px;
    }

    /* Results */
    .results-grid {
        grid-template-columns: 1fr;
    }

    .result-item {
        padding: var(--space-md);
    }

    .result-item-value {
        font-size: var(--text-2xl);
    }

    /* Account */
    .account-layout {
        grid-template-columns: 1fr;
    }

    .account-sidebar {
        position: static;
        padding: var(--space-lg);
    }

    .account-nav-item {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--text-xs);
    }

    .account-main {
        padding: var(--space-lg) 0;
    }

    /* Footer */
    .site-footer {
        padding: var(--space-4xl) 0 0;
    }

    .footer-main {
        grid-template-columns: 1fr;
        gap: var(--space-3xl);
    }

    .footer-nav {
        grid-template-columns: 1fr 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-lg);
        text-align: center;
    }

    /* Product Card Details (Solutions Page) */
    .product-card h3 {
        font-size: var(--text-xl);
    }

    .product-card-capacity {
        font-size: var(--text-3xl);
    }

/* Industries Page Alternating Layout */
.industry-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4xl);
    align-items: center;
    margin-bottom: var(--space-5xl);
}

.industry-row.reverse {
    direction: rtl;
}

.industry-row > * {
    direction: ltr;
}

@media (max-width: 767px) {
    .industry-row {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--space-xl) !important;
        margin-bottom: var(--space-3xl) !important;
        text-align: left !important;
        direction: ltr !important;
    }
    
    .industry-row.reverse {
        flex-direction: column !important;
        direction: ltr !important;
    }
    
    /* How It Works Steps (Dedicated Page Template) */
    .hiw-step,
    .hiw-step--reverse {
        flex-direction: column !important;
        gap: var(--space-lg) !important;
        align-items: center !important;
        text-align: center !important;
        margin-bottom: var(--space-2xl) !important;
    }

    .hiw-step-num {
        width: 60px !important;
        height: 60px !important;
        margin: 0 auto !important;
        order: -1 !important;
    }

    .hiw-step-num-label {
        font-size: var(--text-xl) !important;
    }

    .hiw-step-content {
        width: 100% !important;
        text-align: center !important;
    }

    .hiw-step-title {
        font-size: var(--text-xl) !important;
    }

    .hiw-step-desc {
        font-size: var(--text-base) !important;
        max-width: none !important;
        margin: 0 auto !important;
    }
}

/* Power Map */
.power-map-visual {
    aspect-ratio: 3/4;
    margin-bottom: var(--space-2xl);
}

.power-map-zone {
    padding: var(--space-xs);
}

.power-map-zone-label {
    font-size: 7px;
}

.power-map-zone-unit {
    font-size: 6px;
}

/* Login/Register Grid */
.login-register-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
}

@media (max-width: 767px) {
    .login-register-grid {
        grid-template-columns: 1fr;
    }
    
    .login-register-grid > div {
        order: -1;
    }
    
    /* Quick Actions Grid */
    .quick-actions-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Power Map Zone Legend */
.power-map-legend {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.power-map-legend-item {
    padding: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

    /* Stats Row */
    .stats-row {
        flex-wrap: wrap;
        gap: var(--space-xl);
        padding: var(--space-xl) 0;
    }

    .stat-item {
        flex: 0 0 calc(50% - var(--space-md));
    }

    .stat-value {
        font-size: var(--text-3xl);
    }

    /* Buttons */
    .btn {
        font-size: var(--text-xs);
        padding: var(--space-sm) var(--space-lg);
    }

    .btn-lg {
        font-size: var(--text-sm);
        padding: var(--space-md) var(--space-2xl);
    }

    /* Mobile Nav */
    .mobile-nav {
        padding: var(--space-xl);
    }

    .mobile-nav .nav-link {
        font-size: var(--text-xl);
        margin-bottom: var(--space-sm);
    }

    /* Quick Actions Grid (Account Dashboard) */
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        font-size: 10px;
        padding: var(--space-md) 0;
    }

    /* Tag */
    .tag {
        font-size: 9px;
        padding: 3px 10px;
    }
}

/* ============================================
   MOBILE MEDIUM (480px - 767px)
   ============================================ */
@media (min-width: 480px) and (max-width: 767px) {
    .hero-title .line-1 {
        font-size: var(--text-5xl);
    }

    .hero-title .line-2 {
        font-size: var(--text-2xl);
    }

    .hero-scroll-indicator {
        display: none !important;
    }

    /* Standard grids */
    .products-grid,
    .benefits-grid {
        grid-template-columns: 1fr;
    }

    /* Packages — keep 2 columns on medium mobile */
    .packages-grid,
    .products-grid.packages-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-sm) !important;
    }

    .packages-grid .product-card,
    .products-grid.packages-grid .product-card {
        padding: var(--space-lg) var(--space-md) !important;
        font-size: var(--text-sm) !important;
    }

    /* Industries — 2 column on medium mobile */
    .industries-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-sm) !important;
    }

    .industry-card {
        aspect-ratio: 3/4 !important;
        min-height: 220px !important;
        overflow: hidden !important;
    }

    .industry-card-content {
        position: absolute !important;
        inset: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        padding: var(--space-md) !important;
        z-index: 2 !important;
        background: linear-gradient(180deg, rgba(10,10,10,0.05) 0%, rgba(10,10,10,0.75) 50%, rgba(10,10,10,0.95) 100%) !important;
    }

    .industry-card-zones {
        display: none !important;
    }

    .industry-card h4 {
        font-size: var(--text-sm) !important;
    }

    .industry-card p {
        font-size: 11px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    /* How It Works steps — center stack on medium mobile */
    .hiw-step,
    .hiw-step--reverse {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: var(--space-lg) !important;
        margin-bottom: var(--space-2xl) !important;
    }

    .hiw-step-num {
        width: 60px !important;
        height: 60px !important;
        margin: 0 auto !important;
        order: -1 !important;
    }

    .hiw-step-num-label {
        font-size: var(--text-xl) !important;
    }

    .hiw-step-content {
        text-align: center !important;
        max-width: none !important;
        width: 100% !important;
    }

    .hiw-step-title {
        font-size: var(--text-xl) !important;
    }

    .hiw-step-desc {
        font-size: var(--text-base) !important;
        max-width: none !important;
    }

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

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

    /* Process Steps (How It Works on Front Page) — wrap to show all 7 steps */
    .process-steps {
        flex-wrap: wrap !important;
        gap: var(--space-lg) !important;
        justify-content: center !important;
    }

    .process-steps::before {
        display: none !important;
    }

    .process-step {
        flex: 0 0 calc(50% - var(--space-md)) !important;
        width: calc(50% - var(--space-md)) !important;
    }

    .process-step-arrow {
        display: none !important;
    }

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

    .stat-item {
        flex: 0 0 calc(50% - var(--space-md));
    }
}

/* ============================================
   TABLET (768px - 1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

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

    .process-steps {
        flex-wrap: wrap;
        gap: var(--space-lg);
        justify-content: center;
    }

    .process-steps::before {
        display: none;
    }

    .process-step {
        flex: 0 0 calc(33.333% - var(--space-md));
    }

    .process-step-arrow {
        display: none;
    }

    .footer-nav {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2xl);
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .account-layout {
        grid-template-columns: 200px 1fr;
    }
}

/* ============================================
   LAPTOP (1025px - 1439px)
   ============================================ */
@media (min-width: 1025px) and (max-width: 1439px) {
    .main-nav {
        display: flex;
    }

    .mobile-menu-toggle {
        display: none;
    }

    .mobile-nav {
        display: none;
    }

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

    .commercial-grid {
        grid-template-columns: repeat(4, 1fr);
    }

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

    .industries-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .process-steps {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .process-step {
        flex: 1;
    }

    .footer-main {
        grid-template-columns: 1.3fr 1fr;
    }

    .account-layout {
        grid-template-columns: 240px 1fr;
    }
}

/* ============================================
   LARGE DESKTOP (1440px+)
   ============================================ */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .hero-title .line-1 {
        font-size: 6rem;
    }

    .account-layout {
        grid-template-columns: 260px 1fr;
    }
}

/* ============================================
   ULTRAWIDE (1920px+)
   ============================================ */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    .hero-title .line-1 {
        font-size: 7rem;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover,
    .benefit-card:hover,
    .industry-card:hover,
    .commercial-card:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    .zone-marker:hover .zone-tooltip {
        opacity: 0;
        visibility: hidden;
    }

    .zone-marker.active .zone-tooltip {
        opacity: 1;
        visibility: visible;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--space-3xl) 0;
    }

    .hero-content {
        padding-top: 80px;
    }

    .hero-scroll-indicator {
        display: none;
    }
}

/* ============================================
   SAFE AREA (Notched Devices)
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
    }

    .mobile-nav {
        padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .fade-in-left,
    .fade-in-right {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .zone-dot,
    .energy-line,
    .hero-scroll-indicator {
        animation: none;
    }

    .product-card,
    .benefit-card,
    .industry-card,
    .commercial-card {
        transition: none;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (forced-colors: active) {
    .btn-primary {
        border: 2px solid currentColor;
    }

    .zone-dot {
        border: 2px solid currentColor;
    }

    .tag {
        border: 1px solid currentColor;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .site-header,
    .site-footer,
    .mobile-nav,
    .mobile-menu-toggle,
    .hero-scroll-indicator,
    .energy-lines,
    .scroll-top,
    .btn {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    .section {
        padding: 2rem 0;
        page-break-inside: avoid;
    }

    .product-card,
    .benefit-card,
    .industry-card {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* ============================================
   MOBILE UTILITY CLASSES
   ============================================ */
@media (max-width: 767px) {
    /* Hide on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Show on mobile only */
    .show-mobile {
        display: block !important;
    }
    
    /* Full width on mobile */
    .full-width-mobile {
        width: 100% !important;
    }
    
    /* Stack buttons on mobile */
    .btn-group-mobile {
        flex-direction: column;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
    }
    
    /* Reduce padding on mobile */
    .section-mobile-sm {
        padding-top: var(--space-2xl) !important;
        padding-bottom: var(--space-2xl) !important;
    }
    
    .section-mobile-xs {
        padding-top: var(--space-xl) !important;
        padding-bottom: var(--space-xl) !important;
    }
}

/* ============================================
   TABLET & UP UTILITY CLASSES
   ============================================ */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}
