/* =============================================
   Custom Select Component
   ============================================= */

/*
 * Hide the native selects immediately in CSS so they are never
 * visible before JS replaces them — prevents the FOUC where the
 * browser-default large select flashes before buildCustomSelect runs.
 */
.toolbox select {
    display: none !important;
}
.toolbox-item::before {
    display: none !important;
}

.cs-wrap {
    position: relative;
    display: inline-block;
    font-size: 1.3rem;
    vertical-align: middle;
    user-select: none;
    /* Hidden until JS locks the width — prevents flash of unsized trigger */
    visibility: hidden;
}

/* Trigger button — no transition during init (added back by JS after first paint) */
.cs-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    background: transparent;
    border: 1.5px solid #eee;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 1.3rem;
    color: #333;
    cursor: pointer;
    transition: none;   /* suppressed until JS re-enables it after width is locked */
    outline: none;
    line-height: 1.4;
}
.cs-trigger:hover {
    background: #fff;
    border-color: #0D1B2B;
}
.cs-wrap.is-open .cs-trigger {
    background: #fff;
    border-color: #0D1B2B;
    border-radius: 7px 7px 0 0;
    border-bottom-color: transparent;
}
.cs-trigger .cs-label {
    flex: none;          /* don't grow/shrink — width is locked via min-width in JS */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Caret */
.cs-trigger .cs-caret {
    width: 9px;
    height: 9px;
    border-right: 2px solid #666;
    border-bottom: 2px solid #666;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s;
    flex-shrink: 0;
}
.cs-wrap.is-open .cs-trigger .cs-caret {
    transform: rotate(-135deg) translateY(-2px);
}

/* Dropdown panel */
.cs-dropdown {
    display: none;
    position: absolute;
    top: calc(100% - 1px);   /* sit flush under trigger (shares border) */
    left: 0;
    min-width: 100%;
    width: max-content;
    background: #fff;
    border: 1.5px solid #0D1B2B;
    border-top: none;
    border-radius: 0 0 7px 7px;
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
    z-index: 2;
    padding: 4px 0;
}
.cs-wrap.is-open .cs-dropdown { display: block; }

/* Options */
.cs-option {
    padding: 8px 16px;
    font-size: 1.3rem;
    color: #333;
    white-space: nowrap;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.cs-option:hover,
.cs-option.is-focused  { background: #eee; color: #0D1B2B; }
.cs-option.is-selected {
    background: #0D1B2B;
    color: #fff;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 575.98px) {
    .cs-trigger { font-size: 1.2rem; padding: 5px 12px; gap: 6px; }
    .cs-option   { font-size: 1.2rem; padding: 7px 13px; }
}
@media (max-width: 400px) {
    .cs-trigger { font-size: 1.1rem; padding: 5px 10px; gap: 5px; }
    .cs-option   { font-size: 1.1rem; padding: 6px 11px; }
}