/* --- Catalog Layout --- */
.catalog-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

/* --- Filter Sidebar --- */
.filter-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 8px; /* Space for scrollbar */
}

/* Custom scrollbar for sidebar */
.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}
.filter-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.filter-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 10px;
}
.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.filter-group {
    margin-bottom: 1.25rem;
}

.filter-label {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
    color: var(--color-text-main);
}

.search-helper {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Brand Grid Buttons */
.brand-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.brand-filter-btn {
    height: 80px;
    background-color: var(--color-white);
    border: 2px solid #1A1A1A;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 12px;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-navy);
}

.brand-filter-btn img {
    max-height: 40px;
    max-width: 80%;
    display: block;
}

/* All Brands specific styling */
.brand-filter-btn[data-brand="All"].active {
    background-color: var(--color-navy);
    color: var(--color-white);
    border-color: var(--color-navy);
}

/* Other brands active state */
.brand-filter-btn.active:not([data-brand="All"]) {
    border: 4px solid var(--color-gold);
    background-color: var(--color-gold-light);
    color: var(--color-navy);
}

/* Category Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-btn {
    width: 100%;
    background-color: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: 4px;
    padding: 12px 16px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
    color: var(--color-text-main);
    transition: border-color var(--transition-fast);
}

.dropdown-btn:hover {
    border-color: var(--color-navy);
}

.custom-dropdown.open .dropdown-btn {
    border-color: var(--color-navy);
    border-radius: 4px 4px 0 0;
}

.dropdown-content {
    display: none;
    background-color: var(--color-white);
    border: 2px solid var(--color-navy);
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 12px;
    margin-top: 0;
}

.custom-dropdown.open .dropdown-content {
    display: flex; /* Inherits from checkbox-list but overriding display: none */
}

/* Category Checkbox List */
.checkbox-list {
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom scrollbar for checkbox list */
.checkbox-list::-webkit-scrollbar {
    width: 4px;
}
.checkbox-list::-webkit-scrollbar-track {
    background: transparent;
}
.checkbox-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 16px;
    color: var(--color-text-main);
    line-height: 1.4;
    padding: 4px 0;
}

.checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    margin: 0;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.checkbox-item input[type="checkbox"]:checked {
    background-color: var(--color-navy);
    border-color: var(--color-navy);
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-count {
    color: var(--color-text-muted);
    font-size: 14px;
    margin-left: auto;
}

/* --- Results Panel --- */
.results-panel {
    position: relative;
}

.results-header-sticky {
    position: sticky;
    top: 64px; /* Header height */
    z-index: 100;
    background-color: var(--color-bg-light);
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--color-border);
}

.results-count {
    font-size: 18px;
    font-weight: 600;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-navy);
    background: transparent;
    color: var(--color-navy);
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    transition: background-color 100ms;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--color-gold);
    border-color: var(--color-gold);
}

.pagination-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.pagination-info {
    font-weight: 600;
    font-size: 16px;
}

/* --- Table Styles --- */
.table-container {
    width: 100%;
    overflow: visible; /* No horizontal scroll allowed */
}

.catalog-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-white);
    table-layout: fixed; /* Strict column control */
}

.catalog-table thead {
    position: sticky;
    top: 112px; /* Header (64px) + Results Header (48px) */
    z-index: 90;
}

.catalog-table th {
    background-color: var(--color-bg-light);
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--color-border);
    font-size: 15px;
}

.catalog-table td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--color-border);
    height: 60px;
    vertical-align: middle;
    font-size: 17px;
}

.catalog-table tr:nth-child(even) {
    background-color: #FAFBFC;
}

.catalog-table tr:hover {
    border-left: 4px solid var(--color-gold);
}

/* Column Widths */
.col-part { 
    width: 25%; 
    padding-right: 24px !important; 
    word-break: break-word;
}
.col-dim { width: 20%; }
.col-load { width: 15%; }
.col-weight { width: 10%; }
.col-action { width: 30%; }

/* Cell Content helpers */
.cell-sub {
    display: block;
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.load-item {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 8px;
}

.load-val { font-weight: 700; }
.load-lab { font-size: 13px; color: var(--color-text-muted); }

/* --- Mobile Card View (JS will toggle these) --- */
.mobile-card-list {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.product-card {
    background-color: var(--color-white);
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    padding: 12px;
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 15px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.card-spec-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.card-spec-label {
    font-size: 16px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.card-spec-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-main);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 200ms ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background-color: var(--color-white);
    width: 95%;
    max-width: 800px;
    padding: 24px;
    border-radius: 8px;
    position: relative;
    max-height: 95vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--color-navy);
    z-index: 110;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background-color: #f8f9fa;
    color: var(--color-gold);
}

.modal-title {
    font-size: 24px;
    margin-bottom: 4px;
    font-weight: 700;
}

.modal-subtitle {
    font-size: 16px;
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.modal-header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 20px;
}

.modal-header-text {
    flex: 1;
}

.modal-header-image {
    width: 120px;
    height: 100px;
    background-color: #f8f9fa;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.modal-header-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.spec-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 32px;
    row-gap: 0;
    margin-bottom: 16px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.spec-label {
    color: var(--color-text-muted);
    font-size: 14px;
}

.spec-value {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-main);
    text-align: right;
    padding-left: 10px;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

/* --- Quote Confirmation Styles --- */
.quote-confirmation {
    padding: 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.quote-company-info p {
    margin: 0;
    font-size: 13px;
    color: #444;
    line-height: 1.4;
}

.quote-number-box {
    background: #f0f0f0;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 16px;
}

.quote-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.quote-table th {
    background: #f8f9fa;
    padding: 10px;
    text-align: left;
    font-size: 13px;
    border-bottom: 2px solid #eee;
}

.quote-table td {
    padding: 15px 10px;
    border-bottom: 1px solid #eee;
}

.quote-prod-img-box {
    width: 60px;
    height: 60px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Skeleton Loader --- */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton-row td, .skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 1.5s infinite;
    height: 72px;
    border: none;
}

/* --- Responsive --- */
@media (max-width: 1023px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-sidebar {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .brand-filter-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .brand-filter-btn {
        height: 44px;
        font-size: 14px;
        border-radius: 22px;
    }

    .results-header-sticky {
        top: 64px;
    }

    .catalog-table thead {
        top: 120px;
    }
    
    .catalog-table th, .catalog-table td {
        padding: 12px 8px;
    }
}

@media (max-width: 767px) {
    .catalog-table { display: none; }
    .mobile-card-list { display: flex; }
    
    .brand-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .brand-filter-btn {
        height: 80px;
        border-radius: 4px;
        font-size: 18px;
    }

    .results-header-sticky {
        flex-direction: column;
        height: auto;
        padding: 16px;
        gap: 16px;
        position: static;
    }
    
    .modal-card {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding-top: 80px;
    }
    
    .modal-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--color-white);
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--color-border);
    }
}
