/* ── SCCA Road Racing Media Guide — Frontend Styles v2.1 ─────────────────
   Design tokens matched to scca.trellist-dev.com:
   Font:   "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui
   Red:    #DA291C  (rgb 218,41,28)
   Navy:   #243642  (rgb 36,54,66)
   Amber:  #F79520  (rgb 247,149,32)
   Dark:   #212121
   ──────────────────────────────────────────────────────────────────────── */

.scca-rrmg {
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    color: #212121;
    width: 100%;
}
.scca-rrmg *,
.scca-rrmg *::before,
.scca-rrmg *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Floating page nav ──────────────────────────────────────────────────── */
.scca-rrmg-nav {
    position: fixed;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    z-index: 200;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #DA291C;
    border-radius: 0 4px 4px 0;
    padding: 0.75rem 0.85rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    min-width: 170px;
    max-width: 210px;
}
.scca-rrmg-nav__label {
    font-size: 0.6rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #DA291C;
    margin-bottom: 0.5rem;
}
.scca-rrmg-nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.scca-rrmg-nav__item { border-bottom: 1px solid #f0f0f0; }
.scca-rrmg-nav__item:last-child { border-bottom: none; }
.scca-rrmg-nav__link {
    display: block;
    padding: 0.32rem 0;
    font-size: 0.76rem;
    font-weight: 600;
    color: #444;
    text-decoration: none;
    transition: color 0.15s;
    line-height: 1.3;
}
.scca-rrmg-nav__link:hover { color: #DA291C; }
.scca-rrmg-nav__link--active { color: #DA291C; }
.scca-rrmg-nav__divider {
    font-size: 0.58rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #F79520;
    padding: 0.5rem 0 0.2rem;
    margin-top: 0.25rem;
    border-top: 1px solid #e8e8e8;
}

@media (max-width: 1100px) {
    .scca-rrmg-nav { display: none; }
}

/* ── Dataset tab bar — pill style matching SCCA site ────────────────────── */
.scca-rrmg__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: #fff;
    border-radius: 99px;
    border: 1px solid #e0e0e0;
    padding: 4px;
    margin-bottom: 1.25rem;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.scca-rrmg__tab {
    padding: 0.5rem 1.1rem;
    background: transparent;
    border: none;
    color: #212121;
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 99px;
    transition: color 0.15s;
    white-space: nowrap;
    line-height: 1.2;
}
.scca-rrmg__tab:hover { color: #1E3465; }
.scca-rrmg__tab--active {
    background-image: linear-gradient(270deg, rgb(174,199,255) 0%, rgb(30,52,101) 100%);
    color: #fff;
}

/* ── Unified driver search ──────────────────────────────────────────────── */
.scca-rrmg__driver-search {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-top: none;
    padding: 1.25rem 1.25rem 1rem;
}
.scca-rrmg__driver-search-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #243642;
    margin-bottom: 0.4rem;
}
.scca-rrmg__driver-search-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.scca-rrmg__driver-input-wrap {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.scca-rrmg__driver-input-wrap svg {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: #888;
    pointer-events: none;
}
.scca-rrmg__driver-input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.1rem;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    font-size: 0.95rem;
    color: #212121;
    background: #fff;
    transition: border-color 0.15s;
    height: 40px;
}
.scca-rrmg__driver-input:focus {
    outline: none;
    border-color: #DA291C;
    box-shadow: 0 0 0 3px rgba(218,41,28,0.1);
}
.scca-rrmg__driver-clear {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.25rem;
    line-height: 1;
    display: none;
}
.scca-rrmg__driver-clear--visible { display: inline; }

/* Driver results card */
.scca-rrmg__driver-results {
    margin-top: 0.75rem;
    display: none;
}
.scca-rrmg__driver-results--visible { display: block; }
.scca-rrmg__driver-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #DA291C;
    border-radius: 0 4px 4px 0;
    overflow: hidden;
}
.scca-rrmg__driver-card-header {
    background: #243642;
    color: #fff;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}
.scca-rrmg__driver-name {
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: 0.03em;
}
.scca-rrmg__driver-stat-count {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.04em;
}
.scca-rrmg__driver-sections {
    padding: 0.75rem 1rem;
    display: grid;
    gap: 0.75rem;
}
.scca-rrmg__driver-section-title {
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #F79520;
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #f0f0f0;
}
.scca-rrmg__driver-entries {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.scca-rrmg__driver-entry {
    display: flex;
    gap: 0.75rem;
    font-size: 0.82rem;
    line-height: 1.4;
    padding: 0.2rem 0;
    border-bottom: 1px solid #f5f5f5;
}
.scca-rrmg__driver-entry:last-child { border-bottom: none; }
.scca-rrmg__driver-entry-year {
    font-weight: 750;
    color: #243642;
    min-width: 36px;
    flex-shrink: 0;
}
.scca-rrmg__driver-entry-class {
    color: #444;
    flex: 1;
}
.scca-rrmg__driver-entry-note {
    color: #888;
    font-size: 0.76rem;
    font-style: italic;
}
.scca-rrmg__driver-entry--record {
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
}
.scca-rrmg__driver-entry--record .scca-rrmg__driver-entry-class { flex: 1 1 55%; }
.scca-rrmg__driver-no-results {
    padding: 0.75rem 1rem;
    color: #888;
    font-size: 0.88rem;
    font-style: italic;
}

/* ── Dataset filters (below driver search) ──────────────────────────────── */
.scca-rrmg__filters {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    padding: 0.9rem 1.25rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.scca-rrmg__filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: flex-end;
}
.scca-rrmg__filter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.scca-rrmg__filter--grow { flex: 1 1 180px; }
.scca-rrmg__filter--year { flex: 0 0 auto; }
.scca-rrmg__filter--view { flex: 0 0 auto; margin-left: auto; }
.scca-rrmg__filter label {
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #555;
}
.scca-rrmg__filter select,
.scca-rrmg__filter input[type="number"],
.scca-rrmg__filter input[type="search"] {
    border: 1.5px solid #ddd;
    border-radius: 4px;
    padding: 0.42rem 0.6rem;
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    font-size: 0.88rem;
    color: #212121;
    background: #fff;
    height: 36px;
    transition: border-color 0.15s;
}
.scca-rrmg__filter select:focus,
.scca-rrmg__filter input:focus {
    outline: none;
    border-color: #DA291C;
    box-shadow: 0 0 0 3px rgba(218,41,28,0.1);
}
.scca-rrmg__filter select { min-width: 155px; cursor: pointer; }
.scca-rrmg__filter input[type="number"] { width: 74px; text-align: center; }
.scca-rrmg__year-row { display: flex; align-items: center; gap: 0.3rem; }
.scca-rrmg__year-row span { color: #888; font-size: 0.85rem; }

/* View toggle */
.scca-rrmg__view-toggle {
    display: flex;
    border: 1.5px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}
.scca-rrmg__view-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.38rem 0.75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    color: #666;
    transition: background 0.15s, color 0.15s;
}
.scca-rrmg__view-btn svg { width: 13px; height: 13px; }
.scca-rrmg__view-btn + .scca-rrmg__view-btn { border-left: 1.5px solid #ddd; }
.scca-rrmg__view-btn--active { background: #243642; color: #fff; }
.scca-rrmg__view-btn:not(.scca-rrmg__view-btn--active):hover { background: #f5f5f5; }

/* Filter meta row */
.scca-rrmg__filter-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}
.scca-rrmg__count { font-size: 0.78rem; color: #666; }
.scca-rrmg__reset {
    font-size: 0.75rem;
    font-weight: 750;
    color: #DA291C;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.03em;
    text-decoration: underline;
}

/* ── Table view ─────────────────────────────────────────────────────────── */
.scca-rrmg__view { display: none; }
.scca-rrmg__view--active { display: block; }

.scca-rrmg__table-wrap {
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
}
.scca-rrmg__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}
.scca-rrmg__table thead tr { background: #243642; }
.scca-rrmg__table th {
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    user-select: none;
}
.scca-rrmg__table thead tr th:first-child { border-radius: 25px 0 0 0; }
.scca-rrmg__table thead tr th:last-child  { border-radius: 0 25px 0 0; }
.scca-rrmg__table th.sortable { cursor: pointer; }
.scca-rrmg__table th.sortable:hover { background: #1a2830; }
.scca-rrmg__table th.sort-asc .sort-icon::after  { content: ' \2191'; }
.scca-rrmg__table th.sort-desc .sort-icon::after { content: ' \2193'; }
.scca-rrmg__table th .sort-icon { opacity: 0.5; font-size: 0.7rem; }
.scca-rrmg__table tbody tr {
    border-bottom: 1px solid #eeeeee;
    transition: background 0.1s;
}
.scca-rrmg__table tbody tr:last-child td:first-child { border-radius: 0 0 0 25px; }
.scca-rrmg__table tbody tr:last-child td:last-child  { border-radius: 0 0 25px 0; }
.scca-rrmg__table tbody tr:nth-child(even) { background: #fafafa; }
.scca-rrmg__table tbody tr:hover { background: #fff5f5; }
.scca-rrmg__table td {
    padding: 0.52rem 0.9rem;
    vertical-align: middle;
}

/* Status badge */
.scca-rrmg__badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.scca-rrmg__badge--active   { background: #e8f5e9; color: #1b5e20; }
.scca-rrmg__badge--inactive { background: #eeeeee; color: #666; }

/* Search highlight */
.scca-rrmg__hl {
    background: #FFF3CD;
    border-radius: 2px;
    padding: 0 1px;
}

/* ── By-class accordion ─────────────────────────────────────────────────── */
.scca-rrmg__panels {
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    overflow: hidden;
}
.scca-rrmg__panel { border-bottom: 1px solid #eeeeee; }
.scca-rrmg__panel:last-child { border-bottom: none; }
.scca-rrmg__panel-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: #fff;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    gap: 0.5rem;
    transition: background 0.15s;
}
.scca-rrmg__panel-btn:hover { background: #fafafa; }
.scca-rrmg__panel--open .scca-rrmg__panel-btn { background: #f5f5f5; }
.scca-rrmg__panel-left { display: flex; align-items: center; gap: 0.6rem; }
.scca-rrmg__panel-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.scca-rrmg__panel-dot--active   { background: #27ae60; }
.scca-rrmg__panel-dot--inactive { background: #bbb; }
.scca-rrmg__panel-name {
    font-size: 0.9rem;
    font-weight: 750;
    color: #212121;
}
.scca-rrmg__panel-meta {
    font-size: 0.75rem;
    color: #888;
}
.scca-rrmg__panel-chevron {
    width: 16px; height: 16px;
    color: #888;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.scca-rrmg__panel--open .scca-rrmg__panel-chevron { transform: rotate(180deg); }
.scca-rrmg__panel-body { display: none; border-top: 1px solid #eeeeee; }
.scca-rrmg__panel--open .scca-rrmg__panel-body { display: block; }
.scca-rrmg__panel-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.scca-rrmg__panel-table th {
    background: #f0f0f0;
    padding: 0.38rem 0.85rem;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    border-bottom: 1px solid #e0e0e0;
}
.scca-rrmg__panel-table td {
    padding: 0.45rem 0.85rem;
    border-bottom: 1px solid #eeeeee;
}
.scca-rrmg__panel-table tr:last-child td { border-bottom: none; }
.scca-rrmg__panel-table tr:nth-child(even) td { background: #fafafa; }
.scca-rrmg__panel-table tr:hover td { background: #fff5f5; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.scca-rrmg__empty {
    padding: 2.5rem;
    text-align: center;
    border: 1px solid #e0e0e0;
    border-top: none;
    background: #fff;
    color: #888;
    font-size: 0.9rem;
}
.scca-rrmg__empty-link {
    background: none;
    border: none;
    color: #DA291C;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    font-size: inherit;
}

/* ── Records page ───────────────────────────────────────────────────────── */
.scca-rrmg-records { font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui; }
.scca-rrmg-records__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 2rem;
    padding: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 99px;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.scca-rrmg-records__nav-link {
    display: inline-block;
    padding: 0.42rem 1rem;
    background: transparent;
    border: none;
    border-radius: 99px;
    text-decoration: none;
    color: #212121;
    font-family: "Avenir LT Pro", "Segoe UI", Roboto, Arial, system-ui;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.15s;
    white-space: nowrap;
}
.scca-rrmg-records__nav-link:hover { color: #1E3465; }
.scca-rrmg-records__nav-link--active {
    background-image: linear-gradient(270deg, rgb(174,199,255) 0%, rgb(30,52,101) 100%);
    color: #fff;
}
.scca-rrmg-records__section { margin-bottom: 2.5rem; scroll-margin-top: 80px; }
.scca-rrmg-records__title {
    font-size: 1.25rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #DA291C;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #e0e0e0;
}
.scca-rrmg-records__intro {
    color: #666;
    font-size: 0.88rem;
    margin-bottom: 1rem;
    font-style: italic;
}
.scca-rrmg-records__content { font-size: 0.9rem; line-height: 1.75; }
.scca-rrmg-records__subhead {
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #F79520;
    margin: 1.25rem 0 0.3rem;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.2rem;
}
.scca-rrmg-records__list p { margin: 0.15rem 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    /* Tabs: allow wrapping but keep pill container intact */
    .scca-rrmg__tabs { border-radius: 12px; width: 100%; justify-content: stretch; }
    .scca-rrmg__tab { font-size: 0.7rem; padding: 0.45rem 0.7rem; flex: 1; text-align: center; }

    /* Filters: stack vertically, left-aligned, full width */
    .scca-rrmg__filters { position: static; padding: 0.75rem; }
    .scca-rrmg__filters-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }
    .scca-rrmg__filter { width: 100%; }
    .scca-rrmg__filter--grow { flex: none; width: 100%; }
    .scca-rrmg__filter--year { flex: none; width: 100%; }
    .scca-rrmg__filter--view { margin-left: 0; width: 100%; }
    .scca-rrmg__filter select,
    .scca-rrmg__filter input[type="search"] { width: 100%; min-width: 0; }
    .scca-rrmg__view-toggle { width: 100%; }
    .scca-rrmg__view-btn { flex: 1; justify-content: center; }
    .scca-rrmg__year-row input[type="number"] { width: 80px; }

    /* Table */
    .scca-rrmg__table-wrap { border-radius: 14px; }
    .scca-rrmg__table thead tr th:first-child { border-radius: 14px 0 0 0; }
    .scca-rrmg__table thead tr th:last-child  { border-radius: 0 14px 0 0; }
    .scca-rrmg__table tbody tr:last-child td:first-child { border-radius: 0 0 0 14px; }
    .scca-rrmg__table tbody tr:last-child td:last-child  { border-radius: 0 0 14px 0; }
    .scca-rrmg__table th,
    .scca-rrmg__table td { padding: 0.42rem 0.55rem; }

    /* Driver search */
    .scca-rrmg__driver-search-row { flex-wrap: wrap; }
    .scca-rrmg__driver-input-wrap { max-width: 100%; width: 100%; }

    /* Records nav */
    .scca-rrmg-records__nav { border-radius: 12px; width: 100%; flex-direction: column; padding: 4px; }
    .scca-rrmg-records__nav-link { text-align: center; }
}
