﻿:root {
    --navy: #274E76;
    --navy-mid: #34679C;
    --navy-light: #2b4d6f;
    --gold: #b8901a;
    /*--gold-light: #f5e6c0;*/
    --gold-light: #FFFFFF;
    --white: #FFFFFF;
    --silver: #7b8fa1;
    --bronze: #8c5a20;
    --blue-lr: #2563a8;
    --blue-lr-light: #dbeafe;
    --row-even: #f7f9fb;
    --row-hover: #eaf3fb;
    --border: #d6dfe8;
    --summary-bg: #e4eaf1;
    --text-primary: #0f2137;
    --text-muted: #6b7a8d;
    --radius: 8px;
    --font-display: 'Roboto', sans-serif;
    /*--font-body: 'DM Sans', sans-serif;*/
    --font-body: 'Roboto', sans-serif;
    --font-mono: 'Roboto', sans-serif;
    --font-normal: 400;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--row-even);
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-primary);
    padding-bottom: 60px;
}

/* ── Header ── */
.page-header {
    background: var(--navy);
    padding: 28px 24px 24px;
    text-align: center;
    border-bottom: 3px solid var(--gold);
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.header-eyebrow {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.25em;
    color: var(--silver);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.header-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 4vw, 42px);
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

    .header-title span {
        color: var(--gold);
    }

.header-sub {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--silver);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* ── Tabs ── */
.tabs {
    background: var(--navy-mid);
    border-bottom: 1px solid var(--navy-light);
}

.tabs-inner {
    display: flex;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 13px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}

    .tab-btn .tab-icon {
        font-size: 15px;
    }

    .tab-btn:hover {
        color: #fff;
        background: var(--gold);
    }

    .tab-btn.active {
        color: var(--white);
        border-bottom-color: var(--gold);
        background: var(--gold);
    }

    .tab-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background: transparent;
    }

/* ── View controls ── */
.view-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 1000px;
    margin: 14px auto 0;
    padding: 0 16px;
}

.view-toggle-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--navy-mid);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

    .view-toggle-btn:hover {
        border-color: var(--navy-mid);
    }

    .view-toggle-btn.active {
        background: var(--navy-mid);
        border-color: var(--navy-mid);
        color: #fff;
    }

    .view-toggle-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

/* ── Outer wrapper ── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 8px;
    max-width: 1000px;
    margin: 0 auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
    background: #fff;
}

/* ── Column headers ── */
thead tr {
    background: var(--summary-bg);
    border-bottom: 2px solid var(--border);
}

thead th {
    padding: 11px 14px;
    text-align: right;
    color: var(--navy-light);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

    thead th:first-child {
        padding-left: 20px;
        text-align: left;
        width: 35%;
    }

    thead th.col-sold {
        width: 7%;
    }

    thead th.col-agg {
        width: 14%;
        text-align: right;
    }

    thead th.col-avg {
        width: 12%;
        text-align: right;
    }

    thead th.col-median {
        width: 32%;
        text-align: right;
    }

/* ── Year rows ── */
tr.year-row {
    background: transparent;
    border-top: 2px solid var(--navy-mid);
}

    tr.year-row td {
        padding: 13px 14px;
    }

        tr.year-row td:first-child {
            padding-left: 20px;
        }

.year-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
}

.year-stat {
    color: var(--gold-light);
    font-size: 14px;
    font-weight: 400;
    text-align: center;
}

.year-price {
    color: var(--gold-light);
    font-size: 14px;
    font-weight: 400;
    font-family: var(--font-mono);
    text-align: right;
}

/* ── Country breakdown rows (Aus/NZ split, nested under a year row) ── */
tr.country-row {
    background: var(--summary-bg);
    border-top: 1px solid var(--border);
}

    tr.country-row td {
        padding: 8px 14px;
    }

.country-label {
    display: flex;
    align-items: center;
    padding-left: 36px;
}

.country-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--navy);
    background: #fff;
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
}

.country-stat {
    color: var(--navy-light);
    font-size: 12px;
    font-weight: 400;
    text-align: center;
}

.country-price {
    color: var(--navy-light);
    font-size: 12px;
    font-family: var(--font-mono);
    text-align: right;
}

/* ── Sale rows ── */
tr.sale-row {
    background: #fff;
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

    tr.sale-row:hover {
        background: var(--row-hover);
    }

    tr.sale-row.open {
        background: var(--blue-lr-light);
    }

    tr.sale-row td {
        padding: 10px 14px;
    }

.sale-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 36px;
}

.sale-name {
    color: var(--navy-mid);
    font-size: 13px;
    font-weight: 400;
}

.sale-badge {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--blue-lr);
    background: var(--blue-lr-light);
    border: 1px solid #bfdbfe;
    padding: 2px 7px;
    border-radius: 4px;
}

.sale-stat {
    color: var(--navy-light);
    font-size: 13px;
    font-weight: 400;
    text-align: center;
}

.sale-price {
    color: var(--navy-light);
    font-size: 13px;
    font-family: var(--font-mono);
    text-align: right;
}

/* ── Individual rows ── */
tr.individual-row {
    background: var(--row-even);
    border-top: 1px solid var(--border);
}

    tr.individual-row td {
        padding: 8px 14px;
    }

        tr.individual-row td:first-child {
            padding-left: 72px;
        }

.dam-name {
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 13px;
    font-style: italic;
    font-weight: 400;
}

.ind-price {
    color: var(--navy);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    text-align: right;
}

.vendor-name {
    color: var(--text-muted);
    font-size: 12px;
}

/* ── Sex tag (inline with dam name) ── */
.sex-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 400;
    font-family: var(--font-body);
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.sex-c {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.sex-f {
    background: #fce7f3;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

.sex-g {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* ── Vendor / Buyer stacked cell ── */
.vb-stack {
    text-align: right;
}

.vb-vendor {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
}

.vb-buyer {
    display: block;
    color: var(--navy-light);
    font-size: 11px;
    font-weight: 400;
    font-style: italic;
    line-height: 1.3;
    margin-top: 2px;
}

/* ── Chevron ── */
.chevron {
    display: inline-flex;
    align-items: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: var(--silver);
}

    .chevron.open {
        transform: rotate(90deg);
    }

    .chevron svg {
        width: 16px;
        height: 16px;
        fill: currentColor;
    }


/* ── Flat rows (ranked-by-price view) ── */
tr.flat-row {
    background: var(--row-even);
    border-top: 1px solid var(--border);
}

    tr.flat-row td {
        padding: 9px 14px;
    }

        tr.flat-row td:first-child {
            padding-left: 36px;
        }

.flat-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Top 50 rows ── */
tr.top50-row {
    background: #fff;
    border-top: 1px solid var(--border);
}

    tr.top50-row:nth-child(even) {
        background: var(--row-even);
    }

    tr.top50-row td {
        padding: 10px 14px;
    }

        tr.top50-row td:first-child {
            padding-left: 20px;
        }

.top50-rank {
    display: inline-block;
    min-width: 26px;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    margin-right: 6px;
}

.top50-year {
    text-align: center;
    color: var(--navy-light);
    font-size: 13px;
}

.top50-sale {
    text-align: left;
    color: var(--navy-light);
    font-size: 12px;
}

/* ── Empty state ── */
.empty-row td {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    background: #fff;
}

/* ── Footer ── */
.page-footer {
    text-align: center;
    margin-top: 32px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

    .page-footer a {
        color: var(--gold);
        text-decoration: none;
    }

/* ── Stacked price cell (used on mobile) ── */
.price-stack {
    display: none;
}

.price-stack-avg {
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    display: block;
}

.price-stack-avg-sale {
    color: var(--navy);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    display: block;
}

.price-stack-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: block;
    margin-top: 1px;
}

.price-stack-med {
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    display: block;
    margin-top: 1px;
}

.price-stack-med-sale {
    color: var(--navy);
    font-family: var(--font-mono);
    font-size: 11px;
    display: block;
    margin-top: 1px;
}

/* ── Tablet (portrait) ── */
@media (max-width: 768px) {
    thead th {
        font-size: 10px;
        padding: 10px 10px;
    }

        thead th:first-child {
            padding-left: 16px;
        }

    tr.year-row td:first-child {
        padding-left: 16px;
    }

    .tab-btn {
        padding: 12px 18px;
        font-size: 12px;
    }
}

/* ── Mobile ── */
@media (max-width: 600px) {
    /* Hide avg/median/sold cols — show stacked price/buyer cell at full remaining width */
    .col-avg, .col-median, .col-sold, .col-agg {
        display: none;
    }

    .price-stack {
        display: table-cell;
        text-align: right;
        padding-right: 12px;
    }

    thead th.price-stack {
        display: table-cell;
    }

    table {
        min-width: 0;
    }

    thead th {
        font-size: 10px;
        padding: 9px 8px;
    }

        thead th:first-child {
            padding-left: 12px;
        }

    /* Year rows */
    tr.year-row td {
        padding: 11px 8px;
    }

        tr.year-row td:first-child {
            padding-left: 12px;
        }

    .year-label {
        font-size: 13px;
        gap: 7px;
    }

    .year-stat {
        font-size: 13px;
    }

    /* Country breakdown rows */
    tr.country-row td {
        padding: 7px 8px;
    }

    .country-label {
        padding-left: 20px;
    }

    .country-badge {
        font-size: 9px;
    }

    /* Sale rows */
    tr.sale-row td {
        padding: 9px 8px;
    }

    .sale-label {
        padding-left: 20px;
        gap: 6px;
    }

    .sale-name {
        font-size: 12px;
    }

    .sale-stat {
        font-size: 12px;
    }

    /* Individual rows */
    tr.individual-row td {
        padding: 7px 8px;
    }

        tr.individual-row td:first-child {
            padding-left: 36px;
        }

    .dam-name {
        font-size: 12px;
    }

    .sex-tag {
        font-size: 9px;
    }

    .ind-price {
        font-size: 12px;
    }

    /* Tabs */
    .tab-btn {
        padding: 11px 14px;
        font-size: 11px;
    }

        .tab-btn .tab-icon {
            font-size: 14px;
        }

    /* Header */
    .page-header {
        padding: 20px 16px 18px;
    }

    .header-sub {
        font-size: 10px;
        letter-spacing: 0.12em;
    }
}

/* ── Very small phones ── */
@media (max-width: 380px) {
    .sale-badge {
        display: none;
    }

    .year-label {
        font-size: 12px;
    }

    .sex-tag {
        display: none;
    }
}