/**
 * Maxxis Tyre Size Filter — Frontend Styles
 * Version: 1.0.3
 * Matches reference screenshot — light card, tab underline style, grey column headers
 */

/* ===========================
   WIDGET WRAPPER
   =========================== */

div.maxxis-tsf-widget {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    color: #1a1a1a;
    box-sizing: border-box;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    overflow: hidden;
}

div.maxxis-tsf-widget *,
div.maxxis-tsf-widget *::before,
div.maxxis-tsf-widget *::after {
    box-sizing: border-box;
}

/* ===========================
   RIM SIZE TABS
   =========================== */

div.maxxis-tsf-widget .maxxis-tsf-rim-tabs {
    padding: 1.25rem 1.5rem 0;
    border-bottom: 2px solid #e8e8e8;
}

div.maxxis-tsf-widget .maxxis-tsf-tabs-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #999;
    margin-bottom: 0.75rem;
}

div.maxxis-tsf-widget .maxxis-tsf-tabs-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
}

div.maxxis-tsf-widget .maxxis-tsf-tab {
    flex: 1 1 0;
    min-width: 60px;
    text-align: center;
    padding: 0.65rem 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.2;
    display: block;
    text-decoration: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    bottom: -2px;
}

div.maxxis-tsf-widget .maxxis-tsf-tab:hover {
    color: #FF5400;
    background: transparent;
}

div.maxxis-tsf-widget .maxxis-tsf-tab.active {
    color: #FF5400 !important;
    font-weight: 700;
    border-bottom: 3px solid #FF5400;
    background: transparent;
}

/* ===========================
   BODY AREA
   =========================== */

div.maxxis-tsf-widget .maxxis-tsf-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

/* Rim label + size filter row */
div.maxxis-tsf-widget .maxxis-tsf-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

div.maxxis-tsf-widget .results-rim-label {
    font-size: 1.6rem;
    font-weight: 900;
    color: #FF5400;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Size filter dropdown */
div.maxxis-tsf-widget .maxxis-tsf-size-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

div.maxxis-tsf-widget .maxxis-tsf-size-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
    white-space: nowrap;
}

div.maxxis-tsf-widget .maxxis-tsf-size-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 8px 5px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    cursor: pointer;
    transition: border-color 0.15s ease;
    min-width: 130px;
}

div.maxxis-tsf-widget .maxxis-tsf-size-select:hover {
    border-color: #FF5400;
}

div.maxxis-tsf-widget .maxxis-tsf-size-select:focus {
    outline: none;
    border-color: #FF5400;
    box-shadow: 0 0 0 3px rgba(255, 84, 0, 0.1);
}

/* ===========================
   TABLE
   =========================== */

div.maxxis-tsf-widget .maxxis-tsf-table-wrap {
    overflow-x: auto;
    background: #fff;
}

div.maxxis-tsf-widget table.maxxis-tsf-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.9rem;
    background: #fff;
    margin: 0;
    padding: 0;
}

/* Fixed column widths */
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-img    { width: 90px;  }
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-series { width: 160px; }
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-part   { width: 185px; }
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-size   { width: 160px; }
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-ply    { width: 90px;  }
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-type   { width: 110px; }
div.maxxis-tsf-widget table.maxxis-tsf-table col.col-price  { width: 120px; }

/* Column headers — grey, small caps, no background */
div.maxxis-tsf-widget table.maxxis-tsf-table thead tr {
    background: transparent !important;
    border-bottom: 1px solid #e8e8e8;
}

div.maxxis-tsf-widget table.maxxis-tsf-table thead th {
    padding: 0.5rem 1rem;
    color: #aaa !important;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: left;
    white-space: nowrap;
    border: none;
    background: transparent !important;
    line-height: 1.2;
}

div.maxxis-tsf-widget table.maxxis-tsf-table thead th.col-price {
    text-align: right;
}

div.maxxis-tsf-widget table.maxxis-tsf-table thead th.col-img {
    text-align: center;
}

/* Body rows */
div.maxxis-tsf-widget table.maxxis-tsf-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s ease;
    background: #fff;
}

div.maxxis-tsf-widget table.maxxis-tsf-table tbody tr:last-child {
    border-bottom: none;
}

div.maxxis-tsf-widget table.maxxis-tsf-table tbody tr:hover {
    background: #fffaf8 !important;
}

div.maxxis-tsf-widget table.maxxis-tsf-table td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    color: #222;
    border: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===========================
   COLUMN STYLES
   =========================== */

div.maxxis-tsf-widget table.maxxis-tsf-table td.col-img {
    text-align: center;
    padding: 0.5rem;
}

div.maxxis-tsf-widget table.maxxis-tsf-table td.col-img img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Series — bold */
div.maxxis-tsf-widget table.maxxis-tsf-table td.col-series {
    font-weight: 700;
    color: #111;
}

/* Part # — plain text, monospace feel */
div.maxxis-tsf-widget table.maxxis-tsf-table td.col-part {
    white-space: nowrap;
}

div.maxxis-tsf-widget .maxxis-tsf-part {
    font-size: 0.88rem;
    font-weight: 400;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Size */
div.maxxis-tsf-widget table.maxxis-tsf-table td.col-size {
    color: #333;
}

/* Ply */
div.maxxis-tsf-widget table.maxxis-tsf-table td.col-ply {
    white-space: nowrap;
    color: #333;
}

/* Type badges — outlined pill */
div.maxxis-tsf-widget table.maxxis-tsf-table td.col-type {
    white-space: nowrap;
}

div.maxxis-tsf-widget .maxxis-tsf-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

div.maxxis-tsf-widget .maxxis-tsf-badge.badge-RADIAL {
    background: transparent;
    color: #CC4400;
    border: 1.5px solid #FF7733;
}

div.maxxis-tsf-widget .maxxis-tsf-badge.badge-BIAS {
    background: transparent;
    color: #555;
    border: 1.5px solid #bbb;
}

/* Price — black bold, right-aligned */
div.maxxis-tsf-widget table.maxxis-tsf-table td.col-price {
    text-align: right;
    white-space: nowrap;
}

div.maxxis-tsf-widget .maxxis-tsf-price {
    font-size: 1rem;
    font-weight: 700;
    color: #111 !important;
}

/* ===========================
   LOADING STATE
   =========================== */

div.maxxis-tsf-widget .maxxis-tsf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1rem;
    color: #aaa;
    font-size: 0.9rem;
}

div.maxxis-tsf-widget .maxxis-tsf-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #eee;
    border-top-color: #FF5400;
    border-radius: 50%;
    animation: maxxis-tsf-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes maxxis-tsf-spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   EMPTY / NOTICE
   =========================== */

div.maxxis-tsf-widget .maxxis-tsf-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: #aaa;
    font-size: 0.9rem;
}

div.maxxis-tsf-widget .maxxis-tsf-notice {
    margin: 1.5rem;
    background: #fff8e1;
    border: 1px solid #ffd600;
    border-left: 4px solid #ffa000;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: #555;
}

div.maxxis-tsf-widget .maxxis-tsf-notice code {
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 3px;
}


/* ===========================
   OFFROAD — FRONT / REAR SIDE BY SIDE
   =========================== */

/* Two-column split wrapper */
div.maxxis-tsf-widget .maxxis-tsf-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    padding: 0.5rem;
    align-items: start;
}

/* Stack vertically on mobile + remove padding */
@media (max-width: 640px) {
    div.maxxis-tsf-widget .maxxis-tsf-split {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0;
    }

    div.maxxis-tsf-widget .maxxis-tsf-pos-panel .maxxis-tsf-cards {
        padding-left: 0;
        padding-right: 0;
    }

    div.maxxis-tsf-widget .maxxis-tsf-body {
        padding: 0.9rem 1rem 1.25rem;
    }

    div.maxxis-tsf-widget .maxxis-tsf-rim-tabs {
        padding: 0.9rem 1rem 0;
    }
}

/* Panel heading */
div.maxxis-tsf-widget .maxxis-tsf-panel-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

div.maxxis-tsf-widget .maxxis-tsf-panel-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #999;
}

div.maxxis-tsf-widget .maxxis-tsf-panel-title.front {
    color: #FF5400;
}

div.maxxis-tsf-widget .maxxis-tsf-panel-title.rear {
    color: #FF5400;
}

/* Filters row — 2-column grid below the title */
div.maxxis-tsf-widget .maxxis-tsf-panel-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    width: 100%;
}

/* Rim size + tyre size filters inside panel */
div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-size-filter,
div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-tyresize-filter {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    width: 100%;
}

div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-size-select,
div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-tyresize-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 8px 5px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    padding: 0.35rem 1.5rem 0.35rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    cursor: pointer;
    transition: border-color 0.15s ease;
    min-width: 0;
    width: 100%;
}

div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-size-select:hover,
div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-tyresize-select:hover {
    border-color: #FF5400;
}

div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-size-select:focus,
div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-tyresize-select:focus {
    outline: none;
    border-color: #FF5400;
    box-shadow: 0 0 0 3px rgba(255, 84, 0, 0.1);
}



/* ===========================
   OFFROAD CARDS — all screen sizes
   =========================== */

div.maxxis-tsf-widget .maxxis-tsf-pos-panel .maxxis-tsf-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

div.maxxis-tsf-widget .maxxis-tsf-card--offroad {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.8rem;
    row-gap: 0.3rem;
    transition: box-shadow 0.15s ease;
}

div.maxxis-tsf-widget .maxxis-tsf-card--offroad:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* Image — spans both rows */
div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-img {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-img img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* Top row: Series (orange) + Size inline */
div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-top {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}

div.maxxis-tsf-widget .card-series--orange {
    font-weight: 700;
    font-size: 0.9rem;
    color: #FF5400 !important;
    white-space: nowrap;
}

div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-size {
    font-size: 0.82rem;
    color: #666;
    white-space: nowrap;
}

/* Bottom row: Part # (left) + Price (right) */
div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-bottom {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-part {
    font-size: 0.74rem;
    color: #aaa;
    font-weight: 500;
}

div.maxxis-tsf-widget .maxxis-tsf-card--offroad .card-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
}

/* Empty panel */
div.maxxis-tsf-widget .maxxis-tsf-panel .maxxis-tsf-empty {
    padding: 2rem 0;
    font-size: 0.88rem;
}

/* ===========================
   RESPONSIVE — TABLET
   =========================== */

@media (max-width: 900px) {
    div.maxxis-tsf-widget table.maxxis-tsf-table {
        font-size: 0.85rem;
    }
    div.maxxis-tsf-widget table.maxxis-tsf-table td,
    div.maxxis-tsf-widget table.maxxis-tsf-table th {
        padding: 0.6rem 0.75rem;
    }
}

/* ===========================
   RESPONSIVE — MOBILE CARD LAYOUT
   =========================== */

@media (max-width: 640px) {

    /* Rim tabs — smaller text */
    div.maxxis-tsf-widget .maxxis-tsf-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.4rem;
    }

    /* Results header stacks on mobile */
    div.maxxis-tsf-widget .maxxis-tsf-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    div.maxxis-tsf-widget .maxxis-tsf-size-select {
        min-width: 100%;
        width: 100%;
    }

    div.maxxis-tsf-widget .maxxis-tsf-size-filter {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    /* Hide the table entirely on mobile */
    div.maxxis-tsf-widget .maxxis-tsf-table-wrap {
        border: none;
        background: transparent;
    }

    div.maxxis-tsf-widget table.maxxis-tsf-table {
        display: none !important;
    }

    /* Show the card list instead */
    div.maxxis-tsf-widget .maxxis-tsf-cards {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Individual tyre card */
    div.maxxis-tsf-widget .maxxis-tsf-card {
        background: #fff;
        border: 1px solid #e8e8e8;
        border-radius: 12px;
        padding: 0.9rem 1rem;
        display: grid;
        grid-template-columns: 72px 1fr;
        grid-template-rows: auto auto auto;
        column-gap: 0.85rem;
        row-gap: 0;
    }

    /* Image — spans full height on left */
    div.maxxis-tsf-widget .maxxis-tsf-card .card-img {
        grid-column: 1;
        grid-row: 1 / 4;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    div.maxxis-tsf-widget .maxxis-tsf-card .card-img img {
        width: 64px;
        height: 64px;
        object-fit: contain;
    }

    /* Top row: Series + Price */
    div.maxxis-tsf-widget .maxxis-tsf-card .card-top {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin-bottom: 0.2rem;
    }

    div.maxxis-tsf-widget .maxxis-tsf-card .card-series {
        font-weight: 700;
        font-size: 0.95rem;
        color: #111;
    }

    div.maxxis-tsf-widget .maxxis-tsf-card .card-price {
        font-size: 1rem;
        font-weight: 700;
        color: #111;
        white-space: nowrap;
    }

    /* Middle row: Size */
    div.maxxis-tsf-widget .maxxis-tsf-card .card-size {
        grid-column: 2;
        grid-row: 2;
        font-size: 0.85rem;
        color: #555;
        margin-bottom: 0.35rem;
    }

    /* Bottom row: Part # + Ply + Badge */
    div.maxxis-tsf-widget .maxxis-tsf-card .card-meta {
        grid-column: 2;
        grid-row: 3;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    div.maxxis-tsf-widget .maxxis-tsf-card .card-part {
        font-size: 0.75rem;
        color: #888;
        font-weight: 500;
    }

    div.maxxis-tsf-widget .maxxis-tsf-card .card-dot {
        color: #ccc;
        font-size: 0.7rem;
    }

    div.maxxis-tsf-widget .maxxis-tsf-card .card-ply {
        font-size: 0.75rem;
        color: #888;
    }
}

/* Desktop: hide card list, show table */
/* Desktop: hide ATV/Road cards (table shows instead), but NOT offroad panel cards */
@media (min-width: 641px) {
    div.maxxis-tsf-widget:not([data-layout="split"]) .maxxis-tsf-cards {
        display: none !important;
    }
}


