/* ============================================
   Comprehensive Responsive Styles
   ============================================ */

/* Ensure viewport meta tag is set (should be in header.php) */
/* This file provides additional responsive utilities */

/* ===== General Responsive Utilities ===== */
@media (max-width: 1024px) {
    /* Tablet adjustments */
    .container {
        padding: 0 20px;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 768px) {
    /* Mobile adjustments */
    .container {
        padding: 0 15px;
    }
    
    /* Ensure all images are responsive */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Tables become scrollable on mobile */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Forms */
    form {
        width: 100%;
    }
    
    /* Buttons full width on mobile */
    .btn-mobile-full {
        width: 100%;
        display: block;
    }
}

@media (max-width: 480px) {
    /* Small mobile adjustments */
    .container {
        padding: 0 10px;
    }
    
    /* Smaller text on very small screens */
    body {
        font-size: 14px;
    }
}

/* ===== Header Responsive ===== */
@media (max-width: 767px) {
    /* Ensure header is fixed and doesn't overflow */
    header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        overflow-x: hidden;
        z-index: 1000;
    }
    
    /* Mobile menu button - shown on mobile */
    #menuBtn {
        display: flex !important;
        z-index: 1001;
    }
    
    /* Desktop menu hidden on mobile */
    header nav.hidden.md\\:flex,
    header nav[class*="hidden"][class*="md"] {
        display: none !important;
    }
    
    /* Mobile menu - fixed overlay */
    #mobileMenu {
        position: fixed !important;
        top: 70px !important;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100vw;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 999;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }
    
    #mobileMenu.hidden {
        display: none !important;
    }
    
    #mobileMenu nav {
        padding: 20px;
    }
    
    #mobileMenu nav a {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid #eee;
        width: 100%;
    }
    
    #mobileMenu nav a:last-child {
        border-bottom: none;
    }
}

/* Desktop - hide mobile button and menu */
@media (min-width: 768px) {
    #menuBtn {
        display: none !important;
    }
    
    #mobileMenu {
        display: none !important;
    }
}

/* ===== Footer Responsive ===== */
@media (max-width: 768px) {
    footer {
        padding: 20px 15px;
        text-align: center;
    }
    
    footer .flex {
        flex-direction: column;
        gap: 15px;
    }
    
    footer .flex > div {
        width: 100%;
        text-align: center;
    }
}

/* ===== Product Cards Responsive ===== */
@media (max-width: 768px) {
    .product-card,
    .car-card {
        width: 100%;
        max-width: 100%;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .product-actions .qty {
        width: 100%;
    }
    
    .product-actions button {
        width: 100%;
    }
}

/* ===== Cart Widget Responsive ===== */
@media (max-width: 768px) {
    .cart-widget {
        position: fixed;
        left: 10px;
        bottom: 10px;
        z-index: 9999;
    }
    
    .cart-panel {
        position: fixed;
        bottom: 70px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: calc(100vw - 20px);
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .cart-item {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .ci-title {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .ci-controls {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===== Contact Float Buttons Responsive ===== */
@media (max-width: 768px) {
    .contact-float {
        flex-direction: column;
        right: 10px;
        bottom: 10px;
        gap: 10px;
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    }
    
    .contact-float a {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .contact-float i {
        font-size: 14px;
    }
    
    /* Hide contact buttons when mobile menu is open */
    body.mobile-menu-open .contact-float {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(20px);
    }
}

@media (max-width: 480px) {
    .contact-float {
        right: 8px;
        bottom: 5px;
    }
    
    .contact-float a {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    /* Hide contact buttons when mobile menu is open */
    body.mobile-menu-open .contact-float {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(20px);
    }
}

/* ===== Forms Responsive ===== */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        width: 100%;
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Form groups */
    .form-group {
        margin-bottom: 15px;
    }
    
    /* Form labels */
    label {
        display: block;
        margin-bottom: 5px;
        font-weight: 600;
    }
}

/* ===== Grids Responsive ===== */
@media (max-width: 768px) {
    /* Convert multi-column grids to single column */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Flex containers stack on mobile */
    .flex-row {
        flex-direction: column;
    }
}

/* ===== Typography Responsive ===== */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.5rem;
        line-height: 1.4;
    }
    
    h4 {
        font-size: 1.25rem;
    }
    
    p {
        font-size: 1rem;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    p {
        font-size: 0.95rem;
    }
}

/* ===== Spacing Responsive ===== */
@media (max-width: 768px) {
    /* Reduce padding on mobile */
    section {
        padding: 40px 15px !important;
    }
    
    .section-padding {
        padding: 40px 15px;
    }
    
    /* Reduce margins */
    .mb-large {
        margin-bottom: 30px;
    }
    
    .mt-large {
        margin-top: 30px;
    }
}

/* ===== Navigation Responsive ===== */
@media (max-width: 768px) {
    /* Dropdown menus */
    .menu-item-has-children > ul {
        position: static;
        display: none;
        box-shadow: none;
        padding-left: 20px;
    }
    
    .menu-item-has-children.active > ul {
        display: block;
    }
    
    /* Sub-sub menus */
    .menu-item-has-children ul li.menu-item-has-children ul {
        position: static;
        right: auto;
        padding-left: 20px;
    }
}

/* ===== Pagination Responsive ===== */
@media (max-width: 768px) {
    .pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ===== Utility Classes ===== */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

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

/* ===== Print Styles ===== */
@media print {
    header,
    footer,
    .contact-float,
    .cart-widget,
    nav {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a {
        text-decoration: underline;
    }
}

