/* ============================================
   FRONTEND LAYOUT FIXES
   ============================================ */

/* Simple Header Z-Index Fix */
.top-navbar,
header,
nav.navbar {
    position: relative;
    z-index: 1040;
}

.z-1035 {
    z-index: 1035;
}

/* Main content wrapper */
main,
#content,
.main-content {
    position: relative;
    z-index: 1;
}

/* Vehicle models page specific fixes */
.model-card {
    position: relative;
    z-index: auto;
}

/* Product cards z-index */
.product-card,
.card {
    position: relative;
    z-index: auto;
}

/* Modal z-index */
.modal,
.modal-backdrop {
    z-index: 1050 !important;
}

.modal-backdrop {
    z-index: 1040 !important;
}

/* Dropdown z-index */
.dropdown-menu {
    z-index: 1035 !important;
}

/* Sticky elements */
.sticky-top {
    z-index: 1020 !important;
}

/* Fix gradient headers on vehicle pages */
section[style*="linear-gradient"] {
    position: relative;
    z-index: 2;
}

/* Breadcrumb positioning */
.breadcrumb {
    position: relative;
    z-index: 3;
}

/* Search widget */
.vehicle-search-widget {
    position: relative;
    z-index: 10;
}

/* Products grid */
.products-grid,
.product-list {
    position: relative;
    z-index: 1;
    margin-top: 20px;
}

/* Fix overlapping sections */
section + section {
    position: relative;
}

/* Vehicle header section */
.vehicle-header {
    position: relative;
    z-index: 2;
}

/* Content sections */
.content-section {
    position: relative;
    z-index: 1;
    background: #fff;
}

/* Year modal */
#yearModal {
    z-index: 1060 !important;
}

#yearModal + .modal-backdrop {
    z-index: 1055 !important;
}

/* Fix for overlapping cards on mobile */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
        z-index: auto;
    }
    
    section {
        margin-bottom: 0;
    }
}

/* Part request form */
.part-request-form {
    position: relative;
    z-index: 5;
}

/* Toast/notification z-index */
.toast,
.alert {
    z-index: 1070 !important;
}

/* Navbar dropdown fix */
.navbar .dropdown-menu {
    z-index: 1035;
}

/* Hero section */
.hero-section {
    position: relative;
    z-index: 2;
}

/* Fix for sticky navbar */
.navbar.fixed-top {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

/* Body padding when navbar is fixed */
body.has-fixed-navbar {
    padding-top: 70px;
}

/* Vehicle brand cards */
.brand-card {
    position: relative;
    z-index: auto;
    transition: all 0.3s ease;
}

.brand-card:hover {
    z-index: 10;
    transform: translateY(-5px);
}

/* Model cards */
.model-card {
    position: relative;
    z-index: auto;
    transition: all 0.3s ease;
}

.model-card:hover {
    z-index: 10;
    transform: translateY(-3px);
}

/* Search results */
.search-results {
    position: relative;
    z-index: 1;
}

/* Ensure proper stacking context */
.container,
.container-fluid {
    position: relative;
    z-index: auto;
}

/* Fix for gradient headers overlapping */
section.text-white[style*="gradient"] {
    position: relative;
    z-index: 2;
    margin-bottom: 0;
}

section.text-white[style*="gradient"] + section {
    position: relative;
    z-index: 1;
    margin-top: 0;
}

/* Product page header */
.product-header {
    position: relative;
    z-index: 2;
}

/* Pagination */
.pagination-wrapper,
nav[aria-label="pagination"] {
    position: relative;
    z-index: 5;
}

/* Fix for elements with background */
[style*="background:"],
[style*="background-color:"] {
    position: relative;
}

/* Ensure cards don't overlap header */
.py-5 .card,
.py-4 .card {
    z-index: auto;
}

/* Clear any conflicting positioning */
section {
    position: relative;
}

/* Fix header spacing */
.top-navbar + section,
header + section {
    margin-top: 0;
}

/* Responsive fixes */
@media (max-width: 992px) {
    .navbar {
        z-index: 1030 !important;
    }
    
    .modal {
        z-index: 1060 !important;
    }
}

/* Additional fixes for content overlap */
.page-content {
    position: relative;
    z-index: 1;
    background: #fff;
    margin-top: 0;
}

/* Vehicle models grid fix */
.models-grid {
    position: relative;
    z-index: 1;
}

