/* ==========================================================================
   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; }
}

/* ---------------------------------------------------------------- form ---- */
#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="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); /* accent tint, from --accent-color */
    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: var(--space-1) 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: var(--space-2) 0 0;
    padding: var(--space-2) var(--space-3);
    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: 0 0 var(--space-4);
}

#test-drive-pg .testdrive-consent__label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}

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

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

/* -------------------------------------------------------- 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 var(--space-6);
    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;
}

#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: var(--space-3) 0 0;
    min-height: 1px;
    font-size: 14px;
    text-align: center;
}

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

/* -------------------------------------------------------------- success --- */
#test-drive-pg .testdrive-result {
    margin: var(--space-5) 0 0;
    padding: var(--space-5);
    border-left: 3px solid var(--accent-color);
    border-radius: 3px;
    animation: td-rise 0.45s ease-out both;
}

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

#test-drive-pg .testdrive-result__title {
    margin: 0 0 var(--space-3);
    font-family: var(--heading-font);
    font-size: 22px;
    line-height: 1.3;
    color: var(--heading-color);
}

#test-drive-pg .testdrive-result p {
    margin: 0 0 var(--space-2);
    font-size: 16px;
    line-height: 1.6;
}

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

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

/* --------------------------------------------------------------- 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-result {
        padding: var(--space-4);
    }

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

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

/* --- motion preferences -------------------------------------------------- */
/* Decorative movement is removed for users who ask the OS to keep still;
   states and colours remain, so nothing depends on the animation. */
@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;
    }
}
