/* ==========================================================================
   ADC Quotes — form + summary layout
   Two-column grid (70/30) with sticky summary, collapsing to one column on
   narrow viewports.
   ========================================================================== */

.adcq-wrap {
    --adcq-primary: #02043f;
    --adcq-primary-light: #1a1d5e;
    --adcq-accent: #a11437;
    --adcq-accent-dark: #82102c;
    --adcq-bg: #f5f7fa;
    --adcq-border: #dfe3e8;
    --adcq-border-hover: #b0b7c1;
    --adcq-text: #1a1a1a;
    --adcq-muted: #6b7280;
    --adcq-danger: #e74c3c;
    --adcq-radius: 10px;

    display: grid;
    grid-template-columns: 70% 30%;
    gap: 1.5rem;
    max-width: 1180px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--adcq-text);
    font-size: 15px;
    line-height: 1.45;
    box-sizing: border-box;
    padding: 0 1rem;
}
.adcq-wrap *, .adcq-wrap *::before, .adcq-wrap *::after { box-sizing: inherit; }

/* Honor the HTML5 hidden attribute even when a theme globally overrides it.
   Driver and vehicle fieldsets rely on this for count-driven visibility. */
.adcq-wrap [hidden] { display: none !important; }

/* Defensive — some themes set pointer-events:none on generic form wrappers
   or apply user-select:none globally, which can make native <select>
   dropdowns feel "stuck". Re-enable explicitly on our interactive elements. */
.adcq-wrap input,
.adcq-wrap select,
.adcq-wrap textarea,
.adcq-wrap button,
.adcq-wrap label,
.adcq-wrap .adcq-tier,
.adcq-wrap .adcq-chip {
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
}

.adcq-wrap .adcq-form {
    position: relative;
    z-index: 100000;
}
.adcq-wrap select,
.adcq-wrap input,
.adcq-wrap button,
.adcq-wrap textarea {
    position: relative;
    z-index: 100001;
}

/* -------------------------------------------------------------------------
   WordPress admin toolbar click-through fix.

   Confirmed root cause of dropdowns being unclickable on staging: the
   admin-bar submenu (<div class="ab-sub-wrapper">) renders over content
   below it even while collapsed. In the collapsed state it's visually
   hidden but remains click-interactive, which silently steals mouse
   clicks from <select> elements sitting underneath it.

   Because the admin bar lives in its own top-level stacking context
   (z-index: 99999), we can't simply out-stack it from a nested form.
   The reliable fix is to disable pointer-events on its submenus when
   they aren't actually being hovered / focused, so mouse clicks fall
   through to the real target below.
   ------------------------------------------------------------------------- */
/* Cascade pointer-events:none onto the submenu's descendants too — the
   anchors and list items default to `auto`, so setting `none` only on the
   wrapper isn't enough to let clicks fall through. */
#wpadminbar .ab-sub-wrapper,
#wpadminbar .ab-sub-wrapper *,
#wpadminbar .ab-submenu,
#wpadminbar .ab-submenu * {
    pointer-events: none !important;
}
#wpadminbar li:hover > .ab-sub-wrapper,
#wpadminbar li:hover > .ab-sub-wrapper *,
#wpadminbar li:focus-within > .ab-sub-wrapper,
#wpadminbar li:focus-within > .ab-sub-wrapper * {
    pointer-events: auto !important;
}

@media (max-width: 900px) {
    .adcq-wrap { grid-template-columns: 1fr; }
}

/* ---------- Form column ---------- */

.adcq-form { min-width: 0; }

.adcq-header {
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--adcq-primary);
}
.adcq-header h2 {
    margin: 0 0 .25rem;
    font-size: 1.75rem;
    color: var(--adcq-primary);
}
.adcq-header .adcq-sub {
    margin: 0;
    color: var(--adcq-muted);
    font-size: .95rem;
}

.adcq-section {
    background: #fff;
    border: 1px solid var(--adcq-border);
    border-radius: var(--adcq-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.adcq-section:hover {
    border-color: var(--adcq-border-hover);
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.adcq-section h3 {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--adcq-primary);
}
.adcq-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    background: var(--adcq-primary);
    color: #fff;
    border-radius: 50%;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---------- Fields ---------- */

.adcq-wrap label {
    display: block;
    margin: .4rem 0;
    font-size: .92rem;
}
.adcq-wrap label > span {
    display: block;
    margin-bottom: .25rem;
    color: var(--adcq-muted);
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.adcq-wrap input[type="text"],
.adcq-wrap input[type="email"],
.adcq-wrap input[type="tel"],
.adcq-wrap input[type="date"],
.adcq-wrap input[type="number"],
.adcq-wrap select,
.adcq-wrap textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--adcq-border);
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--adcq-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.adcq-wrap input:focus,
.adcq-wrap select:focus,
.adcq-wrap textarea:focus {
    outline: none;
    border-color: var(--adcq-primary);
    box-shadow: 0 0 0 3px rgba(2,4,63,.12);
}
.adcq-wrap input.adcq-invalid,
.adcq-wrap textarea.adcq-invalid {
    border-color: var(--adcq-danger) !important;
    background: #fff5f5 !important;
}
.adcq-wrap input.adcq-invalid:focus,
.adcq-wrap textarea.adcq-invalid:focus {
    box-shadow: 0 0 0 3px rgba(231,76,60,.18) !important;
}
.adcq-wrap .adcq-dropdown.adcq-invalid .adcq-dropdown-toggle {
    border-color: var(--adcq-danger) !important;
    background: #fff5f5 !important;
}
.adcq-wrap .adcq-deductibles.adcq-invalid,
.adcq-wrap .adcq-pills.adcq-invalid {
    outline: 2px dashed var(--adcq-danger);
    outline-offset: 4px;
    border-radius: 10px;
}
.adcq-wrap .adcq-checkbox:has(input[required]:not(:checked).adcq-shown) {
    /* Subtle red for unchecked required checkbox after first interaction. */
}
.adcq-wrap .adcq-checkbox input.adcq-invalid + span {
    color: var(--adcq-danger);
}
.adcq-wrap .adcq-rs-note {
    margin: .5rem 0 .75rem;
    padding: .5rem .75rem;
    background: #fff8e1;
    border-left: 3px solid #ffc107;
    color: #5b4a00;
    font-size: .85rem;
    border-radius: 4px;
}
.adcq-wrap .adcq-rs-eligibility { margin-top: .25rem; }
.adcq-wrap select:disabled {
    background: #f5f5f5;
    color: #888;
    cursor: not-allowed;
}
.adcq-hint {
    display: block;
    margin-top: .25rem;
    color: var(--adcq-muted);
    font-size: .78rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.adcq-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .75rem;
    margin-bottom: .5rem;
}

.adcq-checkbox {
    display: flex !important;
    align-items: flex-start;
    gap: .5rem;
    margin: .75rem 0 !important;
    padding: .5rem;
    background: #fafbfc;
    border: 1px solid var(--adcq-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s ease;
}
.adcq-checkbox:hover { background: #f0f3f7; }
.adcq-checkbox input { margin-top: .2rem; flex-shrink: 0; }
.adcq-checkbox span {
    margin: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: .92rem !important;
    font-weight: 400 !important;
    color: var(--adcq-text) !important;
}

/* ---------- Deductible tier picker ---------- */

.adcq-deductibles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .6rem;
}
.adcq-tier {
    position: relative;
    display: block;
    border: 2px solid var(--adcq-border);
    border-radius: var(--adcq-radius);
    padding: 1rem .5rem;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: all .15s ease;
    margin: 0 !important;
}
.adcq-tier:hover {
    border-color: var(--adcq-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.06);
}
.adcq-tier input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.adcq-tier:has(input:checked) {
    border-color: var(--adcq-primary);
    background: linear-gradient(180deg, #eef1fa 0%, #f8f9fd 100%);
    box-shadow: 0 4px 12px rgba(2,4,63,.12);
}
.adcq-tier-amount {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--adcq-primary);
    line-height: 1.1;
}
.adcq-tier-rate {
    display: block;
    color: var(--adcq-muted);
    font-size: .82rem;
    margin-top: .35rem;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* ---------- Custom dropdown component (replaces <select>) ---------- */

.adcq-dropdown {
    position: relative;
    width: 100%;
    font-size: 0.95rem;
}

/* Override theme button styling aggressively. The host theme applies a red
   background to every <button>; we force our own white background, neutral
   text color, and reset things like text-transform / letter-spacing that
   themes often set on buttons. */
.adcq-wrap .adcq-dropdown-toggle,
.adcq-dropdown .adcq-dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: .5rem !important;
    width: 100% !important;
    padding: .6rem .75rem !important;
    border: 1px solid var(--adcq-border) !important;
    border-radius: 6px !important;
    background: #fff !important;
    background-image: none !important;
    color: var(--adcq-text) !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: 400 !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    cursor: pointer !important;
    box-shadow: none !important;
    min-height: 42px !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}
.adcq-wrap .adcq-dropdown-toggle:hover,
.adcq-dropdown .adcq-dropdown-toggle:hover {
    background: #fff !important;
    color: var(--adcq-text) !important;
    border-color: var(--adcq-border-hover) !important;
}
.adcq-wrap .adcq-dropdown.adcq-dropdown-open .adcq-dropdown-toggle,
.adcq-wrap .adcq-dropdown-toggle:focus,
.adcq-dropdown .adcq-dropdown-toggle:focus {
    outline: none !important;
    border-color: var(--adcq-primary) !important;
    box-shadow: 0 0 0 3px rgba(2,4,63,.12) !important;
    background: #fff !important;
}

.adcq-dropdown-value {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.adcq-dropdown-empty {
    color: var(--adcq-muted);
}

.adcq-dropdown-caret {
    flex: 0 0 auto;
    font-size: .75rem;
    color: var(--adcq-muted);
    transition: transform .15s ease;
}
.adcq-dropdown.adcq-dropdown-open .adcq-dropdown-caret {
    transform: rotate(180deg);
    color: var(--adcq-primary);
}

/* The menu is position:fixed (set by JS) so it escapes nested stacking
   contexts — critical when the form is inside a themed wrapper that
   would otherwise clip it or place it under the admin bar. */
.adcq-dropdown-menu {
    position: fixed;
    z-index: 2147483647;  /* max int — wins every stacking context */
    background: #fff;
    border: 1px solid var(--adcq-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.adcq-dropdown-search {
    flex: 0 0 auto;
    border: 0;
    border-bottom: 1px solid var(--adcq-border);
    padding: .55rem .75rem;
    font: inherit;
    outline: none;
    background: #fafbfc;
}
.adcq-dropdown-search:focus {
    background: #fff;
    box-shadow: inset 0 -2px 0 var(--adcq-primary);
}

.adcq-dropdown-options {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .25rem 0;
    max-height: 320px;
}

.adcq-dropdown-group {
    padding: .5rem .75rem .25rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--adcq-muted);
    background: #f7f8fa;
    border-top: 1px solid var(--adcq-border);
    border-bottom: 1px solid var(--adcq-border);
}
.adcq-dropdown-group:first-child {
    border-top: 0;
}

/* Option buttons use !important + high-specificity selectors because the
   host theme applies its own button-hover background (currently the site's
   red secondary color) that was bleeding through. */
.adcq-wrap .adcq-dropdown-option,
.adcq-dropdown-menu .adcq-dropdown-option {
    display: block !important;
    width: 100% !important;
    padding: .55rem .75rem !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--adcq-text) !important;
    font: inherit !important;
    text-align: left !important;
    cursor: pointer !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.adcq-wrap .adcq-dropdown-option:hover,
.adcq-wrap .adcq-dropdown-option:focus,
.adcq-dropdown-menu .adcq-dropdown-option:hover,
.adcq-dropdown-menu .adcq-dropdown-option:focus {
    background: #e3f2fd !important;
    color: var(--adcq-primary) !important;
    outline: none !important;
}
.adcq-wrap .adcq-dropdown-option-selected,
.adcq-dropdown-menu .adcq-dropdown-option-selected {
    background: #bbdefb !important;
    color: var(--adcq-primary) !important;
    font-weight: 600 !important;
}
.adcq-dropdown-option-selected::before {
    content: "✓ ";
    margin-right: .25rem;
}

/* ---------- Radio pills (drivers / vehicles counts, tiers) ---------- */

.adcq-counter {
    margin: .75rem 0;
}
.adcq-counter-label {
    display: block;
    margin-bottom: .4rem;
    color: var(--adcq-muted);
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.adcq-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.adcq-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 .9rem;
    border: 2px solid var(--adcq-border);
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    font-size: 1rem;
    font-weight: 600;
    color: var(--adcq-text);
    transition: all .12s ease;
    margin: 0 !important;
    user-select: none;
}
.adcq-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.adcq-pill span {
    margin: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: inherit !important;
    color: inherit !important;
    font-size: inherit !important;
}
.adcq-pill:hover {
    border-color: var(--adcq-primary-light);
    transform: translateY(-1px);
}
.adcq-pill:has(input:checked) {
    border-color: var(--adcq-primary);
    background: var(--adcq-primary);
    color: #fff;
    box-shadow: 0 3px 8px rgba(2,4,63,.18);
}
.adcq-pill-disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}
.adcq-pill-wide {
    min-width: 140px;
}

/* ---------- Service chips (rideshare) ---------- */

.adcq-services {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.adcq-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: .6rem 1rem;
    border: 2px solid var(--adcq-border);
    border-radius: 999px;
    cursor: pointer;
    background: #fff;
    font-size: .92rem;
    transition: all .15s ease;
    margin: 0 !important;
}
.adcq-chip input { position: absolute; opacity: 0; pointer-events: none; }
.adcq-chip span {
    margin: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 500 !important;
    color: inherit !important;
    font-size: inherit !important;
}
.adcq-chip:hover { border-color: var(--adcq-primary-light); }
.adcq-chip:has(input:checked) {
    border-color: var(--adcq-primary);
    background: var(--adcq-primary);
    color: #fff;
}

/* ---------- Sub-fieldsets (driver/vehicle repeaters) ---------- */

.adcq-sub {
    border: 1px dashed var(--adcq-border);
    border-radius: 8px;
    padding: .9rem 1rem .5rem;
    margin: .75rem 0;
    background: #fafbfc;
}
.adcq-sub legend {
    padding: 0 .5rem;
    margin-left: .5rem;
    font-weight: 600;
    font-size: .88rem;
    color: var(--adcq-primary);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ---------- Summary column ---------- */

.adcq-summary {
    min-width: 0;
}
.adcq-summary-inner {
    position: sticky;
    top: 1rem;
    background: #fff;
    border: 1px solid var(--adcq-border);
    border-radius: var(--adcq-radius);
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.adcq-summary h3 {
    margin: 0 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--adcq-primary);
    color: var(--adcq-primary);
    font-size: 1.15rem;
}
.adcq-summary h4 {
    margin: 1rem 0 .5rem;
    font-size: .88rem;
    text-transform: uppercase;
    color: var(--adcq-muted);
    letter-spacing: .05em;
}

.adcq-recap {
    margin: 0 0 1rem;
}
.adcq-recap > div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid #f0f2f5;
    align-items: baseline;
}
.adcq-recap > div:last-child { border-bottom: 0; }
.adcq-recap dt {
    color: var(--adcq-muted);
    font-size: .82rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .02em;
    margin: 0;
}
.adcq-recap dd {
    margin: 0;
    font-weight: 600;
    color: var(--adcq-text);
    text-align: right;
    word-break: break-word;
    font-size: .92rem;
}

.adcq-breakdown-wrap {
    margin: .75rem 0;
    padding-top: .5rem;
    border-top: 1px dashed var(--adcq-border);
}
.adcq-breakdown {
    list-style: none;
    margin: 0;
    padding: 0;
}
.adcq-breakdown li {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    padding: .35rem 0;
    font-size: .88rem;
    color: var(--adcq-text);
    border-bottom: 1px dotted #eee;
}
.adcq-breakdown li:last-child { border-bottom: 0; }
.adcq-breakdown strong { color: var(--adcq-primary); }

.adcq-total-box {
    margin: 1rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, var(--adcq-primary) 0%, var(--adcq-primary-light) 100%);
    border-radius: var(--adcq-radius);
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.adcq-total-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.adcq-total-row + .adcq-total-row:not([hidden]) {
    padding-top: .5rem;
    border-top: 1px solid rgba(255,255,255,.18);
}
.adcq-total-label {
    display: block;
    font-size: .78rem;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .15rem;
}
.adcq-total {
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

/* Bundle savings promo — green callout shown when a bundle is being built. */
.adcq-wrap .adcq-bundle-promo {
    margin: .75rem 0 .25rem;
    padding: .6rem .75rem;
    background: #e6f7ee;
    border-left: 3px solid #1abc60;
    color: #0e5e32;
    font-size: .88rem;
    border-radius: 4px;
}
.adcq-wrap .adcq-bundle-promo strong {
    color: #0a4a25;
}

.adcq-wrap .adcq-optional {
    font-size: .75rem;
    color: var(--adcq-muted);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: .04em;
    margin-left: .5rem;
}

/* Auto-bundle tier picker inside rideshare — matches rideshare-tier spacing. */
.adcq-wrap .adcq-auto-bundle {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px dashed var(--adcq-border);
}

/* ---------- Actions ---------- */

.adcq-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.adcq-actions button {
    padding: .85rem 1rem;
    font-size: .98rem;
    font-weight: 700;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s ease;
    font-family: inherit;
}
.adcq-add-to-cart {
    background: var(--adcq-accent);
    color: #fff;
}
.adcq-add-to-cart:not(:disabled):hover {
    background: var(--adcq-accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(161,20,55,.35);
}
.adcq-add-to-cart:disabled {
    background: #cfd3d7;
    color: #fff;
    cursor: not-allowed;
}

/* ---------- Status / errors ---------- */

.adcq-message {
    margin-top: .75rem;
    padding: .5rem .75rem;
    font-size: .9rem;
    border-radius: 6px;
    min-height: 0;
}
.adcq-message:not(:empty) {
    background: #f0f4f8;
    color: var(--adcq-muted);
}
.adcq-message.adcq-error {
    background: #fdecea;
    color: var(--adcq-danger);
}

.adcq-error { color: var(--adcq-danger); }
