/* ============================================
   AIO TECH SOLUTIONS - Responsive Styles
   ============================================ */

/* Breakpoints:
   - Mobile:     < 576px
   - Tablet:     576px - 768px
   - Tablet-lg:  768px - 992px
   - Desktop:    992px - 1200px
   - Desktop-lg: > 1200px
*/

/* ---- LARGE DESKTOP (1200px+) ---- */
@media (min-width: 1200px) {
    .container {
        padding: 0 var(--space-xl);
    }
}

/* ---- DESKTOP & BELOW (max 1200px) ---- */
@media (max-width: 1199px) {
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }

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

    /* Brands */
    .brands-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Bento */
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .bento-large     { grid-column: 1 / 3; grid-row: auto; }
    .bento-medium:nth-child(2) { grid-column: auto; grid-row: auto; }
    .bento-medium:nth-child(3) { grid-column: auto; grid-row: auto; }
    .bento-small:nth-child(4)  { grid-column: auto; grid-row: auto; }
    .bento-small:nth-child(5)  { grid-column: auto; grid-row: auto; }
    .bento-small:nth-child(6)  { grid-column: auto; grid-row: auto; }
    .bento-wide      { grid-column: 1 / 3; grid-row: auto; }
}

/* ---- TABLET LANDSCAPE & BELOW (max 992px) ---- */
@media (max-width: 991px) {
    :root {
        --header-height: 70px;
    }

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

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

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

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

    /* Top bar */
    .top-bar-left {
        display: none;
    }

    .top-bar-right {
        width: 100%;
        justify-content: center;
    }

    /* Hide desktop nav, show hamburger */
    .nav-links {
        display: none;
    }

    .nav-phone {
        display: none !important;
    }

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

    /* Mega menu not needed on mobile */
    .dropdown-menu {
        display: none !important;
    }

    /* Hero */
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding: var(--space-3xl) 0;
    }

    .hero-subtitle {
        max-width: 100%;
    }

    .hero-ctas {
        justify-content: center;
    }

    .hero-features {
        justify-content: center;
    }

    .hero-visual {
        display: none;
    }

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

    .stat-item:nth-child(2)::after {
        display: none;
    }

    /* Services */
    .services-duo {
        grid-template-columns: 1fr;
    }

    /* Repair CTA */
    .repair-cta-content {
        flex-direction: column;
        text-align: center;
    }

    .repair-cta-text p {
        max-width: 100%;
    }

    .repair-cta-actions {
        justify-content: center;
    }

    /* Newsletter CTA */
    .newsletter-cta-content {
        flex-direction: column;
        text-align: center;
    }

    .newsletter-cta-text p {
        max-width: 100%;
    }

    .newsletter-cta-note {
        text-align: center;
    }

    /* Shop Page */
    .shop-layout {
        grid-template-columns: 1fr;
    }

    .shop-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 310px;
        height: 100vh;
        z-index: 1100;
        border-radius: 0;
        overflow-y: auto;
        transition: left var(--transition);
        background: var(--white);
        padding: 0 var(--space-lg) var(--space-lg);
    }

    .shop-sidebar .sidebar-header {
        display: flex;
    }

    .shop-sidebar.active {
        left: 0;
    }

    .shop-sidebar-overlay.active {
        display: block;
    }

    .sidebar-close {
        display: flex;
    }

    .filter-toggle-btn {
        display: flex;
    }

    #shop-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Cart */
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
    }

    /* Checkout */
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .checkout-summary-card {
        position: sticky;
        top: calc(var(--header-height, 70px) + 1rem);
    }

    .checkout-steps span {
        display: none;
    }

    .step-line {
        margin-bottom: 0;
    }

    /* Contact */
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .contact-map {
        height: 300px;
    }

    .wholesale-wrapper {
        grid-template-columns: 1fr;
    }

    /* New pages */
    .track-layout {
        grid-template-columns: 1fr;
    }

    .track-form-card {
        position: static;
    }

    .confirmation-info {
        grid-template-columns: 1fr;
    }

    .refurb-intro {
        grid-template-columns: 1fr;
    }

    .legal-highlight-grid {
        grid-template-columns: 1fr;
    }

    .wholesale-hero-grid {
        grid-template-columns: 1fr;
    }

    .wholesale-hero-image {
        display: none;
    }

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

    .contact-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* About */
    .about-story {
        grid-template-columns: 1fr;
    }

    .about-story-visual {
        display: none;
    }

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

    .mission-vision-grid {
        grid-template-columns: 1fr;
    }

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

    /* Repairs */
    .how-steps {
        flex-direction: column;
        align-items: center;
    }

    .how-step {
        max-width: 400px;
    }

    .how-step-connector {
        transform: rotate(90deg);
        padding-top: 0;
    }

    .repair-booking-wrapper {
        grid-template-columns: 1fr;
    }

    /* Product Detail */
    .product-detail {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .product-gallery {
        position: static;
    }

    .description-features {
        grid-template-columns: 1fr;
    }

    .reviews-summary {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* Footer 2-column on tablet */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

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

/* ---- TABLET PORTRAIT & BELOW (max 768px) ---- */
@media (max-width: 767px) {
    :root {
        --header-height: 64px;
    }

    html {
        font-size: 15px;
    }

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

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

    .container {
        padding: 0 var(--space-md);
    }

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

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

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

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

    /* Top bar hide completely on mobile */
    .top-bar {
        display: none;
    }

    /* Navbar */
    .nav-logo-img {
        width: 38px;
        height: 38px;
    }

    .nav-logo-name {
        font-size: 1.1rem;
    }

    .nav-logo-tagline {
        font-size: 0.6rem;
    }

    .nav-action-btn {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .nav-actions {
        gap: var(--space-xs);
    }

    /* Buttons stack on mobile */
    .btn-group-mobile {
        flex-direction: column;
        width: 100%;
    }

    .btn-group-mobile .btn {
        width: 100%;
    }

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

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-xl) !important;
        text-align: center;
    }

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

    .footer-trust {
        align-items: center;
    }

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

    .footer-heading::after {
        left: 50%;
        transform: translateX(-50%);
    }

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

    .footer-contact li {
        justify-content: center;
        text-align: left;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }

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

    .payment-icons {
        justify-content: center;
    }

    /* Back to top */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    /* Search overlay */
    .search-suggestions {
        margin-top: var(--space-md);
    }

    .search-input {
        font-size: 0.95rem;
    }

    /* Mobile menu wider on tablet */
    .mobile-menu {
        width: 300px;
        right: -300px;
    }

    /* Hero */
    .hero {
        min-height: auto;
    }

    .hero-content {
        padding: var(--space-2xl) 0;
    }

    .hero-badge {
        font-size: 0.72rem;
    }

    .hero-ctas {
        flex-direction: column;
        align-items: center;
    }

    .hero-ctas .btn {
        width: 100%;
        max-width: 300px;
    }

    .hero-features {
        flex-direction: column;
        align-items: center;
        gap: var(--space-sm);
    }

    /* Stats */
    .stats-bar {
        margin-top: 0;
        border-radius: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .stat-item {
        flex-direction: column;
        text-align: center;
    }

    .stat-item::after {
        display: none !important;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    /* Brands */
    .brands-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-sm);
    }

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

    .brand-item i {
        font-size: 1.4rem;
    }

    /* Testimonials */
    .testimonial-card {
        padding: var(--space-lg);
    }

    .testimonial-text {
        font-size: 0.95rem;
    }

    /* Newsletter CTA */
    .newsletter-cta-input-group {
        flex-direction: column;
    }

    .newsletter-cta-input-group input {
        min-width: auto;
        width: 100%;
    }

    .newsletter-cta-input-group .btn {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }

    /* Shop toolbar */
    .shop-toolbar {
        padding: var(--space-sm) var(--space-md);
    }

    .shop-sort label {
        display: none;
    }

    .shop-sort .form-control {
        min-width: 130px;
    }

    .shop-view-toggle {
        display: none;
    }

    /* List view off on mobile */
    .products-grid.list-view {
        grid-template-columns: 1fr !important;
    }

    .products-grid.list-view .product-card {
        grid-template-columns: 1fr;
    }

    /* Product detail mobile */
    .product-info-highlights {
        grid-template-columns: 1fr;
    }

    .product-trust-info {
        grid-template-columns: 1fr;
    }

    .product-actions {
        flex-direction: column;
    }

    .product-actions .add-to-cart-btn {
        width: 100%;
    }

    .quantity-selector {
        width: 100%;
        justify-content: center;
    }

    .product-info-price-box {
        flex-wrap: wrap;
    }

    .review-date {
        display: none;
    }

    .specs-table th {
        width: 120px;
        font-size: 0.82rem;
    }

    .specs-table td {
        font-size: 0.82rem;
    }

    .product-tabs-nav {
        gap: 0;
    }

    .product-tab-btn {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }

    /* Repair service cards */
    .repair-service-card {
        padding: var(--space-lg);
    }

    .repair-service-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    /* FAQ */
    .faq-question {
        padding: 0.9rem var(--space-md);
        font-size: 0.88rem;
    }

    .faq-item.open .faq-answer {
        padding: 0 var(--space-md) var(--space-md);
    }

    /* Checkout mobile */
    .checkout-block {
        padding: var(--space-lg);
    }

    .stripe-placeholder-row.stripe-row-split {
        flex-direction: column;
    }

    /* Cart mobile */
    .cart-header-row {
        display: none;
    }

    .cart-item {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
        position: relative;
        padding: var(--space-md);
    }

    .cart-product-info {
        padding-right: 40px;
    }

    .cart-remove-btn {
        position: absolute;
        top: var(--space-sm);
        right: var(--space-sm);
    }

    .cart-price::before { content: 'Price: '; font-weight: 400; color: var(--text-muted); }
    .cart-subtotal::before { content: 'Subtotal: '; font-weight: 400; color: var(--text-muted); font-family: var(--font-primary); }

    .cart-actions-bar {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .cart-actions-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* Contact mobile */
    .contact-cards-grid {
        grid-template-columns: 1fr !important;
    }

    .contact-form {
        padding: var(--space-lg);
    }

    .wholesale-form {
        padding: var(--space-lg);
    }

    /* About mobile */
    .about-story-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .mv-card {
        padding: var(--space-lg);
    }

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

    .timeline {
        padding-left: 30px;
    }

    .timeline-marker {
        left: -23px;
        width: 12px;
        height: 12px;
    }

    .timeline-content {
        padding: var(--space-md);
    }
}

/* ---- MOBILE (max 576px) ---- */
@media (max-width: 575px) {
    html {
        font-size: 14px;
    }

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

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

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

    .btn-lg {
        padding: 0.85rem 1.75rem;
        font-size: 0.95rem;
    }

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

    /* Cards full width on small screens */
    .product-card-body {
        padding: var(--space-sm) var(--space-md) var(--space-md);
    }

    .product-card-title {
        font-size: 0.9rem;
    }

    .product-card-price .current-price {
        font-size: 1.05rem;
    }

    /* Stats single col */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Brands smaller */
    .brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Bento single column */
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-large,
    .bento-wide {
        grid-column: auto;
    }

    .bento-large {
        min-height: 240px;
    }

    .bento-card {
        min-height: 150px;
    }

    /* Featured tabs scroll */
    .featured-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--space-sm);
        -webkit-overflow-scrolling: touch;
    }

    .featured-tab {
        flex-shrink: 0;
    }

    /* Services card */
    .service-card {
        padding: var(--space-lg);
    }

    /* Shop single col on small mobile */
    #shop-products-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- SMALL MOBILE (max 375px) ---- */
@media (max-width: 375px) {
    .container {
        padding: 0 var(--space-sm);
    }

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

/* ---- HIDE/SHOW UTILITIES PER BREAKPOINT ---- */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

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

    .show-mobile {
        display: block !important;
    }
}

.hide-tablet {
    display: block;
}

.show-tablet {
    display: none;
}

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

    .show-tablet {
        display: block !important;
    }
}


/* ---- PRINT STYLES ---- */
@media print {
    .top-bar,
    #site-header,
    #site-footer,
    .back-to-top,
    .mobile-menu,
    .mobile-menu-overlay,
    .cart-notification,
    .btn,
    .hero,
    .newsletter-cta,
    .repair-cta-banner {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

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

    .section {
        padding: 20px 0;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    img {
        max-width: 100% !important;
    }
}


/* ---- ACCESSIBILITY: FOCUS STYLES ---- */
*:focus-visible {
    outline: 3px solid #2E8B3C;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #2E8B3C;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: #1B2A4A;
    color: #fff;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
}

/* Reduced motion preference */
@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;
    }
}
