/**
 * Responsive CSS - Media Queries
 *
 * Breakpoints:
 * - Desktop: 1200px+ (default styles)
 * - Tablet Landscape: 992px - 1199px
 * - Tablet Portrait: 768px - 991px
 * - Mobile: 576px - 767px
 * - Small Mobile: < 576px
 *
 * @package K4_Rugged
 */

/* ==========================================================================
   TABLET LANDSCAPE (max-width: 1199px)
   ========================================================================== */

@media (max-width: 1199px) {
    /* Categories Grid */
    .category-card {
        flex: 0 0 calc(33.333% - 14px);
        max-width: calc(33.333% - 14px);
    }

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

    /* Hero */
    .hero h1 {
        font-size: 48px;
    }

    /* Deal Badge */
    .deal-badge {
        right: 40px;
    }

    .deal-badge img {
        width: 180px;
    }

    /* Footer Grid */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
}

/* ==========================================================================
   TABLET PORTRAIT (max-width: 991px)
   ========================================================================== */

@media (max-width: 991px) {
    /* Typography */
    h1 { font-size: 42px; }
    h2 { font-size: 36px; }
    h3 { font-size: 24px; }

    /* Section Padding */
    :root {
        --k4-section-padding: 60px;
    }

    /* Navigation - Hide Desktop, Show Mobile Toggle */
    .main-navigation {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--k4-charcoal);
        z-index: 999;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 40px;
    }

    .main-navigation.is-open {
        display: flex;
    }

    .main-navigation ul {
        flex-direction: column;
        text-align: center;
    }

    .main-navigation a {
        font-size: 20px;
        padding: 15px 30px;
    }

    .main-navigation .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        box-shadow: none;
        border: none;
    }

    .main-navigation .sub-menu.k4-mega,
    .main-navigation li.k4-mega-menu > .sub-menu {
        display: block;
        min-width: 0;
        left: auto;
        transform: none;
    }

    .main-navigation li.k4-mega-menu:hover > .sub-menu {
        transform: none;
    }

    .main-navigation .sub-menu a {
        font-size: 16px;
        border-bottom: none;
    }

    .nav-cta > a,
    .main-navigation .nav-cta > a {
        margin: 20px 0 0;
    }

    .mobile-menu-toggle {
        display: block;
        z-index: 1001;
    }

    .mobile-menu-toggle.active i::before {
        content: "\f00d"; /* Font Awesome times icon */
    }

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

    .hero-slide {
        position: absolute;
        min-height: 500px;
    }

    .hero h1 {
        font-size: 42px;
    }

    .hero-content {
        padding: 60px 20px;
    }

    .hero-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .deal-badge {
        display: none;
    }

    /* Page Hero */
    .page-hero {
        padding: 60px 0;
    }

    .page-hero h1 {
        font-size: 36px;
    }

    /* Entry Content */
    .entry-content h2 { font-size: 30px; }
    .entry-content h3 { font-size: 22px; }

    .entry-content .wp-block-columns {
        gap: 25px;
    }

    /* Inventory Editable Content Zones */
    .inventory-intro { padding: 40px 0 5px; }
    .inventory-intro-heading { font-size: 26px; }
    .inventory-intro-text { font-size: 15px; }
    .inventory-below { padding: 45px 0; }
    .inventory-below-heading { font-size: 26px; }
    .inventory-below-text { font-size: 15px; }

    /* Inventory Page */
    .inventory-container {
        grid-template-columns: 1fr;
    }

    .inventory-sidebar {
        position: static;
        order: -1;
    }

    .filter-content {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* DealSector Desktop/Mobile Content Toggle */
    .inventory_wrapper #content-mobile {
        display: block !important;
    }

    .inventory_wrapper #content-desktop {
        display: none !important;
    }

    /* DealSector tablet adjustments */
    .inventory_wrapper .wp-block-columns {
        flex-wrap: wrap !important;
    }

    .inventory_wrapper .wp-block-columns > .wp-block-column:first-child {
        flex-basis: 100% !important;
    }

    .inventory_wrapper .wp-block-columns > .wp-block-column:nth-child(2) {
        flex-basis: 60% !important;
    }

    .inventory_wrapper .wp-block-columns > .wp-block-column:nth-child(3) {
        flex-basis: 35% !important;
    }

    /* Categories Grid */
    .category-card {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }

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

    /* Content Grid */
    .content-grid {
        grid-template-columns: 1fr;
    }

    .content-sidebar {
        order: -1;
    }

    /* Section Headers */
    .section-header h2 {
        font-size: 32px;
    }

    /* About Section */
    .about-section h2 {
        font-size: 28px;
    }

    .about-highlight {
        font-size: 18px;
    }

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

/* ==========================================================================
   MOBILE (max-width: 767px)
   ========================================================================== */

@media (max-width: 767px) {
    /* Typography */
    h1 { font-size: 32px; }
    h2 { font-size: 28px; }
    h3 { font-size: 20px; }

    /* Container */
    .container {
        padding: 0 15px;
    }

    /* Section Padding */
    :root {
        --k4-section-padding: 50px;
    }

    /* Top Bar */
    .top-bar-inner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .contact-info {
        flex-direction: column;
        gap: 10px;
    }

    /* Header */
    .site-header {
        padding: 10px 0;
    }

    .site-logo img,
    .custom-logo {
        height: 50px;
    }

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

    .hero-slide {
        min-height: 400px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .hero-arrow {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .hero-arrow-prev { left: 10px; }
    .hero-arrow-next { right: 10px; }

    /* Show arrows always on touch devices */
    .hero .hero-arrow {
        opacity: 0.7;
    }

    .hero-dots {
        bottom: 16px;
        gap: 8px;
    }

    .hero-dot {
        width: 10px;
        height: 10px;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* Search Section */
    .search-section h2 {
        font-size: 24px;
    }

    .search-box {
        flex-direction: column;
        clip-path: none;
        border-radius: 8px;
    }

    .search-box input {
        border-radius: 8px 8px 0 0;
    }

    .search-box button {
        clip-path: none;
        border-radius: 0 0 8px 8px;
        margin-left: 0;
    }

    /* Featured Section - Reduce fade edges */
    .featured-section::before,
    .featured-section::after {
        width: 50px;
    }

    .slider-container {
        padding: 0 30px;
    }

    /* Categories Grid */
    .categories-grid {
        gap: 15px;
    }

    .category-card {
        flex: 0 0 calc(50% - 8px);
        max-width: calc(50% - 8px);
        height: 150px;
    }

    .category-overlay h3 {
        font-size: 14px;
    }

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

    .brands-header {
        padding: 12px 25px;
    }

    .brands-header h2 {
        font-size: 22px;
    }

    .brand-logo {
        height: 60px;
        padding: 15px;
    }

    /* About Section */
    .about-inner {
        padding: 0 15px;
    }

    .about-section h2 {
        font-size: 24px;
    }

    .about-highlight {
        font-size: 16px;
    }

    .years-badge {
        padding: 15px 25px;
        flex-direction: column;
        text-align: center;
    }

    .years-badge .number {
        font-size: 40px;
    }

    .years-badge .text {
        text-align: center;
    }

    /* Inventory Editable Content Zones (mobile) */
    .inventory-intro { padding: 30px 0 0; }
    .inventory-intro-heading { font-size: 22px; }
    .inventory-intro-text { font-size: 14px; padding: 0 5px; }
    .inventory-below { padding: 35px 0; }
    .inventory-below-heading { font-size: 22px; }
    .inventory-below-text { font-size: 14px; padding: 0 5px; }

    /* Inventory Page */
    .inventory-section {
        padding: 40px 0;
    }

    .inventory-container {
        gap: 30px;
        padding: 0 15px;
    }

    .filter-content {
        grid-template-columns: 1fr;
    }

    .filter-header {
        clip-path: none;
    }

    .inventory-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .inventory-cta {
        padding: 50px 0;
    }

    .inventory-cta h2 {
        font-size: 28px;
    }

    .inventory-cta .cta-buttons {
        flex-direction: column;
    }

    .inventory-cta .cta-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* DealSector Inventory Mobile Optimizations */
    .inventory_wrapper .wp-block-columns {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .inventory_wrapper .wp-block-column {
        flex-basis: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    /* Mobile: Stack price below title */
    .inventory_wrapper .wp-block-columns > .wp-block-column:last-child {
        text-align: left !important;
    }

    /* Mobile: Larger touch targets for buttons */
    .inventory_wrapper .wp-block-button .wp-block-button__link {
        padding: 18px 20px !important;
        font-size: 16px !important;
        min-height: 54px !important;
    }

    /* Mobile: Full-width action buttons */
    .inventory_wrapper .wp-block-buttons {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }

    /* Mobile: Item title sizing */
    .inventory_wrapper a[style*="text-transform: uppercase"] {
        font-size: 20px !important;
    }

    /* Mobile: Price sizing */
    .inventory_wrapper .dssalePrice,
    .inventory_wrapper [style*="color: #b71e22"],
    .inventory_wrapper [style*="color:#b71e22"] {
        font-size: 24px !important;
    }

    /* Mobile: Specs table responsive */
    .inventory_wrapper figure.wp-block-table {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .inventory_wrapper figure.wp-block-table table {
        min-width: 100% !important;
    }

    .inventory_wrapper figure.wp-block-table td {
        padding: 12px 10px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    /* Mobile: Custom quote bar */
    .inventory_wrapper .inventory_custom_button1 {
        flex-direction: column !important;
        text-align: center !important;
        gap: 12px !important;
        padding: 20px 15px !important;
    }

    /* Mobile: Sidebar contact box */
    .sidebar-contact-box {
        text-align: center;
    }

    .sidebar-contact-box .btn {
        width: 100%;
        justify-content: center;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-col {
        text-align: center;
    }

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

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

    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    /* Buttons */
    .btn {
        padding: 12px 25px;
        font-size: 14px;
    }

    .btn-lg {
        padding: 15px 30px;
        font-size: 16px;
    }

    /* Inventory Cards */
    .inventory-card-content {
        padding: 15px;
    }

    .inventory-card h3 {
        font-size: 14px;
        height: auto;
    }

    .price-sale {
        font-size: 20px;
    }

    /* Page Hero */
    .page-hero {
        padding: 50px 0;
    }

    .page-hero h1 {
        font-size: 28px;
    }

    /* Entry Content Mobile */
    .entry-content {
        font-size: 16px;
    }

    .entry-content h2 {
        font-size: 26px;
        margin-top: 35px;
    }

    .entry-content h3 {
        font-size: 20px;
        margin-top: 30px;
    }

    .entry-content .wp-block-columns {
        flex-direction: column;
    }

    .entry-content .wp-block-media-text {
        grid-template-columns: 1fr !important;
    }

    .entry-content .wp-block-media-text .wp-block-media-text__media {
        grid-row: 1;
    }

    .entry-content .wp-block-media-text .wp-block-media-text__content {
        grid-row: 2;
        padding: 20px 0 !important;
    }

    .entry-content blockquote,
    .entry-content .wp-block-quote {
        padding: 20px;
    }

    .entry-content blockquote p {
        font-size: 17px;
    }

    /* Service Cards */
    .service-card {
        padding: 30px 20px;
    }

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

    /* CTA Boxes */
    .cta-box {
        padding: 20px;
    }

    /* Contact Info Box */
    .contact-info-box {
        padding: 25px;
    }

    /* Financing Features */
    .financing-features {
        flex-direction: column;
    }

    .feature-item {
        justify-content: center;
    }

    /* Post Navigation */
    .post-navigation {
        flex-direction: column;
    }

    .nav-next {
        text-align: left;
    }
}

/* ==========================================================================
   SMALL MOBILE (max-width: 575px)
   ========================================================================== */

@media (max-width: 575px) {
    /* Typography */
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }

    /* Categories Grid */
    .category-card {
        flex: 0 0 100%;
        max-width: 100%;
        height: 180px;
    }

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

    /* Hero */
    .hero h1 {
        font-size: 28px;
    }

    .hero-badge {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Section Headers */
    .section-header h2 {
        font-size: 24px;
    }

    /* LightSlider Arrows */
    .lSAction > .lSPrev {
        left: -40px !important;
    }

    .lSAction > .lSNext {
        right: -40px !important;
    }

    .lSAction > a {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ==========================================================================
   LANDSCAPE ORIENTATION FIXES
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        height: auto;
        padding: 40px 0;
    }

    .hero-content {
        padding: 40px 20px;
    }

    .main-navigation {
        overflow-y: auto;
    }
}

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

@media print {
    /* Hide non-essential elements */
    .top-bar,
    .site-header,
    .hero,
    .search-section,
    .featured-section,
    .deal-badge,
    .social-icons,
    .footer-social,
    nav,
    .btn,
    video,
    audio {
        display: none !important;
    }

    /* Reset colors */
    body {
        background: white !important;
        color: black !important;
    }

    /* Reset links */
    a {
        color: black !important;
        text-decoration: underline !important;
    }

    /* Show URLs */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 12px;
    }

    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Footer */
    .site-footer {
        background: white !important;
        color: black !important;
        border-top: 1px solid #ccc;
    }
}

/* ==========================================================================
   HIGH CONTRAST MODE
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --k4-primary-red: #ff0000;
        --k4-concrete: #666666;
    }

    .btn-primary {
        border: 2px solid white;
    }

    .main-navigation a {
        border-bottom-width: 4px;
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .deal-badge img {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}
