/* ==========================================================================
 * Dream Motoring World - Test Drive Registration
 * File: css/testdrive.css
 * Rules:
 * - Every selector is prefixed .testdrive- or scoped under #test-drive-pg, so
 *   nothing here can affect another page.
 * - Colours, fonts and spacing come from the theme's :root custom properties.
 *   The only literal colours are neutral, decorative rgba() values (soft
 *   focus tint and button shadow) that have no token equivalent.
 * - Theme classes (.btn, .message_red, .form-group, grid, widgets) are reused,
 *   not redefined; only their size/position is adjusted inside the section.
 * ========================================================================== */

/* --------------------------------------------------------------- intro ---- */
#test-drive-pg .testdrive-intro {
    margin: 0 0 var(--space-6);
    font-size: 16px;
    line-height: 1.6;
}

/* ---------------------------------------------------------------- brand --- */
#test-drive-pg .testdrive-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 var(--space-6);
    animation: td-fade-in 0.6s ease-out both;
}

#test-drive-pg .testdrive-brand img {
    display: block;
    width: 150px;
    height: auto;
}

/* Shared keyframes. Decorative only; the section works with them disabled. */
@keyframes td-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}
@keyframes td-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
@keyframes td-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- portal overrides --- */
body.portal.test-drive #test-drive-pg select,
body.portal.test-drive #test-drive-pg textarea,
body.portal.test-drive #test-drive-pg input[type="text"],
body.portal.test-drive #test-drive-pg input[type="tel"],
body.portal.test-drive #test-drive-pg input[type="email"],
body.portal.test-drive #test-drive-pg input[type="file"] {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--p-border, #ddd);
    border-radius: var(--p-radius, 3px);
    background: #fff;
    color: var(--p-text, #000);
    font: inherit;
    font-size: 16px;
    box-sizing: border-box;
}

body.portal.test-drive #test-drive-pg select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath fill='%23555' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

body.portal.test-drive #test-drive-pg input[type="file"] {
    line-height: normal;
    padding-top: 10px;
    cursor: pointer;
}

body.portal.test-drive #test-drive-pg input:focus,
body.portal.test-drive #test-drive-pg select:focus,
body.portal.test-drive #test-drive-pg textarea:focus {
    border-color: var(--p-accent, #3c9be1);
    box-shadow: 0 0 0 3px rgba(60, 155, 225, 0.22);
    outline: 0;
}

body.portal.test-drive #test-drive-pg .testdrive-terms,
body.portal.test-drive #test-drive-pg .testdrive-consent {
    background: #f2f2f2;
    border-color: var(--p-border, #ddd);
    color: var(--p-text, #000);
}

body.portal.test-drive #test-drive-pg .testdrive-consent label {
    color: var(--p-text, #000);
}

body.portal.test-drive #test-drive-pg .testdrive-terms h2,
body.portal.test-drive #test-drive-pg .testdrive-terms p,
body.portal.test-drive #test-drive-pg .testdrive-terms li {
    color: var(--p-text, #000);
}

body.portal.test-drive #test-drive-pg .testdrive-submit {
    width: auto;
    min-width: 200px;
    height: 48px;
    padding: 0 24px;
    line-height: 48px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s linear, opacity 0.2s linear;
    text-align: left;
    margin-top: 24px;
    background: var(--p-accent, #3c9be1);
    color: #fff;
    font-weight: 700;
}

body.portal.test-drive #test-drive-pg .testdrive-submit:hover {
    background: var(--p-accent-hover, #2f87cb);
}

body.portal.test-drive #test-drive-pg .testdrive-hint,
body.portal.test-drive #test-drive-pg .testdrive-intro {
    color: var(--p-muted, #555);
}

body.portal.test-drive .page-hdr {
    background: var(--p-hero, #313131);
}

body.portal.test-drive .page-hdr::before {
    background: transparent;
}
#test-drive-pg .testdrive-form {
    margin: 0;
}

#test-drive-pg .testdrive-field {
    margin: 0 0 var(--space-4);
}

#test-drive-pg .testdrive-field label {
    display: block;
    float: none;
    margin: 0 0 var(--space-2);
    font-family: var(--heading-font);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-color);
}

#test-drive-pg .testdrive-field input[type="file"] {
    display: block;
    float: none;
    width: 100%;
    max-width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 var(--space-3);
    box-sizing: border-box;
    font-family: var(--heading-font);
    font-size: 16px;
    line-height: 46px;
    color: var(--text-color);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s linear, box-shadow 0.2s linear;
}

#test-drive-pg .testdrive-field input[type="text"],
#test-drive-pg .testdrive-field input[type="tel"],
#test-drive-pg .testdrive-field input[type="email"] {
    display: block;
    float: none;
    width: 100%;
    max-width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 var(--space-3);
    box-sizing: border-box;
    font-family: var(--heading-font);
    font-size: 16px;
    line-height: 46px;
    text-indent: 0;
    color: var(--text-color);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: none;
    transition: border-color 0.2s linear, box-shadow 0.2s linear;
}

#test-drive-pg .testdrive-field input:hover {
    border-color: var(--primary-color);
}

#test-drive-pg .testdrive-field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(17, 154, 225, 0.22);
    outline: 0;
}

/* Invalid state: the token colour plus the .message_red text below, so the
   error is never communicated by colour alone. */
#test-drive-pg .testdrive-field input[aria-invalid="true"] {
    border-color: var(--primary-color);
    border-width: 2px;
}

#test-drive-pg .testdrive-hint {
    display: block;
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.75;
}

/* .message_red is the site's own error styling (red tint + red border). Kept,
   but compacted so it sits directly under the field. No colours redefined.
   The reveal animation mirrors the slide of the box opening. */
#test-drive-pg .testdrive-error.message_red {
    display: block;
    margin: 6px 0 0;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 3px;
    background-image: none;
    animation: td-slide 0.25s ease-out both;
}

#test-drive-pg .testdrive-error[hidden] {
    display: none;
}

/* ------------------------------------------------------------- captcha ---- */
#test-drive-pg .testdrive-field--captcha label {
    font-weight: 700;
}

#test-drive-pg .testdrive-field--captcha input {
    max-width: 160px;
}

/* ------------------------------------------------------------- consent ---- */
#test-drive-pg .testdrive-consent {
    margin: 18px 0 0;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #0b1220;
}

#test-drive-pg .testdrive-consent label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 44px;
    font-size: 0.96rem;
    cursor: pointer;
}

#test-drive-pg .testdrive-consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 2px 0 0;
    accent-color: var(--accent-color);
    cursor: pointer;
}

#test-drive-pg .testdrive-consent a {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ---------------------------------------------------------- conditions ---- */
#test-drive-pg .testdrive-terms {
    margin: 0 0 22px;
    padding: 18px;
    border-left: 4px solid var(--accent-color);
    border-radius: 8px;
    background: #0b1220;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

#test-drive-pg .testdrive-terms h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
}

#test-drive-pg .testdrive-terms ol {
    margin: 0;
    padding-left: 22px;
}

#test-drive-pg .testdrive-terms li + li {
    margin-top: 8px;
}

/* -------------------------------------------------------- submit button --- */
#test-drive-pg .testdrive-submit-row {
    margin: var(--space-5) 0 0;
    text-align: center;
}

/* Width is set here; colour, radius and hover come from the theme's .btn. */
#test-drive-pg .testdrive-submit {
    width: auto;
    min-width: 200px;
    height: 48px;
    padding: 0 24px;
    line-height: 48px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s linear, opacity 0.2s linear;
    text-align: left;
    margin-top: 24px;
}

#test-drive-pg .testdrive-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

#test-drive-pg .testdrive-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

#test-drive-pg .testdrive-submit:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

#test-drive-pg .testdrive-submit[disabled],
#test-drive-pg .testdrive-submit[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* --------------------------------------------------------------- status --- */
#test-drive-pg .testdrive-status {
    margin: 14px 0 0;
    min-height: 1.4em;
    font-size: 14px;
    text-align: center;
}

#test-drive-pg .testdrive-status:empty {
    margin: 0;
    min-height: 0;
}

/* -------------------------------------------------------------- success --- */
#test-drive-pg .testdrive-result {
    padding: 26px;
    border: 1px solid rgba(52, 211, 153, 0.45);
    border-radius: var(--radius);
    background: rgba(52, 211, 153, 0.08);
    animation: td-rise 0.45s ease-out both;
}

#test-drive-pg .testdrive-result[hidden] {
    display: none;
}

#test-drive-pg .testdrive-result h2 {
    margin: 0 0 10px;
    color: var(--ok);
    font-size: 1.4rem;
}

#test-drive-pg .testdrive-result p {
    margin: 0 0 10px;
    font-size: 16px;
}

#test-drive-pg .testdrive-result a {
    color: var(--gold-strong);
    text-decoration: underline;
}

#test-drive-pg .testdrive-result__ref {
    display: inline-block;
    margin: 8px 0 0;
    padding: 10px 14px;
    border: 1px dashed rgba(212, 168, 75, 0.65);
    border-radius: 8px;
    color: var(--gold-strong);
    font-family: "Courier New", Courier, monospace;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

/* ------------------------------------------------------------- honeypot --- */
#test-drive-pg .testdrive-hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* --------------------------------------------------------------- sidebar -- */
#test-drive-pg #sidebar #get-in-touch li {
    margin-bottom: var(--space-1);
}

#test-drive-pg #sidebar #get-in-touch li span {
    color: var(--accent-color);
}

#test-drive-pg #sidebar #get-in-touch li a {
    color: var(--text-color);
    font-family: var(--heading-font);
    font-size: 18px;
    font-weight: var(--heading-weight);
    text-decoration: none;
}

#test-drive-pg #sidebar #get-in-touch li a:hover {
    color: var(--accent-color);
}

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 767px) {
    #test-drive-pg .testdrive-field input[type="text"],
    #test-drive-pg .testdrive-field input[type="tel"],
    #test-drive-pg .testdrive-field input[type="email"] {
        font-size: 16px; /* keeps iOS from zooming on focus */
    }

    #test-drive-pg .testdrive-submit {
        width: 100%;
        min-width: 0;
    }

    #test-drive-pg .testdrive-brand img {
        width: 124px;
    }
}

/* --- motion preferences -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    #test-drive-pg .testdrive-brand,
    #test-drive-pg .testdrive-error.message_red,
    #test-drive-pg .testdrive-result {
        animation: none;
    }

    #test-drive-pg .testdrive-field input[type="text"],
    #test-drive-pg .testdrive-field input[type="tel"],
    #test-drive-pg .testdrive-field input[type="email"],
    #test-drive-pg .testdrive-submit {
        transition: none;
    }

    #test-drive-pg .testdrive-submit:hover,
    #test-drive-pg .testdrive-submit:active {
        transform: none;
        box-shadow: none;
    }
}
