/* ============================================================
   Custom Handles — Inline Color Panel
   ============================================================ */

/* Inline color panel (rendered below the "Colours" button) */
.ch-color-inline {
    margin-top: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: var(--menu_text_color);
}

/* Handles / Knobs tab buttons — share .mc-select-tabs styling with the door-types
   tabs, but stretch each tab to fill half the row so the centered text reads as a
   centered column rather than sitting at the row's left/right edges. */
.ch-type-tabs > .ch-type-tab {
    flex: 1;
}

/* When no LEFT/RIGHT/HANDLE checkbox is checked, lock all handle picking — categories,
   order block, tabs — so the user has to re-enable a handle before they can touch the
   selectors. The .ch-handle-toggles row (the checkboxes themselves) is NOT scoped under
   this rule so the user can still re-enable.

   `pointer-events: none !important` on every descendant is needed because the
   category-radio change handler (custom-handles-menu.js line ~263) writes inline
   `pointer-events: auto` on `.ch-handle-colors / .ch-fp-section / .ch-led-section`,
   and inline styles otherwise beat the parent's `pointer-events: none`. */
.ch-locked .ch-category,
.ch-locked .ch-type-tabs {
    opacity: 0.4;
    pointer-events: none;
}

.ch-locked .ch-category *,
.ch-locked .ch-type-tabs * {
    pointer-events: none !important;
}

/* Handle-exists checkboxes — global checkbox style at layout.css:2224 uses
   `appearance: none` which strips the browser's default disabled grey-out. Add an
   explicit disabled visual so the user can tell when LEFT/RIGHT HANDLE toggles are
   locked (e.g., the lock is on and we don't want them disabling that leaf). */
.ch-checkbox-handle:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ch-handle-toggles label:has(.ch-checkbox-handle:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Category thumb — stays at its natural image size by default; doubles (visually and in
   layout) when the category radio is checked. `zoom` is the easiest way to scale both
   the box and the image content together. Uses :has() to detect the selected state
   without needing a JS class toggle.
   Browser support: Chrome 105+, Safari 15.4+, Firefox 126+. */
.ch-cat-thumb {
    transition: zoom 0.25s ease;
}

.ch-category:has(.ch-cat-radio:checked) .ch-cat-thumb {
    zoom: 1.5;
}


/* Color pair block */
.ch-color-pair {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--buttons_background_color);
}

.ch-color-pair:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Category names row */
.ch-pair-names {
    display: flex;
    gap: 14px;
    margin-bottom: 4px;
}

.ch-pair-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    opacity: 0.8;
    color: var(--menu_text_color);
}

.ch-pair-name-primary {
    padding-right: 14px;
}

/* Price row */
.ch-pair-price {
    text-align: center;
    margin-bottom: 6px;
}

/* Swatches row */
.ch-pair-swatches {
    display: flex;
    gap: 14px;
    align-items: stretch;
}

.ch-swatch-column {
    flex: 1;
    min-width: 0;
}

.ch-swatch-column-primary {
    padding-right: 14px;
    border-right: 2px solid var(--buttons_background_color);
}

.ch-swatch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 6px;
    row-gap: 3px;
}

/* "Colours" toggle button */
.ch-color-popup-btn {
    font-size: 13px;
    padding: 6px 16px;
    cursor: pointer;
    border: 1px solid var(--buttons_background_color);
    background: var(--buttons_background_color);
    color: var(--buttons_text_color);
    border-radius: 4px;
    width: 100%;
}

.ch-color-popup-btn:hover {
    background: var(--active_buttons_background_color);
    color: var(--active_buttons_text_color);
}

.ch-color-popup-btn.ch-color-btn-open {
    background: var(--active_buttons_background_color);
    color: var(--active_buttons_text_color);
}

/* ============================================================
   Mobile responsive
   ============================================================ */
@media (max-width: 600px) {
    .ch-pair-names {
        flex-direction: column;
        gap: 4px;
    }

    .ch-pair-name-primary {
        padding-right: 0;
    }

    .ch-pair-swatches {
        flex-direction: column;
        gap: 10px;
    }

    .ch-swatch-column-primary {
        padding-right: 0;
        border-right: none;
        border-bottom: 2px solid var(--buttons_background_color);
        padding-bottom: 10px;
    }

    .ch-swatch-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 380px) {
    .ch-swatch-grid {
        grid-template-columns: 1fr;
    }
}
