/**
 * Quality Wheels Fitment Options
 *
 * Styling mirrors the existing tyre fitment table: bordered cells, muted
 * centred headings, dark navy values, red price, red circular cart button.
 * Every value is exposed as a custom property so the theme can retune it
 * without editing this file.
 */

.qwfo-fitment {
    --qwfo-ink: #1b2440;
    --qwfo-muted: #55607d;
    --qwfo-accent: #e8112d;
    --qwfo-border: #e2e5ec;
    --qwfo-tab-border: #cfd4e0;
    --qwfo-radius: 4px;
    --qwfo-cell-padding: 16px 18px;
    --qwfo-font: inherit;

    color: var(--qwfo-ink);
    font-family: var(--qwfo-font);
}

.qwfo-fitment *,
.qwfo-fitment *::before,
.qwfo-fitment *::after {
    box-sizing: border-box;
}

.qwfo-fitment__heading {
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--qwfo-ink);
}

/* ---------------------------------------------------------------------
 * Diameter sub-tabs (17 inch / 18 inch)
 * ------------------------------------------------------------------ */

.qwfo-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: -1px;
}

.qwfo-size {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--qwfo-radius) var(--qwfo-radius) 0 0;
    padding: 12px 22px;
    font: inherit;
    font-size: 15px;
    line-height: 1.2;
    color: var(--qwfo-muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.qwfo-size:hover {
    color: var(--qwfo-ink);
}

.qwfo-size.is-active {
    background: #fff;
    border-color: var(--qwfo-tab-border);
    border-bottom-color: #fff;
    color: var(--qwfo-ink);
    font-weight: 600;
}

.qwfo-size:focus-visible {
    outline: 2px solid var(--qwfo-accent);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Table
 * ------------------------------------------------------------------ */

.qwfo-panel {
    border-top: 1px solid var(--qwfo-border);
    padding-top: 24px;
}

.qwfo-panel[hidden] {
    display: none;
}

.qwfo-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.qwfo-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 15px;
}

.qwfo-table th,
.qwfo-table td {
    padding: var(--qwfo-cell-padding);
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.qwfo-table thead th {
    border: 0;
    border-bottom: 1px solid var(--qwfo-border);
    font-weight: 400;
    color: var(--qwfo-muted);
    background: transparent;
}

.qwfo-table tbody td {
    border: 1px solid var(--qwfo-border);
    color: var(--qwfo-ink);
}

.qwfo-table tbody tr.is-unavailable td {
    opacity: 0.55;
}

.qwfo-price {
    font-weight: 700;
    color: var(--qwfo-accent);
}

.qwfo-price del {
    font-weight: 400;
    opacity: 0.6;
    margin-right: 6px;
}

.qwfo-price ins {
    text-decoration: none;
}

.qwfo-oos {
    font-size: 13px;
    color: var(--qwfo-muted);
}

/* ---------------------------------------------------------------------
 * Cart button
 * ------------------------------------------------------------------ */

.qwfo-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--qwfo-accent);
    color: #fff;
    text-decoration: none;
    box-shadow: none;
    transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.qwfo-cart-button:hover,
.qwfo-cart-button:focus {
    background: #c60d25;
    color: #fff;
    transform: translateY(-1px);
}

.qwfo-cart-button:focus-visible {
    outline: 2px solid var(--qwfo-ink);
    outline-offset: 2px;
}

.qwfo-cart-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.qwfo-cart-button.is-loading {
    pointer-events: none;
    opacity: 0.65;
}

.qwfo-cart-button.is-added {
    background: #1f9d55;
}

/* ---------------------------------------------------------------------
 * Messages
 * ------------------------------------------------------------------ */

.qwfo-error {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: var(--qwfo-radius);
    background: #fdecee;
    color: #8f0c1e;
    font-size: 13px;
    white-space: normal;
    text-align: left;
}

.qwfo-notice {
    padding: 18px 22px;
    border-radius: var(--qwfo-radius);
    background: #fdf3e2;
    color: #6b4a12;
    font-size: 15px;
    line-height: 1.6;
}

.qwfo-notice p {
    margin: 0 0 10px;
}

.qwfo-notice p:last-child {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------------
 * Responsive: stack each row into a labelled card on small screens
 * ------------------------------------------------------------------ */

@media (max-width: 767px) {
    .qwfo-fitment__heading {
        font-size: 19px;
    }

    .qwfo-table,
    .qwfo-table tbody,
    .qwfo-table tr,
    .qwfo-table td {
        display: block;
        width: 100%;
    }

    .qwfo-table thead {
        display: none;
    }

    .qwfo-table tbody tr {
        border: 1px solid var(--qwfo-border);
        border-radius: var(--qwfo-radius);
        margin-bottom: 14px;
        padding: 4px 0;
    }

    .qwfo-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        border: 0;
        border-bottom: 1px solid var(--qwfo-border);
        padding: 12px 16px;
        text-align: right;
        white-space: normal;
    }

    .qwfo-table tbody td:last-child {
        border-bottom: 0;
    }

    .qwfo-table tbody td::before {
        content: attr(data-title);
        flex: 0 0 auto;
        font-size: 13px;
        color: var(--qwfo-muted);
        text-align: left;
    }

    .qwfo-sizes {
        gap: 6px;
        margin-bottom: 12px;
    }

    .qwfo-size {
        border-color: var(--qwfo-tab-border);
        border-radius: var(--qwfo-radius);
        padding: 10px 16px;
        font-size: 14px;
    }

    .qwfo-size.is-active {
        border-bottom-color: var(--qwfo-tab-border);
    }

    .qwfo-panel {
        border-top: 0;
        padding-top: 4px;
    }
}
