/* ==========================================================================
   Dealer Search page styles
   Built on top of the ucda2026 theme (wwwroot/css/theme.css) and its tokens:
   --theme-color-1 navy, --theme-color-2 yellow, --theme-color-3 blue,
   --theme-color-4 light blue, --theme-color-5 off-white, --theme-color-6 border
   ========================================================================== */

/* --------------------------------------------------------------------------
   Search panel
   -------------------------------------------------------------------------- */
.dealer-search {
    position: relative;
    z-index: 2;
    margin-top: -2.5rem;
    padding-bottom: 2.5rem;
}

.dealer-search__panel {
    background-color: #fff;
    border: solid 0.125rem var(--theme-color-6);
    box-shadow: 0 0.625rem 1.875rem rgba(0, 19, 95, 0.10);
    padding: 1.875rem 1.5rem 1.25rem;
}

@media screen and (min-width: 64em) {
    .dealer-search__panel {
        padding: 2.5rem 2.5rem 1.5rem;
    }
}

.dealer-search__form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--theme-color-1);
    margin-bottom: 0.5rem;
}

.dealer-search__field {
    position: relative;
    margin-bottom: 1rem;
}

.dealer-search__field > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--theme-color-3);
    pointer-events: none;
}

.dealer-search__form [type="text"] {
    height: 3.25rem;
    margin: 0;
    padding: 0.5rem 1rem 0.5rem 2.75rem;
    border: solid 0.125rem var(--theme-color-6);
    border-radius: 0.75rem;
    background-color: var(--theme-color-5);
    box-shadow: none;
    font-size: 1rem;
    font-weight: 500;
    color: #1e282d;
    transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.dealer-search__form [type="text"]::placeholder {
    color: #7b8794;
    font-weight: 400;
}

.dealer-search__form [type="text"]:focus {
    outline: 0;
    border-color: var(--theme-color-3);
    background-color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(59, 89, 152, 0.15);
}

.dealer-search__actions {
    display: flex;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.dealer-search__actions .dealer-btn {
    flex: 1 1 0;
    width: auto;
}

/* Buttons (built on the theme's .btn base) ------------------------------- */
.dealer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 3.25rem;
    min-height: 3.25rem;
    padding: 0 1.125rem;
    border-radius: 0.75rem;
    border: solid 0.1875rem transparent;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: 0.3s;
}

.dealer-btn i {
    font-size: 0.9375rem;
}

.dealer-btn.is-busy {
    opacity: 0.7;
    pointer-events: none;
}

.dealer-btn--primary {
    background-color: var(--theme-color-2);
    border-color: var(--theme-color-2);
    color: var(--theme-color-1);
}

.dealer-btn--primary:hover,
.dealer-btn--primary:focus {
    background-color: var(--theme-color-1);
    border-color: var(--theme-color-1);
    color: var(--theme-color-2);
}

.dealer-btn--secondary {
    background-color: transparent;
    border-color: var(--theme-color-1);
    color: var(--theme-color-1);
}

.dealer-btn--secondary:hover,
.dealer-btn--secondary:focus {
    background-color: var(--theme-color-1);
    color: #fff;
}

.dealer-btn--outline {
    background-color: #fff;
    border-color: var(--theme-color-3);
    color: var(--theme-color-3);
    margin: 0 auto;
}

.dealer-btn--outline:hover,
.dealer-btn--outline:focus {
    background-color: var(--theme-color-3);
    color: #fff;
}

/* Cloudflare Turnstile widget (only rendered when a challenge is needed) ---- */
.dealer-search__turnstile {
    margin-bottom: 0.75rem;
}

.dealer-search__turnstile:empty {
    display: none;
}

/* Secondary options row ---------------------------------------------------- */
.dealer-search__options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    padding-top: 0.875rem;
    border-top: 0.0625rem solid var(--theme-color-6);
}

.dealer-search__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #1e282d;
    cursor: pointer;
}

.dealer-search__checkbox input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    accent-color: var(--theme-color-1);
    cursor: pointer;
}

.dealer-search__reset {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--theme-color-3);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.3s;
}

.dealer-search__reset:hover,
.dealer-search__reset:focus {
    color: var(--theme-color-1);
    text-decoration: underline;
}

.dealer-search__status {
    margin-left: auto;
    font-size: 0.875rem;
    color: #5b6b7b;
}

.dealer-search__status.is-error {
    color: #b42318;
}

.dealer-search__status.is-success {
    color: #027a48;
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */
.dealer-results {
    background-color: var(--theme-color-5);
    border-top: 0.0625rem solid var(--theme-color-6);
    padding: 2.5rem 0 3.125rem;
}

.dealer-results__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
}

.dealer-results__count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-color-1);
}

.dealer-results__count small {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    color: #5b6b7b;
    margin-top: 0.125rem;
}

.dealer-results__sort {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.dealer-results__sort label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #5b6b7b;
    margin: 0;
    white-space: nowrap;
}

.dealer-results__sort select {
    height: 2.5rem;
    margin: 0;
    padding: 0 2.25rem 0 0.875rem;
    border: solid 0.125rem var(--theme-color-6);
    border-radius: 0.625rem;
    background-color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--theme-color-1);
    cursor: pointer;
}

.dealer-results__sort select:focus {
    outline: 0;
    border-color: var(--theme-color-3);
    box-shadow: 0 0 0 0.25rem rgba(59, 89, 152, 0.15);
}

.dealer-results__grid {
    align-items: stretch;
}

.dealer-results__more {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

/* Card ---------------------------------------------------------------------- */
.dealer-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: #fff;
    border: solid 0.125rem var(--theme-color-6);
    border-radius: 1.25rem;
    padding: 1.625rem 1.5rem 1.375rem;
    box-shadow: 0 0.1875rem 0.75rem rgba(0, 19, 95, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dealer-card:hover,
.dealer-card:focus-within {
    transform: translateY(-0.125rem);
    border-color: var(--theme-color-4);
    box-shadow: 0 0.5625rem 1.5625rem rgba(0, 19, 95, 0.12);
}

.dealer-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.dealer-card__name {
    font-family: var(--theme-font-2);
    font-size: 1.3125rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--theme-color-1);
    margin: 0;
}

.dealer-card__name a {
    color: var(--theme-color-1);
    text-decoration: none;
    transition: color 0.3s;
}

.dealer-card__name a:hover,
.dealer-card__name a:focus {
    color: var(--theme-color-3);
    text-decoration: underline;
    text-decoration-color: var(--theme-color-2);
    text-decoration-thickness: 0.125rem;
    text-underline-offset: 0.1875rem;
}

.dealer-card__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
    flex: 0 0 auto;
}

.dealer-card__badge {
    display: inline-block;
    background-color: var(--theme-color-2);
    color: var(--theme-color-1);
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    padding: 0.375rem 0.5rem;
    text-transform: uppercase;
    margin-top: 0.125rem;
}

.dealer-card__distance {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background-color: var(--theme-color-5);
    border: 0.0625rem solid var(--theme-color-6);
    color: var(--theme-color-3);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.375rem 0.625rem;
    white-space: nowrap;
}

.dealer-card__legal {
    color: var(--theme-color-3);
    font-size: 0.75rem;
    font-style: italic;
    font-weight: 500;
    line-height: 1.4;
    text-transform: uppercase;
    margin-bottom: 1.125rem;
}

.dealer-card__section {
    margin-bottom: 0.875rem;
}

.dealer-card__label {
    display: block;
    color: #697987;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.35;
    margin-bottom: 0.125rem;
}

.dealer-card__value {
    display: block;
    color: #142b3d;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.45;
}

a.dealer-card__value {
    color: #142b3d;
    text-decoration: none;
    transition: color 0.3s;
}

a.dealer-card__value:hover,
a.dealer-card__value:focus {
    color: var(--theme-color-3);
    text-decoration: underline;
}

.dealer-card__contact {
    margin-top: auto;
    padding-top: 0.875rem;
    border-top: 0.0625rem solid var(--theme-color-6);
    font-size: 0.875rem;
    color: #445765;
}

.dealer-card__contact-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.375rem;
}

.dealer-card__contact-row:first-child {
    margin-top: 0;
}

.dealer-card__contact-row i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background-color: var(--theme-color-5);
    color: var(--theme-color-3);
    font-size: 0.8125rem;
}

.dealer-card__contact-row a {
    color: var(--theme-color-3);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s;
}

.dealer-card__contact-row a:hover,
.dealer-card__contact-row a:focus {
    color: var(--theme-color-1);
    text-decoration: underline;
    text-decoration-color: var(--theme-color-2);
    text-decoration-thickness: 0.125rem;
    text-underline-offset: 0.1875rem;
}

/* Directions link: same treatment as the theme's .card__link arrow ------- */
.dealer-card__link {
    margin-top: 1rem;
}

.dealer-card__link a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    color: var(--theme-color-3);
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
}

.dealer-card__link a span {
    position: relative;
    color: var(--theme-color-3);
    font-weight: 600;
    transition: 0.3s;
}

.dealer-card__link a span:before {
    content: "";
    width: 0;
    height: 0.125rem;
    background-color: var(--theme-color-2);
    position: absolute;
    bottom: 0;
    left: 0;
    transition: 0.3s;
    z-index: 1;
}

.dealer-card__link a span:after {
    content: "";
    width: 100%;
    height: 0.125rem;
    background-color: var(--theme-color-3);
    position: absolute;
    bottom: 0;
    right: 0;
    transition: 0.3s;
    z-index: 0;
}

.dealer-card__link a:after {
    content: "";
    width: 0.96875rem;
    height: 1.3125rem;
    flex: 0 0 auto;
    margin-left: 0.625rem;
    background-color: var(--theme-color-2);
    -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17.5 24'><path d='M2.5 3L13.5 12L2.5 21' fill='none' stroke='black' stroke-width='5' stroke-linejoin='miter'/></svg>") no-repeat center;
    mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17.5 24'><path d='M2.5 3L13.5 12L2.5 21' fill='none' stroke='black' stroke-width='5' stroke-linejoin='miter'/></svg>") no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.dealer-card__link a:hover span:before,
.dealer-card__link a:focus span:before {
    width: 100%;
}

.dealer-card__link a:hover span:after,
.dealer-card__link a:focus span:after {
    width: 0;
}

/* Empty / error states ------------------------------------------------------ */
.dealer-results__empty {
    width: 100%;
    background-color: #fff;
    border: solid 0.125rem var(--theme-color-6);
    border-radius: 1.25rem;
    padding: 3rem 1.5rem;
    text-align: center;
}

.dealer-results__empty i {
    font-size: 2.5rem;
    color: var(--theme-color-4);
    margin-bottom: 1rem;
}

.dealer-results__empty h3 {
    font-family: var(--theme-font-2);
    font-size: 1.375rem;
    color: var(--theme-color-1);
    margin-bottom: 0.5rem;
}

.dealer-results__empty p {
    margin-bottom: 0;
    color: #5b6b7b;
}

.dealer-results__empty a {
    color: var(--theme-color-3);
    font-weight: 600;
}

/* Info cards section spacing ------------------------------------------------- */
.dealer-info {
    padding: 3.125rem 0;
}

/* Responsive tweaks ---------------------------------------------------------- */
@media screen and (max-width: 39.9375em) {
    .dealer-search {
        margin-top: -1.25rem;
    }

    .dealer-search__actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }

    .dealer-search__actions .dealer-btn {
        flex: 0 0 auto;
        width: 100%;
        min-height: 3.25rem;
        font-size: 1.0625rem;
    }

    .dealer-card {
        padding: 1.375rem 1.25rem;
    }

    .dealer-card__name {
        font-size: 1.1875rem;
    }

    .dealer-search__status {
        margin-left: 0;
        flex-basis: 100%;
    }

    .dealer-results__toolbar {
        display: block;
    }

    .dealer-results__sort {
        margin-top: 0.75rem;
    }
}
