/* ============================================================================
   FINAL RESPONSIVE DESIGN FIXES
   Comprehensive CSS fixes for desktop and mobile responsiveness
   ============================================================================ */

/* --------------------------------------------------------------------------
   Minimal Tailwind-like utility shims used by the home template
   These provide small spacing/text utilities the template expects.
   Note: this is intentionally small — prefer migrating to Bootstrap utilities
 -------------------------------------------------------------------------- */
.py-6 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.max-w-2xl { max-width: 42rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.text-xl { font-size: 1.25rem !important; }
.font-bold { font-weight: 700 !important; }
.text-gray-900 { color: #111827 !important; }
.text-gray-600 { color: #4b5563 !important; }
.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.gap-2 { gap: 0.5rem !important; }
.hidden { display: none !important; }

/* Small screens (>=576px) */
@media (min-width: 576px) {
    .sm\:py-8 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .sm\:px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
    .sm\:text-2xl { font-size: 1.5rem !important; }
    .sm\:flex-row { flex-direction: row !important; }
    .sm\:gap-3 { gap: 0.75rem !important; }
    .sm\:inline { display: inline !important; }
    .sm\:hidden { display: none !important; }
}

/* Medium screens (>=768px) */
@media (min-width: 768px) {
    .md\:py-10 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .md\:px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
    .md\:text-3xl { font-size: 1.875rem !important; }
}


/* Viewport-specific adjustments */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ============================================================================
   1. TOP NAVIGATION BAR - RESPONSIVE FIXES
   ============================================================================ */

/* Top Menubar Container */
.top-menubar {
    width: 100%;
    overflow-x: hidden;
}

.top-menubar .topmenu {
    padding: 10px 0;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

/* Mobile: Stack and simplify top navigation */
@media (max-width: 575px) {
    .top-menubar .topmenu .container {
        padding: 0.5rem !important;
    }

    .top-menubar .topmenu .row {
        flex-direction: column;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .top-menubar .topmenu .col-md-7,
    .top-menubar .topmenu .col-md-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
    }

    .top-contacts {
        font-size: 11px !important;
        flex-wrap: wrap;
    }

    .top-contacts li {
        margin-right: 5px !important;
        margin-bottom: 5px;
    }

    .top-contacts i {
        margin-right: 3px;
    }

    .top-contacts a {
        text-decoration: none;
        word-break: break-word;
    }
}

/* Tablet: Adjust top navigation */
@media (min-width: 576px) and (max-width: 767px) {
    .top-menubar .topmenu .container {
        padding: 0.75rem !important;
    }

    .top-contacts {
        font-size: 12px !important;
    }

    .top-contacts li {
        margin-right: 10px !important;
    }

    .top-data a {
        margin: 0 3px;
    }
}

/* Desktop: Default top navigation */
@media (min-width: 768px) {
    .top-menubar .topmenu .container {
        padding: 1rem !important;
    }

    .top-contacts {
        font-size: 13px !important;
    }

    .top-data a {
        margin: 0 5px;
    }
}

/* ============================================================================
   2. TOP NAVIGATION SEARCH FORM - RESPONSIVE FIXES
   ============================================================================ */

/* Search form container - Mobile first */
#topRepairSearchForm {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    width: 100%;
}

#topRepairSearchForm .form-control {
    flex: 1 1 auto;
    min-width: 100px;
    font-size: 11px;
    padding: 6px 8px;
    height: auto;
    min-height: 32px;
}

#topRepairSearchBtn {
    flex: 0 0 auto;
    min-width: 32px;
    padding: 6px 12px;
    font-size: 12px;
    height: 32px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Extra small devices (< 420px) */
@media (max-width: 419px) {
    #topRepairInvoiceInput {
        width: 100% !important;
        flex: 1 1 100% !important;
        max-width: none !important;
        margin-bottom: 5px;
    }

    #topRepairSearchBtn {
        flex: 1 1 100% !important;
        max-width: none !important;
        width: 100%;
    }

    #topRepairSearchForm {
        flex-direction: column;
    }
}

/* Small devices (420px - 576px) */
@media (min-width: 420px) and (max-width: 576px) {
    #topRepairInvoiceInput {
        flex: 1 1 150px;
        min-width: 120px;
    }

    #topRepairSearchBtn {
        min-width: 40px;
    }
}

/* Medium devices (576px - 768px) */
@media (min-width: 577px) and (max-width: 767px) {
    #topRepairInvoiceInput {
        flex: 1 1 180px;
        min-width: 150px;
    }

    #topRepairSearchBtn {
        min-width: 45px;
    }
}

/* Tablets and above (768px+) */
@media (min-width: 768px) {
    #topRepairInvoiceInput {
        flex: 1 1 200px;
        min-width: 180px;
    }

    #topRepairSearchBtn {
        min-width: 50px;
    }
}

/* ============================================================================
   3. BOOTSTRAP GRID - RESPONSIVE FIXES
   ============================================================================ */

/* Col-md adjustments for tablets */
@media (max-width: 767px) {
    .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
    .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Row margin fixes */
.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row > [class^="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* ============================================================================
   4. FORM CONTROLS - MOBILE FRIENDLY
   ============================================================================ */

/* Prevent iOS zoom on input focus */
@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important; /* iOS zoom prevention */
    }
}

/* ============================================================================
   5. UTILITIES - RESPONSIVE DISPLAY
   ============================================================================ */

/* Hide for mobile */
@media (max-width: 575px) {
    .d-hidden-mobile {
        display: none !important;
    }
}

/* Hide for tablet */
@media (max-width: 767px) {
    .d-hidden-tablet {
        display: none !important;
    }
}

/* Hide for desktop */
@media (min-width: 768px) {
    .d-hidden-desktop {
        display: none !important;
    }
}

/* Show only on mobile */
@media (min-width: 576px) {
    .d-mobile-only {
        display: none !important;
    }
}

/* ============================================================================
   6. GENERAL RESPONSIVE FIXES
   ============================================================================ */

/* Ensure all elements respect viewport */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Responsive embedded content */
iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* ============================================================================
   7. TOUCH-FRIENDLY ELEMENTS - Mobile First
   ============================================================================ */

/* Ensure touch targets are at least 44x44px */
button,
a.btn,
.button,
input[type="submit"],
input[type="button"],
input[type="checkbox"],
input[type="radio"] {
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
}

/* ============================================================================
   8. SPACING UTILITIES - MOBILE FIRST
   ============================================================================ */

/* Mobile-first padding */
@media (max-width: 575px) {
    .container,
    .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    section {
        padding: 1rem !important;
    }
}

/* Tablet and above */
@media (min-width: 576px) {
    .container,
    .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    section {
        padding: 1.5rem !important;
    }
}

/* Desktop */
@media (min-width: 992px) {
    section {
        padding: 2rem !important;
    }
}

/* ============================================================================
   9. OVERFLOW AND SCROLLING FIXES
   ============================================================================ */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden !important;
    width: 100%;
    height: 100%;
}

main {
    width: 100%;
    overflow-x: hidden;
}

/* ============================================================================
   10. PRINT STYLES - RESPONSIVE PRINTING
   ============================================================================ */

@media print {
    * {
        background: transparent !important;
        color: #000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
        width: auto !important;
    }

    body {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .no-print,
    .btn,
    .navbar,
    footer {
        display: none !important;
    }
}


/* ==========================================================================
   FIX: Ensure page sections are visible above carousel/overlay on desktop
   Some themes use a full-screen carousel overlay that can visually cover
   the following sections. Set sensible stacking context so sections render
   above overlay on larger viewports while keeping overlay behavior intact.
   ========================================================================== */
@media (min-width: 768px) {
    .carousel,
    .carousel-inner,
    .carousel-item {
        position: relative;
        z-index: 0 !important;
    }

    /* carousel overlay should sit behind normal sections */
    .carousel .overlay,
    .overlay {
        position: absolute;
        z-index: 0 !important;
        pointer-events: none !important;
    }

    /* ensure regular page sections appear above overlay */
    section {
        position: relative !important;
        z-index: 2 !important;
    }

    /* Also lower hero z-index so it doesn't persist above subsequent sections */
    .hero {
        z-index: 0 !important;
    }
}

/* ==========================================================================
   FIX: Ensure About and Offer section headings/text are visible on desktop
   Some theme rules set text color to white for boxed content; explicitly
   restore readable text color for the section intro blocks that sit on
   neutral or light backgrounds.
   ========================================================================== */
@media (min-width: 768px) {
    /* About section intro (the title + paragraphs) */
    #about .title-bar h1,
    #about .title-bar .heading-border,
    #about .title-bar p {
        color: #333333 !important;
        opacity: 1 !important;
        display: block !important;
    }

    /* Offer / comp-offer intro text */
    #comp-offer h2,
    #comp-offer .heading-border-light,
    #comp-offer .desc-comp-offer-cont p,
    #comp-offer .desc-comp-offer-cont h3 {
        color: #333333 !important;
        opacity: 1 !important;
        display: block !important;
    }

    /* If any overlays are using pointer-events, make sure sections remain interactive */
    #about, #comp-offer {
        pointer-events: auto !important;
    }
}

