/**
 * Standalone Leaf Category High-Density Catalog Styles
 * Path: wp-content/themes/tricity-bearings-theme-2/assets/css/tcb-leaf-catalog.css
 * Version: 5.5.0
 */

/* ==========================================================================
   0. MOBILE VIEWPORT CONTAINMENT (PREVENTS ROOT PAGE HORIZONTAL SPILL)
   ========================================================================== */
html, 
body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative;
}

.tcb-homepage-centered-wrapper,
.tcb-container,
.tcb-static-page-wrapper,
.tcb-terms-container,
.tcb-leaf-catalog-card {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   1. UNIFIED HIGH-DENSITY BORDERLESS MATRIX TABLE
   ========================================================================== */
.tcb-matrix-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.tcb-catalog-matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: #0f172a;
}

/* UNIVERSAL SINGLE-LINE ROW & CELL HEIGHT ENFORCEMENT */
.tcb-catalog-matrix-table th,
.tcb-catalog-matrix-table td {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px;
    height: 38px;
    box-sizing: border-box;
    vertical-align: middle !important;
}

/* Headers */
.tcb-matrix-header-titles th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #cbd5e1;
}

.tcb-matrix-header-filters th {
    background-color: #f8fafc;
    padding: 4px 6px 8px 6px;
    border-bottom: 2px solid #cbd5e1;
}

/* Inline Column Typed Filter Inputs */
.tcb-col-filter {
    width: 100%;
    padding: 4px 6px;
    font-size: 12px;
    color: #0f172a;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    outline: none;
    height: 26px;
}

.tcb-col-filter:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.12);
}

/* High-Density Borderless Rows with Hairline Bottom Dividers */
.tcb-matrix-row td {
    padding: 4px 10px;
    vertical-align: middle !important;
    border-bottom: 1px solid #e2e8f0;
    background-color: #ffffff;
    transition: background-color 0.1s ease;
}

/* Hover Guide Line */
.tcb-matrix-row:hover td {
    background-color: #f1f5f9;
}

/* Column Specific Widths & Alignment */
.col-thumb { width: 48px; text-align: center; }
.tcb-thumb-frame img { display: block; max-width: 32px; height: auto; margin: 0 auto; border-radius: 4px; }

/* MPN SPECIFIC SINGLE-LINE, NON-BREAKING HYPHEN & VERTICAL BASELINE ALIGNMENT */
.col-mpn {
    min-width: 110px !important;
    max-width: 140px !important;
    vertical-align: middle !important;
}

.col-mpn .tcb-part-number-link {
    display: inline-flex !important;
    align-items: center !important;
    height: 100% !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    text-decoration: none;
    font-weight: 700;
    color: #0066cc;
}

.col-mpn .tcb-part-number-link:hover {
    text-decoration: underline;
}

.col-mpn .tcb-full-part-number {
    display: inline-block !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.col-brand { font-weight: 600; color: #475569; }

/* B2B DUAL PRICE SINGLE-LINE STYLING */
.col-price { font-weight: 700; color: #0f172a; }

.tcb-dual-price {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
}

.tcb-list-price,
.tcb-list-price * {
    font-size: 11px !important;
    color: #94a3b8 !important;
    text-decoration: line-through !important;
    font-weight: 400 !important;
}

.tcb-customer-price,
.tcb-customer-price * {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    text-decoration: none !important;
}

/* Inline Form, QTY, and Order Button Styling */
.tcb-matrix-quick-add-form {
    display: inline-block;
    margin: 0;
}

.col-qty { width: 52px; text-align: center; }
.tcb-qty-input {
    width: 44px;
    height: 30px;
    padding: 2px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-sizing: border-box;
}

.col-action { width: 64px; text-align: center; }
.tcb-add-btn {
    background-color: #0066cc;
    color: #ffffff;
    border: none;
    padding: 0 10px;
    height: 30px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    box-sizing: border-box;
}

.tcb-add-btn:hover {
    background-color: #0052a3;
}

/* Sticky Left Columns */
.sticky-col {
    position: sticky;
    z-index: 2;
    background-color: #ffffff;
}

.col-thumb-head,
.col-mpn-head {
    z-index: 3 !important;
    background-color: #f8fafc !important;
}

.col-thumb { left: 0; }
.col-mpn {
    left: 48px !important;
    box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.1);
}

.tcb-matrix-row:hover .sticky-col {
    background-color: #f1f5f9;
}

/* ==========================================================================
   2. MOBILE TRIGGER BAR & SLIDE-UP FILTER DRAWER (MOBILE BASE)
   ========================================================================== */
.tcb-drag-handle {
    width: 42px;
    height: 5px;
    background-color: #000000;
    border-radius: 3px;
    margin: 6px auto 4px auto;
}

/* Base Trigger Bar Styling */
.tcb-mobile-filter-trigger-bar {
    background-color: #ffffff;
    border-top: 1px solid #cbd5e1;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 998;
    padding: 2px 16px 8px 16px;
    cursor: pointer;
}

.tcb-filter-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #0f172a;
}

.tcb-filter-label {
    font-weight: 800;
    color: #0066cc;
    letter-spacing: 0.05em;
}

/* Overlay Base */
.tcb-mobile-filter-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    z-index: 1000020 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tcb-mobile-filter-drawer-overlay.active {
    display: block !important;
    opacity: 1;
}

/* Drawer Base */
.tcb-mobile-filter-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    background-color: #ffffff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    z-index: 1000025 !important;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: none;
    flex-direction: column;
}

.tcb-mobile-filter-drawer.active {
    display: flex !important;
    transform: translateY(0);
}

.tcb-drawer-header {
    padding: 4px 16px 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.tcb-drawer-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tcb-drawer-header-row h3 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.tcb-drawer-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    line-height: 1;
    cursor: pointer;
}

.tcb-drawer-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.tcb-filter-group {
    margin-bottom: 16px;
}

.tcb-filter-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.tcb-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tcb-chip {
    padding: 6px 12px;
    font-size: 12px;
    color: #334155;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.tcb-chip.selected {
    background-color: #0066cc;
    color: #ffffff;
    border-color: #0066cc;
}

.tcb-drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.tcb-reset-filters-btn {
    flex: 1;
    padding: 10px;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.tcb-apply-filters-btn {
    flex: 2;
    padding: 10px;
    background-color: #0066cc;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

/* ==========================================================================
   3. HARDWARE POINTER INTERACTION RULES (LEVEL 4 MEDIA QUERIES)
   ========================================================================== */

/* 1. STRICT DESKTOP CURSOR ISOLATION (MOUSE / TRACKPAD) */
@media screen and (hover: hover) and (pointer: fine) {
    .tcb-desktop-hide,
    .tcb-mobile-filter-trigger-bar,
    .tcb-mobile-filter-drawer,
    .tcb-mobile-filter-drawer-overlay,
    #tcbMobileFilterTrigger,
    #tcbFilterDrawer,
    #tcbFilterDrawerOverlay {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .tcb-mobile-hide {
        display: table-row !important;
    }
}

/* 2. TOUCH-FIRST SMARTPHONE & TABLET ISOLATION (TOUCHSCREEN) */
@media screen and (hover: none) and (pointer: coarse) {
    .tcb-mobile-hide { 
        display: none !important; 
    }
    .tcb-desktop-hide { 
        display: block !important; 
    }
    .tcb-mobile-filter-trigger-bar { 
        display: block !important; 
        position: fixed !important;
        bottom: 60px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1000004 !important;
    }
}