/* ======================================
   Responsive Enhancements for PuffyB2B
   ====================================== */

/* ============= Mobile First Approach ============= */

/* Extra Small Devices (Portrait Phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Typography Adjustments */
    h1 {
        font-size: 28px !important;
        line-height: 1.3em;
    }

    h2 {
        font-size: 24px !important;
    }

    h3 {
        font-size: 20px !important;
    }

    h4 {
        font-size: 18px !important;
    }

    /* Banner Headers */
    .banner-header h1 {
        font-size: 32px !important;
    }

    .banner-header h6 {
        font-size: 12px !important;
    }

    /* Section Padding */
    .section-padding {
        padding: 40px 0 !important;
    }

    /* Navigation Adjustments */
    .navbar-nav {
        padding: 15px 0;
    }

    .navbar-nav .nav-item {
        padding: 8px 0;
        text-align: center;
    }

    .navbar-nav .dropdown-menu {
        width: 100%;
        text-align: center;
    }

    /* User Account Dropdown Mobile */
    #user-account {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 10px 0 !important;
    }

    #user-account .dropdown {
        width: 100%;
        text-align: center;
    }

    #user-account .cart-icon-wrapper {
        width: 100%;
        text-align: center;
    }

    /* Forms */
    .login-form,
    .reg-form {
        padding: 20px 15px !important;
    }

    .form-group {
        margin-bottom: 15px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
    }

    .button-1,
    .button-2,
    .button-3,
    button[type="submit"] {
        width: 100%;
        padding: 12px 20px !important;
        font-size: 14px !important;
        margin-bottom: 10px;
    }

    /* Login/Register Links */
    .form-group .row .col-md-6 {
        text-align: center !important;
        margin-bottom: 10px;
    }

    .form-group .row .col-md-6.text-right {
        text-align: center !important;
    }

    /* Contact Page */
    .contact-box .item {
        margin-bottom: 20px;
        padding: 20px 15px !important;
    }

    .contact-box .col-lg-3,
    .contact-box .col-md-6 {
        margin-bottom: 15px;
    }

    /* Google Maps Responsive */
    .google-map iframe {
        width: 100% !important;
        height: 300px !important;
    }

    /* Product Grid */
    .cars1 .item {
        margin-bottom: 30px;
    }

    .cars1 .con .row {
        flex-direction: column;
    }

    .cars1 .con .book {
        margin-top: 15px;
        text-align: center;
    }

    /* Item Details */
    .car-details .col-lg-8,
    .car-details .col-lg-4 {
        margin-bottom: 30px;
    }

    /* Gallery Grid */
    .gallery-items .col-md-4 {
        margin-bottom: 15px;
    }

    /* Blog Grid */
    .post .content {
        padding: 15px !important;
    }

    .post .title a {
        font-size: 18px !important;
    }

    /* Footer */
    .footer .widget-area {
        margin-bottom: 30px;
        text-align: center;
    }

    .footer .second-footer .row {
        text-align: center;
    }

    .footer .social-icons ul {
        justify-content: center;
    }

    .footer-contact-links-wrapper {
        flex-direction: column !important;
    }

    .footer-contact-link-wrapper {
        margin-bottom: 20px !important;
        width: 100% !important;
    }

    .footer-contact-links-divider {
        display: none !important;
    }

    /* App Section */
    .app .button-3 {
        width: 100%;
        margin-bottom: 10px !important;
        margin-right: 0 !important;
    }

    /* Hide Large Images on Mobile */
    .app .col-lg-4 img {
        display: none;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px !important;
    }

    table th,
    table td {
        padding: 8px 4px !important;
        white-space: nowrap;
    }

    /* Modals */
    .modal-dialog {
        margin: 10px !important;
    }

    .modal-body {
        padding: 15px !important;
    }

    /* Cart */
    .cart-icon-wrapper .cart-count {
        font-size: 10px;
        padding: 2px 5px;
    }
}

/* Small Devices (Landscape Phones, 576px to 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Typography */
    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 28px;
    }

    /* Banner Headers */
    .banner-header h1 {
        font-size: 36px;
    }

    /* Forms - 2 columns */
    .reg-form .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Contact Box */
    .contact-box .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Google Maps */
    .google-map iframe {
        width: 100% !important;
        height: 350px !important;
    }

    /* Product Grid - 2 columns */
    .cars1 .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Medium Devices (Tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navbar */
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.95);
        padding: 15px;
        margin-top: 10px;
        border-radius: 5px;
    }

    /* Typography */
    h1 {
        font-size: 36px;
    }

    h2 {
        font-size: 30px;
    }

    /* Forms */
    .login-form,
    .reg-form {
        padding: 30px;
    }

    /* Google Maps */
    .google-map iframe {
        width: 100% !important;
        height: 400px !important;
    }

    /* Footer */
    .footer .col-md-3,
    .footer .col-md-4 {
        margin-bottom: 30px;
    }

    /* Product Grid */
    .cars1 .item .con .row {
        align-items: center;
    }
}

/* Large Devices (Desktops, 992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Container Adjustments */
    .container {
        max-width: 960px;
    }

    /* Typography Fine-tuning */
    h1 {
        font-size: 38px;
    }

    /* Navbar */
    .navbar-nav .nav-item {
        padding: 0 10px;
    }
}

/* ============= Additional Responsive Utilities ============= */

/* Landscape Orientation Specific */
@media (max-width: 767px) and (orientation: landscape) {
    .banner-header {
        min-height: 300px !important;
    }

    .banner-header.section-padding {
        padding: 60px 0 !important;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ============= Component-Specific Responsive Fixes ============= */

/* Registration Form - Company Fields */
@media (max-width: 767px) {
    #companyFields,
    #companyFields2 {
        margin-top: 10px;
    }

    .reg-form .col-md-12.text-center {
        margin-top: 20px;
    }
}

/* Item Details - Sidebar */
@media (max-width: 991px) {
    .car-details .sidebar {
        margin-top: 40px;
    }
}

/* Blog Single - Sidebar */
@media (max-width: 991px) {
    .blog-single .sidebar {
        margin-top: 40px;
    }
}

/* Accordion */
@media (max-width: 767px) {
    .accordion-box .acc-btn {
        font-size: 14px;
        padding: 12px 15px;
    }

    .accordion-box .acc-content {
        padding: 10px 15px;
    }
}

/* Owl Carousel - Touch Optimization */
.owl-carousel {
    -webkit-tap-highlight-color: transparent;
}

/* Slider Touch */
.header.slider .owl-carousel .item {
    min-height: 400px;
}

@media (max-width: 767px) {
    .header.slider .owl-carousel .item {
        min-height: 300px;
    }
}

/* ============= Admin Panel Responsive Enhancements ============= */

@media (max-width: 991px) {
    /* Admin Tables */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Admin Buttons */
    .btn-group {
        display: flex;
        flex-direction: column;
    }

    .btn-group .btn {
        margin-bottom: 5px;
        width: 100%;
    }

    /* Admin Cards */
    .card {
        margin-bottom: 20px;
    }

    /* Admin Forms */
    .form-group .col-md-6 {
        margin-bottom: 15px;
    }
}

@media (max-width: 767px) {
    /* Admin Panel Specific */
    .horizontal-menu {
        position: relative;
    }

    /* Material Order Tables */
    #MaterialOrderTbl,
    #PendingOrderTbl {
        font-size: 11px;
    }

    #MaterialOrderTbl td,
    #MaterialOrderTbl th,
    #PendingOrderTbl td,
    #PendingOrderTbl th {
        padding: 6px 3px !important;
        vertical-align: middle;
    }

    #MaterialOrderTbl .btn,
    #PendingOrderTbl .btn {
        font-size: 10px;
        padding: 4px 8px;
        margin: 2px 0;
    }

    /* Admin Modal */
    .modal-dialog {
        max-width: 95%;
        margin: 10px auto;
    }
}

/* ============= Utility Classes ============= */

/* Show/Hide on Different Screens */
.mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }
}

/* Text Alignment Responsive */
@media (max-width: 767px) {
    .text-md-left,
    .text-md-right,
    .text-md-center {
        text-align: center !important;
    }
}

/* Spacing Utilities */
@media (max-width: 767px) {
    .mb-xs-30 {
        margin-bottom: 30px !important;
    }

    .mt-xs-30 {
        margin-top: 30px !important;
    }

    .p-xs-15 {
        padding: 15px !important;
    }
}

/* ============= Accessibility Improvements ============= */

/* Touch Target Size (minimum 44x44px for mobile) */
@media (max-width: 767px) {
    a,
    button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Exception for inline links in paragraphs */
    p a {
        min-height: auto;
        min-width: auto;
        display: inline;
    }
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #aa8453;
    outline-offset: 2px;
}

/* ============= Performance Optimizations ============= */

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============= Print Styles ============= */

@media print {
    .navbar,
    .footer,
    .app,
    .btn,
    button {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
    }
}
