/* =============================================================================
   Driving Donations — Public Donation Form Styles
   ============================================================================= */

.dd-auth-section { padding:5px 10px; border:solid #ccc 1px; background-color:#eee; border-radius:4px; }
.dd-auth-section .dd-auth-bar, .dd-auth-section .dd-auth-prompt { display:flex; align-items:center; }
x.dd-auth-section .dd-auth-bar .dd-auth-links { display:grid; grid-template-columns:auto auto; margin-left:auto; padding-left:20px; white-space:nowrap; text-align:center; }
.dd-auth-section .dd-auth-links { display:grid; grid-template-columns:auto; margin-left:auto; padding-left:20px; white-space:nowrap; text-align:center; }

@media (max-width:599px) {
.dd-auth-section .dd-auth-links a:not(:last-child) { position:relative; padding-bottom:2px; }
.dd-auth-section .dd-auth-links a:not(:last-child)::after { content:""; position:absolute; bottom:0; left:50%; transform:translateX(-50%); width:40px; height:1px; background:#999; pointer-events:none; }
}
@media (min-width:600px) {
    .dd-auth-section .dd-auth-links { grid-template-columns:auto auto; }
    .dd-auth-section .dd-auth-links a { display:block; margin:10px 0; }
    .dd-auth-section .dd-auth-links a+a::before { content:"|"; margin:0 5px; color:#999; }
}


.dd-donate-form h1, .dd-donate-form h2, .dd-donate-form h3, .dd-donate-form h4, .dd-donate-form h5, .dd-donate-form h6  { padding-top:30px; }

/* ---- Registration options wrapper ---- */
.dd-registration-options, .dd-donation-options-section {
    margin: 48px 0 24px 0;
}

/* ---- Individual field wrapper ---- */
.dd-opt-field {
    margin-bottom: 16px;
}

/* ---- Labels ---- */
.dd-opt-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.dd-opt-checkbox-label,
.dd-opt-radio-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    cursor: pointer;
    margin-bottom: 4px;
}

/* ---- Price hint ---- */
.dd-opt-price {
    color: #555;
    font-weight: 400;
    font-size: 0.9em;
}

/* ---- Required marker ---- */
.dd-required {
    color: var(--dd-color-danger, #c0392b);
    font-weight: 700;
    margin-left: 2px;
}

/* ---- Description text ---- */
.dd-opt-desc {
    margin: 4px 0 0;
    font-size: 0.875em;
    color: #666;
}

/* ---- Radio group ---- */
.dd-opt-radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

/* ---- Standard inputs ---- */
.dd-opt-field input[type="text"],
.dd-opt-field input[type="number"],
.dd-opt-field textarea,
.dd-opt-field select {
    display: block;
    width: 100%;
    /* max-width: 400px; */
    box-sizing: border-box;
    padding: var(--dd-input-padding-y, 6px) var(--dd-input-padding-x, 10px);
    border: 1px solid var(--dd-input-border, #ccc);
    border-radius: var(--dd-radius, 4px);
    background: var(--dd-input-bg, #fff);
    color: var(--dd-input-text, inherit);
    font-size: 1em;
    line-height: 1.4;
}

.dd-opt-field textarea {
    min-height: 80px;
    resize: vertical;
}

.dd-opt-field input[type="number"] {
    max-width: 120px;
}

/* ---- Group — base reset (clears fieldset browser defaults) ---- */
.dd-opt-group {
    border: none;
    padding: 0;
    margin: 0;
}

/* ---- Top-level group: h3 heading, no border box ---- */
x.dd-opt-group--top .dd-opt-group-heading {
    font-size: 1.05em;
    font-weight: 600;
    margin: 0 0 8px;
    padding: 0;  /* override .dd-donate-form h3 { padding-top: 30px } */
}

/* ---- Nested group: outlined fieldset ---- */
.dd-opt-group--nested {
    border: 1px solid #ccd0d4;
    border-radius: var(--dd-radius, 4px);
    padding: 16px 20px;
}
.dd-opt-group--nested legend {
    font-weight: 600;
    font-size: 1.05em;
    padding: 0 6px;
}

/* ---- Repeating group instance ---- */
.dd-group-instance {
    position: relative;
    margin-bottom: 16px;
    /* leave room for the remove button sitting in the top-right corner */
    /* padding-top: 28px; */
}

.dd-group-instance + .dd-group-instance {
    border-top: 1px solid #e2e4e7;
    padding-top: 28px;
}

.dd-instance-label {
    margin: 0 0 10px;
    font-size: 0.9em;
    color: #787c82;
}

/* Remove-instance button — absolute top-right within its own instance only */
.dd-remove-instance {
    position: absolute;
    top: 4px;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: none;
    border: 1px solid var(--dd-input-border, #ccc);
    border-radius: 3px;
    cursor: pointer;
    color: var(--dd-color-danger, #c0392b);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}
.dd-remove-instance::before {
    content: "✕";
    font-size: 10px;
}
.dd-remove-instance:hover {
    background: #fce4e4;
    border-color: var(--dd-color-danger, #c0392b);
}
.dd-remove-instance:focus {
    outline: 2px solid var(--dd-color-danger, #c0392b);
    outline-offset: 1px;
}

/* ---- Empty group placeholder ---- */
.dd-opt-empty {
    color: #a7aaad;
    font-size: 0.875em;
}

/* ---- Amounts section (Registration Amount → Donation → Subtotal → Fee → Total) ---- */
.dd-amounts-section {
    margin-top: 24px;
    border-top: 1px solid #e2e4e7;
    padding-top: 20px;
}

/* ---- Donation prompt text ---- */
.dd-donation-prompt {
    margin: 0 0 10px;
    font-size: 0.9em;
    color: #555;
}

/* ---- Donation amount section spacing ---- */
.dd-donation-amount-section {
    margin-bottom: 20px;
}

/* ---- Donation amount input with leading $ prefix ---- */
.dd-amount-input-wrapper {
    display: block;
    position: relative;
    width: 100%;
}
.dd-amount-currency {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.dd-amount-input-wrapper input[type="number"] {
    width: 100%;
    text-align: right;
    padding-left: 22px;
    -moz-appearance: textfield;
}
.dd-amount-input-wrapper input[type="number"]::-webkit-outer-spin-button,
.dd-amount-input-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ---- Amount rows (Registration Amount, Subtotal, Fee, Total) ---- */
.dd-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
}

.dd-amount-label {
    color: #333;
}

.dd-amount-value {
    font-variant-numeric: tabular-nums;
    color: #333;
}

/* ---- Processing fee row (checkbox + amount side-by-side) ---- */
.dd-processing-fee-section {
    margin: 4px 0;
}

.dd-fee-row {
    gap: 12px;
    border-top: 1px solid #ccc;
}

.dd-fee-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
}

/* ---- Total row emphasis ---- */
.dd-total-row {
    border-top: 1px solid #999;
    margin-top: 4px;
    padding-top: 8px;
    font-size: 1.1em;
}

.dd-submit-buttons { padding-top:30px; }

/* ---- Options snapshot (confirmation page) ---- */
x.dd-options-snapshot {
    margin: 20px 0;
}

x.dd-snapshot-heading {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 10px;
    padding-bottom: 4px;
    border-bottom: 2px solid #e2e4e7;
}

x.dd-snapshot-list {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    align-items: baseline;
}

x.dd-snapshot-list dt {
    font-weight: 600;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #555;
}

x.dd-snapshot-list dd {
    margin: 0;
}

x.dd-snapshot-group {
    margin: 12px 0 0;
    padding: 12px 14px;
    background: #f8f9fa;
    border-left: 3px solid var(--dd-color-primary, #2271b1);
    border-radius: 0 3px 3px 0;
}

x.dd-snapshot-group-label {
    font-weight: 700;
    color: var(--dd-color-primary, #2271b1);
    margin: 0 0 8px;
}

x.dd-snapshot-instance {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e4e7;
}

x.dd-snapshot-instance:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

x.dd-snapshot-instnum {
    font-size: 0.8em;
    font-weight: 600;
    color: #787c82;
    margin: 0 0 4px;
}

/* ---- Terms & Conditions ---- */
.dd-terms-section {
    margin: 24px 0 16px;
}

.dd-terms-box {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccd0d4;
    border-radius: var(--dd-radius, 4px);
    padding: 12px 16px;
    font-family: 'Roboto Condensed', Arial, sans-serif;
    font-weight: 300;
    font-size: 0.875em;
    line-height: 1.6;
    color: #444;
    background: #fafafa;
    margin-bottom: 10px;
}

.dd-terms-box:focus {
    outline: 2px solid var(--dd-color-primary, #2271b1);
    outline-offset: 2px;
}

.dd-terms-box p  { display:block; margin: 0; line-height:110%; }
.dd-terms-box p:last-child { margin-bottom: 0; }
.dd-terms-box ul,
.dd-terms-box ol { margin: 0 0 0.75em; padding-left: 1.75em; line-height:110%; }
.dd-terms-box ul { list-style: disc; }
.dd-terms-box ol { list-style: decimal; }
.dd-terms-box li { margin-bottom: 0.2em; }
.dd-terms-box strong { font-weight:500; }

.dd-terms-acknowledgment {
    margin: 0;
    font-size: 0.875em;
    line-height: 1.5;
    color: #444;
}

/* "Terms & Conditions" inline link — styled as text, not a button */
.dd-terms-link {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}
.dd-terms-link:hover,
.dd-terms-link:focus {
    opacity: 0.7;
    outline: none;
}

/* T&Cs content rendered inside the modal */
.dd-terms-content p  { margin: 0 0 0.75em; }
.dd-terms-content p:last-child { margin-bottom: 0; }
.dd-terms-content ul,
.dd-terms-content ol { margin: 0 0 0.75em; padding-left: 1.75em; }
.dd-terms-content ul { list-style: disc; }
.dd-terms-content ol { list-style: decimal; }
.dd-terms-content li { margin-bottom: 0.2em; }

/* ---- Inline CAPTCHA error (shown when widget not completed on submit) ---- */
.dd-captcha-inline-error {
    color: var(--dd-color-danger, #c0392b);
    font-weight: 600;
    font-size: 0.9em;
    margin: 0 0 10px;
    padding: 6px 10px;
    background: #fdf2f2;
    border-left: 3px solid var(--dd-color-danger, #c0392b);
    border-radius: 0 3px 3px 0;
}

/* ---- General form error messages ---- */
.dd-error {
    color: var(--dd-color-danger, #c0392b);
    font-weight: 600;
}

/* =============================================================================
   Vehicle Picker
   ============================================================================= */

/* ---- Garage selection list ---- */
.dd-garage-list {
    margin-bottom: 12px;
}

.dd-garage-list-label {
    margin: 0 0 6px;
    font-size: 0.95em;
}

.dd-garage-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 4px;
    border: 1px solid #ddd;
    border-radius: var(--dd-radius, 4px);
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.15s;
}

.dd-garage-option:hover {
    background: #f5f5f5;
}

.dd-garage-option input[type="radio"] {
    flex-shrink: 0;
    margin: 0;
}

.dd-garage-option-new {
    border-style: dashed;
    color: #555;
    font-style: italic;
}

/* ---- Vehicle entry rows ---- */
.dd-vf-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dd-vf-label {
    flex: 0 0 90px;
    font-weight: 600;
    font-size: 0.9em;
    color: #444;
}

/* ---- Combobox ---- */
.dd-combobox {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.dd-combobox-input {
    flex: 1;
    min-width: 0;
    /* right padding fixed at 32px to clear the toggle arrow; left/top/bottom use tokens */
    padding: var(--dd-input-padding-y, 6px) 32px var(--dd-input-padding-y, 6px) var(--dd-input-padding-x, 8px);
    border: 1px solid var(--dd-input-border, #ccc);
    border-radius: var(--dd-radius, 4px);
    background: var(--dd-input-bg, #fff);
    color: var(--dd-input-text, inherit);
    font-size: 0.95em;
    line-height: 1.4;
    box-sizing: border-box;
}

.dd-combobox-input:focus {
    outline: 2px solid var(--dd-color-primary, #2271b1);
    outline-offset: 1px;
    border-color: var(--dd-color-primary, #2271b1);
}

.dd-combobox-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #666;
    font-size: 0.8em;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dd-combobox-toggle:hover {
    color: #333;
}

.dd-combobox-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--dd-input-border, #ccc);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.dd-combobox-list li {
    padding: 7px 10px;
    cursor: pointer;
    font-size: 0.9em;
    line-height: 1.3;
}

.dd-combobox-list li:hover,
.dd-combobox-list li.dd-cb-active {
    background: #e8f0fb;
    color: #1a3a6c;
}

/* ---- Save status indicator (eager AJAX save) ---- */
.dd-vf-save-status {
    margin-left: 12px;
    font-size: 0.85em;
    color: #2a7a2a;
    font-style: italic;
}

/* ---- Save-to-garage row ---- */
.dd-vf-save-row label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9em;
    cursor: pointer;
    color: #555;
}

.dd-vf-save-row input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
}

/* =============================================================================
   Compact vehicle picker (donation form)
   ============================================================================= */

.dd-vp-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Wrapper gives the select its flex sizing and anchors the custom arrow */
.dd-vp-select-wrap {
    position: relative;
    flex: 1 1 220px;
    min-width: 180px;
    /* max-width: 420px; */
}

/* Triangle arrow — matches .dd_selectlist::after */
.dd-vp-select-wrap::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    pointer-events: none;
}

.dd-vp-select {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    /* right padding fixed at 30px to clear the custom arrow; left/top/bottom use tokens */
    padding: var(--dd-input-padding-y, 6px) 30px var(--dd-input-padding-y, 6px) var(--dd-input-padding-x, 10px);
    border: 1px solid var(--dd-input-border, #ccc);
    border-radius: var(--dd-radius, 4px);
    font-size: 0.95em;
    height: 36px;
    background-image: none;
    background-color: var(--dd-input-bg, #fff);
    color: var(--dd-input-text, inherit);
    box-sizing: border-box;
}

.dd-vp-edit-btn {
    flex-shrink: 0;
    padding: 0 6px;
    height: 36px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--dd-radius, 4px);
    cursor: pointer;
    font-size: 1.1em;
    color: #555;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}
.dd-vp-edit-btn:hover,
.dd-vp-edit-btn:focus {
    color: #0073aa;
    border-color: #0073aa;
    outline: none;
}

.dd-vp-add-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.dd-vp-inline-error {
    color: var(--dd-color-danger, #c0392b);
    font-weight: 600;
    font-size: 0.9em;
    margin: 6px 0 0;
    padding: 6px 10px;
    background: #fdf2f2;
    border-left: 3px solid var(--dd-color-danger, #c0392b);
    border-radius: 0 3px 3px 0;
}

/* =============================================================================
   Vehicle modal
   ============================================================================= */

.dd-modal {
    position: fixed;
    inset: 0;
    z-index: 100002; /* above WP admin bar (100001), site headers, and all theme elements */
    display: flex;
    align-items: center;
    justify-content: center;
}

.dd-modal[hidden] {
    display: none;
}

.dd-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.dd-modal-box {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    padding: 28px 32px 24px;
    width: 100%;
    /* max-width: 480px; */
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.dd-modal-title {
    margin: 0 0 20px;
    font-size: 1.2em;
    font-weight: 700;
}

.dd-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.dd-vm-error {
    color: var(--dd-color-danger, #c0392b);
    font-size: 0.9em;
    margin: 8px 0 0;
}

/* Prevent body scroll while modal is open */
body.dd-modal-open {
    overflow: hidden;
}

/* ---- Year out-of-range confirmation panel ---- */
.dd-vm-year-confirm {
    background: #fff8e1;
    border-left: 3px solid #e6a817;
    border-radius: 0 3px 3px 0;
    padding: 10px 14px;
    margin-top: 16px;
}

.dd-vm-year-confirm-msg {
    margin: 0 0 10px;
    font-size: 0.95em;
    color: #444;
}

.dd-vm-year-confirm-actions {
    display: flex;
    gap: 10px;
}

/* ---- Plain modal inputs (year, color, license plate, notes) ---- */
/* Explicit styles so appearance is consistent regardless of the host page's
   theme. These match the .dd-combobox-input sizing/border/radius. */
.dd-vm-year,
.dd-vm-color,
.dd-vm-license-plate,
.dd-vm-notes {
    flex: 1;
    min-width: 0;
    padding: var(--dd-input-padding-y, 6px) var(--dd-input-padding-x, 8px);
    border: 1px solid var(--dd-input-border, #ccc);
    border-radius: var(--dd-radius, 4px);
    background: var(--dd-input-bg, #fff);
    color: var(--dd-input-text, inherit);
    font-size: 0.95em;
    line-height: 1.4;
    box-sizing: border-box;
    font-family: inherit;
}
.dd-vm-notes {
    resize: vertical;
    align-self: flex-start; /* prevent label from centering against full textarea height */
}
.dd-vm-year:focus,
.dd-vm-color:focus,
.dd-vm-license-plate:focus,
.dd-vm-notes:focus {
    outline: 2px solid var(--dd-color-primary, #2271b1);
    outline-offset: 1px;
    border-color: var(--dd-color-primary, #2271b1);
}
/* Align the Notes label to the top of its row, not vertically centred */
.dd-vm-notes-row {
    align-items: flex-start;
}
.dd-vm-notes-row .dd-vf-label {
    padding-top: 7px; /* optical alignment with first text line */
}

/* ── Invalid-field highlight ──────────────────────────────────────────────
   Two complementary triggers, same visual treatment:

   .dd-field-invalid  — added by JS on validation failure (vehicle year,
                        CAPTCHA, required option fields, contact/amount
                        fields as a belt-and-suspenders fallback).

   :user-invalid      — CSS-native; fires after the user has interacted with
                        a field that fails HTML5 validation (required,
                        type=email, min, etc.).  Only modern browsers support
                        it — older ones fall back to their own native styling.

   Both use --dd-color-danger so the colour follows the Appearance setting.
   color-mix() gives a subtle tinted glow for the outline; the border-color
   is always the full danger colour.
   ──────────────────────────────────────────────────────────────────────── */
.dd-field-invalid,
.dd-donate-form input:user-invalid,
.dd-donate-form select:user-invalid,
.dd-donate-form textarea:user-invalid {
    border-color: var(--dd-color-danger, #c0392b) !important;
    outline: 2px solid color-mix(in srgb, var(--dd-color-danger, #c0392b) 25%, transparent);
    outline-offset: 0;
}

/* ---- Combobox loading state ---- */
.dd-combobox.dd-cb-loading {
    position: relative;
}
.dd-combobox.dd-cb-loading .dd-combobox-toggle {
    visibility: hidden;   /* keep space; hide the ▾ arrow */
}
.dd-combobox.dd-cb-loading::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #555;
    border-radius: 50%;
    animation: dd-spin 0.6s linear infinite;
    pointer-events: none;
}
@keyframes dd-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}
