/**
 * BEIZ Wheel Fitment — minimal, modern styles.
 */

/* ============================================================
   Finder card (selectors)
   ============================================================ */

/* ============================================================
   Wrapper
   ============================================================ */

.bwf-finder {
    font-family: inherit;
    color: #181818;
}

/* ============================================================
   Trigger button — visible on the page, opens the panel
   ============================================================ */

.bwf-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    padding: 14px;
    background: rgba(238, 210, 2, 0.10);
    border: 1px solid #eed202;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: #181818;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.bwf-trigger:hover {
    border-color: #fe6012;
}
.bwf-trigger:focus-visible {
    outline: none;
    border-color: #fe6012;
    box-shadow: 0 0 0 3px rgba(254, 96, 18, 0.18);
}
.bwf-trigger:active { transform: scale(0.995); }

.bwf-trigger-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(238, 210, 2, 0.30);
    color: #181818;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Selected vehicle — switch the icon to a green "confirmed" state. */
.bwf-trigger.is-selected {
    background: #f2f7f3;
    border-color: #abcbad;
}
.bwf-trigger.is-selected:hover {
    border-color: #abcbad; /* keep green border on hover when selected */
}
.bwf-trigger.is-selected .bwf-trigger-icon {
    background: #4cb74426;
    color: #38aa30;
}

.bwf-trigger-text {
    flex: 1 1 auto;
    min-width: 0;
}
.bwf-trigger-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #181818;
    line-height: 1.3;
}
.bwf-trigger-vehicle {
    display: block;
    font-size: 14px;
    color: #626262;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Trigger arrow — visually a small ghost-icon button (matches the X reset
   on the size pill). It's a span (not actually clickable on its own — the
   whole trigger button handles the click), so hover effects are driven by
   the parent .bwf-trigger:hover rule. */
.bwf-trigger-arrow {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #9ca3af;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.bwf-trigger:hover .bwf-trigger-arrow {
    background: #18181814;
    color: #181818;
}

/* ============================================================
   Selected size pill — same layout, padding and typography as
   the trigger above, painted in the green "selected" theme.
   Acts as a status row plus a one-click reset.
   ============================================================ */
.bwf-current-size {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    padding: 14px;
    background: #f2f7f3;
    border: 1px solid #abcbad;
    border-radius: 12px;
    text-align: left;
    font-family: inherit;
    color: #181818;
}
.bwf-current-size[hidden] { display: none; }
.bwf-current-size-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #4cb74426;
    color: #38aa30;
}
.bwf-current-size-text {
    flex: 1 1 auto;
    min-width: 0;
}
.bwf-current-size-caption {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #181818;
    line-height: 1.3;
}
.bwf-current-size-label {
    display: block;
    margin-top: 2px;
    font-size: 15px;
    color: #626262;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bwf-current-size-reset {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #9ca3af;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.bwf-current-size-reset:hover {
    background: #18181814;
    color: #181818;
}
.bwf-current-size-reset:focus-visible {
    outline: none;
    background: #18181814;
    box-shadow: 0 0 0 3px rgba(254, 96, 18, 0.18);
}
/* Chevron arrow on the pill — only shown in the yellow "pick a size" state. */
.bwf-current-size-arrow {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* ----- Warning state — user changed PCD/ET/etc., size is no longer valid
   for the car they had selected, so prompt them to pick a new one. Whole
   pill is clickable; X reset is hidden and replaced by a chevron. ----- */
.bwf-current-size.is-warning {
    background: rgba(238, 210, 2, 0.10);
    border-color: #eed202;
    cursor: pointer;
}
.bwf-current-size.is-warning .bwf-current-size-icon {
    background: rgba(238, 210, 2, 0.30);
    color: #181818;
}
.bwf-current-size.is-warning .bwf-current-size-label { display: none; }
.bwf-current-size.is-warning .bwf-current-size-reset { display: none; }
.bwf-current-size.is-warning .bwf-current-size-arrow { display: flex; }
.bwf-current-size.is-warning:hover .bwf-current-size-arrow {
    background: #18181814;
    color: #181818;
}

/* ============================================================
   Off-canvas panel + overlay
   ============================================================ */

.bwf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 99999;
}
.bwf-overlay[hidden] { display: block; } /* override default to keep transitions */
.bwf-finder.is-open .bwf-overlay {
    opacity: 1;
    pointer-events: auto;
}

.bwf-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
}
.bwf-panel[hidden] { display: flex; } /* override default for transitions */
.bwf-finder.is-open .bwf-panel {
    transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
    .bwf-overlay, .bwf-panel { transition: none !important; }
}

/* When panel is open, lock background scroll */
body.bwf-scroll-lock {
    overflow: hidden;
}

.bwf-panel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #18181821;
}
.bwf-panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #181818;
}
.bwf-panel-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fe6012;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.15s ease;
}
.bwf-panel-close:hover { background: #d94f0a; color: #ffffff; }
.bwf-panel-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(254, 96, 18, 0.30);
}

.bwf-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

/* ============================================================
   Form fields inside the panel
   ============================================================ */

.bwf-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.bwf-finder select {
    width: 100%;
    height: 48px;
    padding: 0 40px 0 14px;
    border: 1px solid #18181821;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%236b7280' d='M6 8.5L1.5 4h9z'/></svg>") no-repeat right 14px center;
    background-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-size: 15px;
    font-weight: 500;
    color: #181818;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bwf-finder select:hover:not(:disabled) { border-color: #d1d5db; }
.bwf-finder select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.bwf-finder select:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.bwf-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.bwf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    line-height: 1;
}
.bwf-btn-primary {
    background: #fe6012;
    color: #fff;
    border-color: #fe6012;
    flex: 1 1 auto;
}
.bwf-btn-primary:hover:not(:disabled) {
    background: #e5530a;
    border-color: #e5530a;
}
.bwf-btn-primary:disabled {
    background: #18181821;
    color: #9ca3af;
    border-color: #18181821;
    cursor: not-allowed;
}
.bwf-btn-secondary {
    background: #fff;
    color: #181818;
    border-color: #18181821;
}
.bwf-btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.bwf-status {
    margin-top: 14px;
    min-height: 1px;
    font-size: 13px;
}
.bwf-status:empty { margin-top: 0; }
.bwf-info  { color: #4b5563; }
.bwf-error { color: #dc2626; }

/* ============================================================
   Sizes list — card grid
   ============================================================ */

.bwf-sizes:empty { display: none; }

.bwf-sizes-list {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #18181821;
}

.bwf-sizes-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: #181818;
}

.bwf-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

/* Card */
.bwf-card {
    display: flex;
    flex-direction: column;
    background: #ecebe166;
    border: 1px solid #ecebe166;
    border-radius: 10px;
    padding: 16px 18px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.bwf-card:hover {
    /* No border / shadow change on hover */
}

/* Top: diameter + tags */
.bwf-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.bwf-card-diameter {
    font-size: 24px;
    font-weight: 700;
    color: #181818;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.bwf-card-diameter span {
    font-size: 18px;
    color: #9ca3af;
    margin-left: 1px;
    font-weight: 600;
}

.bwf-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.bwf-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.bwf-tag-stock {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}
.bwf-tag-stagger {
    background: #ffffff;
    color: #626262;
    border-color: #18181821;
}

/* Body: axles */
.bwf-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}
.bwf-card-axle {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    line-height: 1.4;
}
.bwf-card-axle-label {
    flex: 0 0 44px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #626262;
}
.bwf-card-axle-value {
    color: #181818;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}
.bwf-card-axle-single .bwf-card-axle-value {
    font-size: 14px;
}

/* Bottom: meta + CTA */
.bwf-card-bottom {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e2e2e2;
}
.bwf-card-meta {
    font-size: 14px;
    font-weight: 500;
    color: #626262;
    font-variant-numeric: tabular-nums;
}

.bwf-find-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 38px;
    padding: 0 16px;
    background: transparent;
    color: #fe6012 !important;
    border: 1px solid #fe6012;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.bwf-find-btn:hover {
    background: #fe6012;
    color: #fff !important;
}

/* Empty state */
.bwf-empty {
    margin: 14px 0 0;
    padding: 20px;
    background: #f9fafb;
    border: 1px solid #18181821;
    border-radius: 8px;
    color: #6b7280;
    text-align: center;
    font-size: 14px;
}

/* ===== Axle labels (Front / Rear) on product cards in catalog ===== */
.bwf-axle-label {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}
.bwf-axle-front { background: #2563eb; } /* blue  — front */
.bwf-axle-rear  { background: #059669; } /* green — rear  */

/* ============================================================
   Full-screen loader (shown after clicking "Find wheels")
   ============================================================ */

.bwf-loader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.bwf-loader[hidden] { display: none; }

.bwf-loader-inner {
    text-align: center;
}
.bwf-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border: 4px solid #18181821;
    border-top-color: #fe6012;
    border-radius: 50%;
    animation: bwf-spin 0.8s linear infinite;
}
@keyframes bwf-spin {
    to { transform: rotate(360deg); }
}
.bwf-loader-text {
    margin: 0;
    color: #181818;
    font-size: 16px;
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    .bwf-spinner { animation-duration: 1.6s; }
}
