/* =====================================================================
   Auto Part Finder — front-end widget
   Token system:
     ink        #11162B   primary text
     slate      #5B6178   secondary text
     canvas     #F6F7FB   card / page background
     line       #E3E6F0   borders
     ignition   #2451FF   primary accent (blue)
     signal     #FF7A33   secondary accent (amber) — focus/active states
     gauge-end  #17C994   progress-fill gradient end (teal)
   Type: "Space Grotesk" (display) + "Inter" (UI/body)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600;700&display=swap');

.apf-finder {
    --apf-ink: #11162b;
    --apf-slate: #5b6178;
    --apf-canvas: #f6f7fb;
    --apf-line: #e3e6f0;
    --apf-ignition: #2451ff;
    --apf-signal: #ff7a33;
    --apf-gauge-end: #17c994;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--apf-ink);
    max-width: 980px;
    margin: 0 auto;
}

.apf-finder * {
    box-sizing: border-box;
}

/* ---------- Header ---------- */

.apf-finder__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.apf-eyebrow {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--apf-ignition);
    background: color-mix(in srgb, var(--apf-ignition) 10%, white);
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.apf-headline {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.15;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.apf-subheadline {
    font-size: 14.5px;
    color: var(--apf-slate);
    margin: 0;
    max-width: 46ch;
}

/* ---------- Signature: fitment gauge ---------- */

.apf-gauge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid var(--apf-line);
    border-radius: 999px;
    padding: 6px 16px 6px 6px;
    flex-shrink: 0;
}

.apf-gauge__ring {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    transform: rotate(-90deg);
}

.apf-gauge__track {
    fill: none;
    stroke: var(--apf-line);
    stroke-width: 6;
}

.apf-gauge__fill {
    fill: none;
    stroke: var(--apf-ignition);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 169.6;
    stroke-dashoffset: 169.6;
    transition: stroke-dashoffset 0.35s ease, stroke 0.35s ease;
}

.apf-gauge__label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--apf-slate);
    line-height: 1.3;
}

.apf-gauge__count {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--apf-ink);
}

/* ---------- Card ---------- */

.apf-finder__card {
    position: relative;
    background: white;
    border: 1px solid var(--apf-line);
    border-radius: 18px;
    padding: 22px 24px 20px;
    box-shadow: 0 1px 2px rgba(17, 22, 43, 0.04), 0 12px 28px -16px rgba(17, 22, 43, 0.18);
    overflow: hidden;
}

.apf-finder__card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--apf-ignition), var(--apf-gauge-end));
}

.apf-finder__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.apf-finder__field label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--apf-ink);
    margin-bottom: 7px;
}

.apf-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--apf-canvas);
    color: var(--apf-ignition);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
}

.apf-finder__field.apf-field--done .apf-step-num {
    background: var(--apf-ignition);
    color: white;
}

.apf-step-optional {
    font-weight: 400;
    color: var(--apf-slate);
    font-size: 11.5px;
}

.apf-select-wrap {
    position: relative;
}

.apf-select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--apf-slate);
    border-bottom: 2px solid var(--apf-slate);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.apf-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--apf-ink);
    background: var(--apf-canvas);
    border: 1.5px solid var(--apf-line);
    border-radius: 10px;
    padding: 11px 34px 11px 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.apf-select:disabled {
    color: var(--apf-slate);
    cursor: not-allowed;
    opacity: 0.7;
}

.apf-select:not(:disabled):hover {
    border-color: var(--apf-ignition);
}

.apf-select:focus-visible {
    outline: 2px solid var(--apf-signal);
    outline-offset: 1px;
    border-color: var(--apf-signal);
}

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

.apf-finder__actions {
    display: flex;
    gap: 10px;
}

.apf-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: white;
    background: var(--apf-ignition);
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    flex: 1 1 auto;
}

.apf-search-icon {
    width: 16px;
    height: 16px;
}

.apf-search-btn:not(:disabled):hover {
    background: #1c3fd1;
}

.apf-search-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.apf-search-btn:disabled {
    background: var(--apf-line);
    color: var(--apf-slate);
    cursor: not-allowed;
}

.apf-clear-btn {
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--apf-slate);
    background: white;
    border: 1.5px solid var(--apf-line);
    border-radius: 10px;
    padding: 12px 18px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.apf-clear-btn:hover {
    border-color: var(--apf-slate);
    color: var(--apf-ink);
}

/* ---------- Results ---------- */

.apf-finder__results {
    margin-top: 22px;
}

.apf-finder__results:empty {
    margin-top: 0;
}

.apf-save-vehicle {
    margin: 0 0 16px;
    padding: 9px 18px;
    border-radius: 10px;
    border: 1.5px solid var(--apf-ignition);
    background: white;
    color: var(--apf-ignition);
    font-family: inherit;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}

.apf-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.apf-product-card {
    border: 1px solid var(--apf-line);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    background: white;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.apf-product-card:hover {
    box-shadow: 0 12px 24px -16px rgba(17, 22, 43, 0.25);
    transform: translateY(-2px);
}

.apf-product-card a {
    text-decoration: none;
    color: inherit;
}

.apf-product-card img {
    max-width: 100%;
    height: 120px;
    object-fit: contain;
}

.apf-product-card h4 {
    font-size: 13.5px;
    font-weight: 600;
    margin: 8px 0 4px;
    line-height: 1.3;
}

.apf-product-price {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--apf-ignition);
    font-size: 14px;
}

.apf-no-results,
.apf-error {
    color: var(--apf-slate);
    font-size: 14px;
    padding: 18px 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .apf-finder__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .apf-finder__steps {
        grid-template-columns: 1fr;
    }

    .apf-finder__actions {
        flex-direction: column;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .apf-gauge__fill,
    .apf-search-btn,
    .apf-product-card {
        transition: none;
    }
}
