/* =====================================================
   Jayda Vehicle Checker — Form fields & custom select
   Depends on: style-modal.css
   Covers: field labels, inputs/selects (Elementor-safe),
           custom select dropdown, VIN counter, disambiguation
   ===================================================== */

/* ── Fields ──────────────────────────────────────── */
.jvc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.jvc-field label {
    font-family: var(--jvc-font-family);
    font-size: var(--jvc-label-font-size);
    font-weight: var(--jvc-label-weight);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--jvc-label-color);
    display: block;
    margin-bottom: 0;
}

/* ── Inputs & selects — Elementor-safe ───────────── */
#jvc-modal .jvc-field select,
#jvc-modal .jvc-field input[type="text"],
.jvc-inline-widget .jvc-field select,
.jvc-inline-widget .jvc-field input[type="text"] {
    width: 100% !important;
    padding: 9px 12px !important;
    background: var(--jvc-input-bg) !important;
    border: 1.5px solid var(--jvc-input-border) !important;
    border-radius: var(--jvc-input-radius) !important;
    font-family: var(--jvc-font-family) !important;
    font-size: var(--jvc-body-font-size) !important;
    color: var(--jvc-input-text) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition: border-color .15s, opacity .15s;
    box-sizing: border-box !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
}

#jvc-modal .jvc-field select,
.jvc-inline-widget .jvc-field select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236F7587' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 32px !important;
    cursor: pointer;
}

#jvc-modal .jvc-field select:focus,
#jvc-modal .jvc-field input[type="text"]:focus,
.jvc-inline-widget .jvc-field select:focus,
.jvc-inline-widget .jvc-field input[type="text"]:focus {
    border-color: var(--jvc-input-focus) !important;
    box-shadow: 0 0 0 3px var(--jvc-input-focus-alpha) !important;
    outline: none !important;
}

#jvc-modal .jvc-field select:disabled,
.jvc-inline-widget .jvc-field select:disabled {
    opacity: .42 !important;
    pointer-events: none;
    background-color: #f5f7fd !important;
    cursor: not-allowed;
}

/* ── Custom select dropdown ──────────────────────── */
#jvc-modal .jvc-field .jvc-custom-select,
.jvc-inline-widget .jvc-field .jvc-custom-select {
    position: relative;
    width: 100%;
}

#jvc-modal .jvc-field .jvc-cs-trigger,
.jvc-inline-widget .jvc-field .jvc-cs-trigger {
    width: 100%;
    padding: 9px 32px 9px 12px !important;
    background: var(--jvc-input-bg) !important;
    border: 1.5px solid var(--jvc-input-border) !important;
    border-radius: var(--jvc-input-radius) !important;
    font-family: var(--jvc-font-family) !important;
    font-size: var(--jvc-body-font-size) !important;
    color: var(--jvc-input-text) !important;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    box-sizing: border-box !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
    line-height: 1.4;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236F7587' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    transition: border-color .15s;
}

#jvc-modal .jvc-field .jvc-cs-trigger:focus,
.jvc-inline-widget .jvc-field .jvc-cs-trigger:focus,
.jvc-custom-select.is-open .jvc-cs-trigger {
    border-color: var(--jvc-input-focus) !important;
    box-shadow: 0 0 0 3px var(--jvc-input-focus-alpha) !important;
    outline: none !important;
}

.jvc-custom-select.is-disabled .jvc-cs-trigger {
    opacity: .42 !important;
    background-color: #f5f7fd !important;
    pointer-events: none;
    cursor: not-allowed;
}

/* Default: hidden while in wrapper */
.jvc-cs-dropdown {
    display: none;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 6px 0 rgba(15, 22, 41, 0.08);
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #9AA1B2 transparent;
}

/* Portaled to <body> when open — escapes modal overflow + transform clipping */
#jvc-cs-portal .jvc-cs-dropdown {
    display: block;
    position: fixed;
    z-index: 9999400;
}

.jvc-cs-dropdown::-webkit-scrollbar { width: 4px; }
.jvc-cs-dropdown::-webkit-scrollbar-track { background: transparent; }
.jvc-cs-dropdown::-webkit-scrollbar-thumb {
    background: #9AA1B2;
    border-radius: 999px;
}
.jvc-cs-dropdown::-webkit-scrollbar-button { display: none; height: 0; }

.jvc-cs-option {
    padding: 9px 12px;
    font-family: var(--jvc-font-family);
    font-size: var(--jvc-body-font-size);
    color: var(--jvc-input-text);
    cursor: pointer;
    line-height: 1.4;
}

.jvc-cs-option:hover,
.jvc-cs-option.is-focused {
    background: var(--jvc-input-focus-alpha);
}

.jvc-cs-option.is-selected {
    color: var(--jvc-input-focus);
    font-weight: 500;
}

.jvc-cs-option[data-value=""] {
    color: var(--jvc-label-color);
}

/* ── VIN counter ─────────────────────────────────── */
.jvc-vin-count {
    position: absolute;
    right: 12px;
    bottom: 10px;
    font-size: 11px;
    color: var(--jvc-label-color);
    pointer-events: none;
}

#jvc-panel-vin .jvc-field input[type="text"],
#jvc-w-panel-vin .jvc-field input[type="text"] {
    padding-right: 52px !important;
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ── VIN disambiguation — gap between submodel/engine fields ── */
#jvc-panel-vin #jvc-vin-disambig,
#jvc-w-panel-vin #jvc-w-vin-disambig {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Equal height for both tab panels ────────────── */
.jvc-panel {
    min-height: 190px;
}
