/* ==========================================================================
   LZWT Live Bracket System — Frontend Styles
   Designed to inherit site typography and provide a clean, responsive bracket.
   ========================================================================== */

:root {
    --lbs-bg: #f8f9fa;
    --lbs-border: #dee2e6;
    --lbs-text: inherit;
    --lbs-muted: #6c757d;
    --lbs-winner-bg: #d4edda;
    --lbs-winner-border: #28a745;
    --lbs-loser-opacity: 0.5;
    --lbs-active-border: #ffc107;
    --lbs-omt-bg: #dc3545;
    --lbs-seed-bg: #343a40;
    --lbs-seed-color: #fff;
    --lbs-round-header-bg: #343a40;
    --lbs-round-header-color: #fff;
    --lbs-connector-color: #adb5bd;
}

/* Container */
.lbs-bracket-container {
    font-family: inherit;
    color: var(--lbs-text);
    line-height: 1.4;
}

.lbs-bracket {
    margin-bottom: 2em;
}

.lbs-bracket-title {
    font-size: 1.25em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--lbs-border);
}

/* Bracket rounds layout — horizontal columns */
.lbs-bracket-rounds {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1em;
}

/* Round column */
.lbs-round {
    flex: 1 1 200px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.lbs-round-header {
    background: var(--lbs-round-header-bg);
    color: var(--lbs-round-header-color);
    text-align: center;
    padding: 6px 12px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.lbs-round-battles {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 8px 4px;
}

/* Battle matchup */
.lbs-battle {
    border: 1px solid var(--lbs-border);
    border-radius: 4px;
    background: var(--lbs-battle-bg, #fff);
    position: relative;
    overflow: visible;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin: 4px 6px;
}

.lbs-battle--active {
    border-color: var(--lbs-active-border);
}

.lbs-battle--completed {
    border-color: var(--lbs-winner-border);
}

.lbs-battle--current {
    border-width: 2px;
}

/* OMT badge — vertical tab attached to right edge of battle box */
.lbs-omt {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate(100%, -50%);
    background: var(--lbs-omt-bg);
    color: var(--lbs-omt-color, #fff);
    font-size: 0.5em;
    font-weight: 700;
    padding: 6px 3px;
    border-radius: 0 3px 3px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    writing-mode: vertical-lr;
    line-height: 1;
}

/* Driver slot — two-line layout */
.lbs-slot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4px 8px;
    border-bottom: 1px solid var(--lbs-border);
    transition: background 0.2s, opacity 0.2s;
    min-height: 40px;
}

.lbs-slot:last-child {
    border-bottom: none;
}

.lbs-slot--winner {
    background: var(--lbs-winner-bg);
    color: var(--lbs-winner-color, inherit);
}

.lbs-slot--loser {
    opacity: var(--lbs-loser-opacity);
}

/* Info row: seed left, driver number right (two-line layout) */
.lbs-slot-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    line-height: 1.2;
    margin-bottom: 3px;
}

/* Single-line layout: seed + name on one row (when no driver number) */
.lbs-slot-single {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
    overflow: hidden;
}

/* Seed label (ordinal: 1st, 2nd, etc.) */
.lbs-seed {
    background: var(--lbs-seed-bg);
    color: var(--lbs-seed-color);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.55em;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.4;
    white-space: nowrap;
}

/* Driver number */
.lbs-num {
    color: var(--lbs-muted);
    font-size: 0.6em;
    flex-shrink: 0;
    background: #e9ecef;
    padding: 1px 5px;
    border-radius: 3px;
    line-height: 1.4;
}

/* Driver name — full width on its own line */
.lbs-name {
    font-size: 0.85em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    padding-top: 1px;
}

/* Inside single-line layout, name sits inline — smaller font, no top padding */
.lbs-slot-single .lbs-name {
    padding-top: 0;
    min-width: 0;
    font-size: 0.75em;
}

.lbs-name--tbd {
    color: var(--lbs-muted);
    font-style: italic;
    font-weight: 400;
}

.lbs-name--bye {
    color: var(--lbs-muted);
    font-style: italic;
    font-weight: 400;
    font-size: 0.75em;
}

/* Error / notice */
.lbs-error {
    color: #dc3545;
    font-style: italic;
}

.lbs-notice {
    color: var(--lbs-muted);
    font-style: italic;
}

/* ==========================================================================
   Podium / Final Standings
   ========================================================================== */

.lbs-podium {
    margin-top: 1em;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--lbs-border);
    border-radius: 4px;
    overflow: hidden;
    max-width: 40%;
}

.lbs-podium-title {
    background: var(--lbs-round-header-bg);
    color: var(--lbs-round-header-color);
    text-align: center;
    padding: 6px 12px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.lbs-podium-places {
    display: flex;
    flex-direction: column;
}

.lbs-podium-place {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--lbs-border);
    font-size: 0.85em;
}

.lbs-podium-place:last-child {
    border-bottom: none;
}

.lbs-podium-pos {
    font-weight: 700;
    min-width: 28px;
}

.lbs-podium-name {
    flex: 1;
}

.lbs-podium--1 {
    background: var(--lbs-qual-podium-1, #ffd700);
    color: var(--lbs-qual-podium-1-color, #000);
    font-weight: 700;
}

.lbs-podium--2 {
    background: var(--lbs-qual-podium-2, #c0c0c0);
    color: var(--lbs-qual-podium-2-color, #000);
}

.lbs-podium--3 {
    background: var(--lbs-qual-podium-3, #cd7f32);
    color: var(--lbs-qual-podium-3-color, #000);
}

/* ==========================================================================
   Connector lines between rounds
   ========================================================================== */

/* Horizontal stubs from battles — right side */
.lbs-round:not(:last-child) .lbs-battle::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    width: 7px;
    height: 0;
    border-top: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* Horizontal stubs from battles — left side */
.lbs-round:not(:first-child) .lbs-battle::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    width: 7px;
    height: 0;
    border-top: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* Hide stubs on rounds with no adjacent connector */
.lbs-round[data-round="playoff"] .lbs-battle::before,
.lbs-round[data-round="playoff"] .lbs-battle::after,
.lbs-round[data-round="top4"] .lbs-battle::after,
.lbs-round[data-round="final"] .lbs-battle::before {
    display: none;
}

/* Connector column between rounds */
.lbs-connector-col {
    display: flex;
    flex-direction: column;
    width: 28px;
    flex: 0 0 28px;
}

/* Invisible spacer matching the round header height */
.lbs-connector-spacer {
    padding: 6px 0;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.4;
    visibility: hidden;
    overflow: hidden;
}

.lbs-connector-spacer::before {
    content: '\00a0';
    display: block;
}

/* Wrapper matching lbs-round-battles layout */
.lbs-connector-pairs {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

/* Each pair spans two battles and merges them */
.lbs-connector-pair {
    flex: 1;
    position: relative;
}

/* Input line from top battle (at 25%) — left edge to center */
.lbs-connector-top {
    position: absolute;
    top: 25%;
    left: 0;
    right: 50%;
    border-top: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* Input line from bottom battle (at 75%) — left edge to center */
.lbs-connector-bottom {
    position: absolute;
    top: 75%;
    left: 0;
    right: 50%;
    border-top: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* Vertical bar connecting top and bottom inputs at center */
.lbs-connector-pair::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 25%;
    bottom: 25%;
    border-left: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* Output line from center to right edge at 50% */
.lbs-connector-pair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    right: 0;
    border-top: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* Straight-through connector for 1:1 round transitions (e.g., Top 24 → Top 16) */
.lbs-connector-straight {
    flex: 1;
    position: relative;
}

.lbs-connector-straight::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: var(--lbs-connector-width, 2px) var(--lbs-connector-style, dashed) var(--lbs-connector-color);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .lbs-round {
        flex: 0 0 auto;
        min-width: 170px;
    }

    .lbs-name {
        font-size: 0.75em;
    }

    .lbs-seed {
        font-size: 0.5em;
        padding: 1px 4px;
    }

    .lbs-slot {
        padding: 3px 6px;
    }

    .lbs-podium {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .lbs-round {
        min-width: 150px;
    }

    .lbs-num {
        display: none;
    }

    .lbs-round-header {
        font-size: 0.65em;
        padding: 4px 8px;
    }
}

/* ==========================================================================
   Qualifying Results Table
   ========================================================================== */

.lbs-qualifying {
    font-family: inherit;
    color: var(--lbs-text);
    margin-bottom: 2em;
}

.lbs-qualifying-title {
    font-size: 1.25em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--lbs-qual-border, var(--lbs-border));
}

.lbs-qualifying-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--lbs-qual-border, var(--lbs-border));
}

.lbs-qualifying-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: 0;
    font-size: 0.9em;
}

/* Reset theme overrides on table internals */
.lbs-qualifying-table thead {
    display: table-header-group !important;
    background: var(--lbs-qual-header-bg, var(--lbs-round-header-bg));
    color: var(--lbs-qual-header-color, var(--lbs-round-header-color));
}

.lbs-qualifying-table tbody {
    display: table-row-group !important;
    width: auto !important;
}

.lbs-qualifying-table tr {
    display: table-row !important;
    border: none !important;
}

.lbs-qualifying-table th {
    display: table-cell !important;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    border-bottom: none;
    border-right: none !important;
}

.lbs-qualifying-table td {
    display: table-cell !important;
    padding: 10px 14px;
    border-bottom: 1px solid var(--lbs-qual-border, var(--lbs-border));
    border-right: none !important;
    vertical-align: middle;
}

.lbs-qualifying-table tbody tr {
    background: var(--lbs-qual-row-alt-bg, #fff);
    transition: background 0.15s ease;
}

.lbs-qualifying-table tbody tr:nth-child(even) {
    background: var(--lbs-qual-row-bg, var(--lbs-bg));
}

.lbs-qualifying-table tbody tr:hover {
    background: var(--lbs-qual-hover-bg, rgba(0, 0, 0, 0.04));
}

.lbs-qualifying-table tbody tr:last-child td {
    border-bottom: none;
}

/* Podium rows — full row background + font color */
.lbs-q-podium--1 {
    background: var(--lbs-qual-podium-1, #ffd700) !important;
    color: var(--lbs-qual-podium-1-color, #000) !important;
}

.lbs-q-podium--2 {
    background: var(--lbs-qual-podium-2, #c0c0c0) !important;
    color: var(--lbs-qual-podium-2-color, #000) !important;
}

.lbs-q-podium--3 {
    background: var(--lbs-qual-podium-3, #cd7f32) !important;
    color: var(--lbs-qual-podium-3-color, #000) !important;
}

/* Position cell */
.lbs-qualifying-table th.lbs-q-pos,
.lbs-qualifying-table td.lbs-q-pos {
    white-space: nowrap !important;
    width: 50px !important;
    min-width: 44px !important;
    max-width: 60px !important;
    font-weight: 700;
    font-size: 0.8em;
    text-align: center !important;
}

.lbs-qualifying-table tbody td.lbs-q-pos {
    background: var(--lbs-seed-bg);
    color: var(--lbs-seed-color);
}

/* Driver name — takes all remaining space */
.lbs-qualifying-table th.lbs-q-driver,
.lbs-qualifying-table td.lbs-q-driver {
    width: auto !important;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lbs-qualifying-table th.lbs-q-driver {
    text-align: left;
}

/* Score cells — compact, fixed width */
.lbs-qualifying-table th.lbs-q-score,
.lbs-qualifying-table td.lbs-q-score {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap !important;
    width: 80px !important;
    min-width: 70px !important;
    max-width: 100px !important;
}

.lbs-qualifying-table th.lbs-q-best,
.lbs-qualifying-table td.lbs-q-best {
    font-weight: 700;
}

/* Driver number — dimmed */
.lbs-q-number {
    opacity: 0.6;
    font-weight: 400;
}

/* ── Mobile: fit everything on screen, no scroll ── */

@media (max-width: 600px) {
    .lbs-qualifying-table-wrap {
        overflow-x: hidden;
    }

    .lbs-qualifying-table {
        table-layout: fixed !important;
        width: 100% !important;
    }

    .lbs-qualifying-table th,
    .lbs-qualifying-table td {
        padding: 8px 4px;
        font-size: 0.75em;
    }

    /* Position — narrow */
    .lbs-qualifying-table th.lbs-q-pos,
    .lbs-qualifying-table td.lbs-q-pos {
        width: 30px !important;
        min-width: 28px !important;
        max-width: 34px !important;
        padding: 8px 2px;
        font-size: 0.72em;
    }

    /* Driver name — flexible, left-aligned, truncate long names */
    .lbs-qualifying-table th.lbs-q-driver,
    .lbs-qualifying-table td.lbs-q-driver {
        text-align: left !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-left: 4px;
        padding-right: 4px;
    }

    /* Score columns — tight */
    .lbs-qualifying-table th.lbs-q-score,
    .lbs-qualifying-table td.lbs-q-score {
        width: 50px !important;
        min-width: 44px !important;
        max-width: 56px !important;
        padding: 8px 2px;
        font-size: 0.72em;
    }

    /* Hide driver number on mobile */
    .lbs-q-number {
        display: none;
    }
}

@media (max-width: 360px) {
    .lbs-qualifying-table th,
    .lbs-qualifying-table td {
        padding: 6px 2px;
        font-size: 0.68em;
    }

    .lbs-qualifying-table th.lbs-q-pos,
    .lbs-qualifying-table td.lbs-q-pos {
        width: 26px !important;
        min-width: 24px !important;
    }

    .lbs-qualifying-table th.lbs-q-score,
    .lbs-qualifying-table td.lbs-q-score {
        width: 44px !important;
        min-width: 40px !important;
    }
}

/* ==========================================================================
   Championship Standings Table
   ========================================================================== */

.lbs-standings {
    font-family: inherit;
    color: var(--lbs-text);
    margin-bottom: 2em;
}

.lbs-standings-title {
    font-size: 1.25em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--lbs-qual-border, var(--lbs-border));
}

.lbs-standings-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--lbs-qual-border, var(--lbs-border));
}

.lbs-standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    table-layout: fixed;
}

.lbs-standings-table thead {
    background: var(--lbs-qual-header-bg, var(--lbs-round-header-bg));
    color: var(--lbs-qual-header-color, var(--lbs-round-header-color));
}

.lbs-standings-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    border-bottom: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lbs-standings-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--lbs-qual-border, var(--lbs-border));
    vertical-align: middle;
}

.lbs-standings-table tbody tr {
    background: var(--lbs-qual-row-alt-bg, #fff);
    transition: background 0.15s ease;
}

.lbs-standings-table tbody tr:nth-child(even) {
    background: var(--lbs-qual-row-bg, var(--lbs-bg));
}

.lbs-standings-table tbody tr:hover {
    background: var(--lbs-qual-hover-bg, rgba(0, 0, 0, 0.04));
}

.lbs-standings-table tbody tr:last-child td {
    border-bottom: none;
}

/* Podium rows */
.lbs-st-podium--1 {
    background: var(--lbs-qual-podium-1, #ffd700) !important;
    color: var(--lbs-qual-podium-1-color, #000) !important;
}

.lbs-st-podium--2 {
    background: var(--lbs-qual-podium-2, #c0c0c0) !important;
    color: var(--lbs-qual-podium-2-color, #000) !important;
}

.lbs-st-podium--3 {
    background: var(--lbs-qual-podium-3, #cd7f32) !important;
    color: var(--lbs-qual-podium-3-color, #000) !important;
}

/* Position cell */
.lbs-st-pos {
    white-space: nowrap;
    width: 48px;
    background: var(--lbs-seed-bg);
    color: var(--lbs-seed-color);
    font-weight: 700;
    font-size: 0.8em;
    text-align: center;
}

/* Driver cell — gets remaining space, allows wrapping */
.lbs-st-driver {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Event column header */
.lbs-standings-table th.lbs-st-event {
    text-align: right;
    width: 65px;
}

/* Event points cells */
.lbs-st-event-pts {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 65px;
}

.lbs-st-pending,
.lbs-st-absent {
    color: var(--lbs-muted, #6c757d);
    text-align: center;
}

/* Total column */
.lbs-standings-table th.lbs-st-total {
    text-align: right;
    width: 70px;
}

.lbs-st-total {
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 70px;
}

.lbs-standings-table th.lbs-st-pos {
    text-align: center;
}

/* Responsive: tighten padding on small screens */
@media (max-width: 768px) {
    .lbs-standings-table th,
    .lbs-standings-table td {
        padding: 6px 6px;
        font-size: 0.8em;
    }

    .lbs-standings-table th.lbs-st-event,
    .lbs-st-event-pts {
        width: 55px;
    }

    .lbs-standings-table th.lbs-st-total,
    .lbs-st-total {
        width: 60px;
    }

    .lbs-st-pos {
        width: 40px;
    }
}

@media (max-width: 480px) {
    .lbs-standings-table th,
    .lbs-standings-table td {
        padding: 5px 4px;
        font-size: 0.75em;
    }

    .lbs-standings-table th.lbs-st-event,
    .lbs-st-event-pts {
        width: 48px;
    }

    .lbs-standings-table th.lbs-st-total,
    .lbs-st-total {
        width: 52px;
    }

    .lbs-st-pos {
        width: 36px;
    }
}

/* ==========================================================================
   Driver Profile Card — [driver_profile]
   ========================================================================== */

.lbs-driver-card {
    font-family: inherit;
    border: 1px solid var(--lbs-border);
    border-radius: 8px;
    overflow: hidden;
    max-width: 600px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 2em;
}

.lbs-driver-card__header {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start;
}

.lbs-driver-card__photo {
    flex-shrink: 0;
}

.lbs-driver-card__photo img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--lbs-border);
}

.lbs-driver-card__info {
    flex: 1;
    min-width: 0;
}

.lbs-driver-card__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4em;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.2;
}

.lbs-driver-card__nickname {
    font-style: italic;
    color: var(--lbs-muted, #6c757d);
    margin-bottom: 8px;
}

.lbs-driver-card__details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lbs-driver-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    font-size: 0.9em;
}

.lbs-driver-card__number {
    font-weight: 700;
    background: var(--lbs-seed-bg, #343a40);
    color: var(--lbs-seed-color, #fff);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.5em;
}

.lbs-driver-card__sep {
    color: var(--lbs-muted, #6c757d);
    margin: 0 2px;
}

.lbs-driver-card__detail {
    font-size: 0.85em;
    color: var(--lbs-muted, #6c757d);
}

.lbs-driver-card__instagram {
    display: flex;
    align-items: center;
}

.lbs-driver-card__instagram a {
    display: flex;
    align-items: center;
    color: #e1306c;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
}

.lbs-driver-card__instagram a:hover {
    text-decoration: underline;
}

.lbs-driver-card__icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    max-width: 1em;
    max-height: 1em;
    vertical-align: middle;
    margin-right: 3px;
    fill: currentColor;
    flex-shrink: 0;
}

.lbs-driver-card__car {
    display: flex;
    align-items: center;
    font-size: 0.85em;
    color: var(--lbs-muted, #6c757d);
}

.lbs-driver-card__bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--lbs-border);
}

.lbs-driver-card__bio {
    font-size: 0.9em;
    line-height: 1.6;
    color: #333;
}

.lbs-driver-card__section-title {
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0 0 6px;
}

.lbs-driver-card__bio p:first-of-type {
    margin-top: 0;
}

.lbs-driver-card__bio p:last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .lbs-driver-card__header {
        flex-direction: column;
        align-items: center;
    }

    .lbs-driver-card__bottom {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Driver Directory Grid — [driver_directory] / [event_drivers]
   ========================================================================== */

.lbs-directory {
    font-family: inherit;
    margin-bottom: 2em;
}

.lbs-directory__title {
    font-size: 1.25em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--lbs-border);
}

.lbs-directory__grid {
    display: grid;
    gap: 16px;
}

.lbs-directory__grid--1 { grid-template-columns: 1fr; }
.lbs-directory__grid--2 { grid-template-columns: repeat(2, 1fr); }
.lbs-directory__grid--3 { grid-template-columns: repeat(3, 1fr); }
.lbs-directory__grid--4 { grid-template-columns: repeat(4, 1fr); }

.lbs-directory__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--lbs-border);
    border-radius: 6px;
    background: #fff;
    transition: box-shadow 0.15s ease;
}

.lbs-directory__item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lbs-directory__photo {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
}

.lbs-directory__photo img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.lbs-directory__photo--empty {
    background: var(--lbs-bg, #f8f9fa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lbs-directory__photo--empty::after {
    content: '\1F3CE';
    font-size: 24px;
}

.lbs-directory__details {
    min-width: 0;
}

.lbs-directory__name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 1.1em;
    line-height: 1.3;
    color: #000;
    text-transform: uppercase;
    font-family: 'Barlow Condensed', sans-serif;
    margin-bottom: 6px;
}

.lbs-directory__number {
    font-weight: 700;
    background: var(--lbs-seed-bg, #343a40);
    color: var(--lbs-seed-color, #fff);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    flex-shrink: 0;
}

.lbs-directory__sub {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    color: var(--lbs-muted, #6c757d);
    margin-top: 0;
}

@media (max-width: 768px) {
    .lbs-directory__grid--3,
    .lbs-directory__grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .lbs-directory__grid--2,
    .lbs-directory__grid--3,
    .lbs-directory__grid--4 {
        grid-template-columns: 1fr;
    }

    .lbs-directory__item {
        flex-direction: column;
        text-align: center;
    }

    .lbs-directory__name {
        justify-content: center;
    }

    .lbs-directory__sub {
        justify-content: center;
    }
}

/* ── Event Feed ──────────────────────────────────────── */

.lbs-event-feed-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.lbs-event-feed {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
}

.lbs-feed-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    border-left: 3px solid #6c757d;
}

.lbs-feed-entry:last-child {
    border-bottom: none;
}

.lbs-feed-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.4;
}

.lbs-feed-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.lbs-feed-message {
    font-size: 14px;
    color: #212529;
    line-height: 1.4;
}

.lbs-feed-time {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.lbs-feed-empty {
    padding: 24px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.lbs-feed-loading {
    padding: 24px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* Feed type accent colours */
.lbs-feed--battle_result     { border-left-color: #28a745; }
.lbs-feed--omt_called        { border-left-color: #dc3545; }
.lbs-feed--five_min_rule      { border-left-color: #fd7e14; }
.lbs-feed--cto_awarded        { border-left-color: #e83e8c; }
.lbs-feed--battle_changed     { border-left-color: #17a2b8; }
.lbs-feed--qualifying_score   { border-left-color: #007bff; }
.lbs-feed--qualifying_finalized { border-left-color: #28a745; }
.lbs-feed--brackets_generated { border-left-color: #6610f2; }
.lbs-feed--manual             { border-left-color: #ffc107; }
.lbs-feed--event_completed    { border-left-color: #ffd700; }

@media (max-width: 480px) {
    .lbs-feed-content {
        flex-direction: column;
        gap: 2px;
    }
}

/* ── Driver Form ─────────────────────────────────── */

.lbs-driver-form {
    width: 100%;
    max-width: 100%;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.lbs-driver-form__title {
    font-size: inherit;
    font-weight: inherit;
    margin: 0 0 8px;
    color: inherit;
}

.lbs-driver-form__desc {
    color: inherit;
    opacity: 0.7;
    font-size: inherit;
    margin: 0 0 20px;
    line-height: 1.5;
}

.lbs-driver-form__field {
    margin-bottom: 16px;
}

.lbs-driver-form__field label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: inherit;
    color: inherit;
}

.lbs-driver-form__required {
    color: #e94560;
}

.lbs-driver-form__email-input,
.lbs-driver-form__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.lbs-driver-form__email-input:focus,
.lbs-driver-form__input:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.15);
}

.lbs-driver-form__readonly {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: inherit;
    font-family: inherit;
    box-sizing: border-box;
    background: #f8f9fa;
    color: inherit;
    opacity: 0.6;
}

textarea.lbs-driver-form__input {
    resize: vertical;
    min-height: 80px;
}

select.lbs-driver-form__input {
    appearance: auto;
}

.lbs-driver-form__continue,
.lbs-driver-form__submit,
.lbs-driver-form__verify {
    display: inline-block;
    padding: 12px 28px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: inherit;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.lbs-driver-form__continue:hover,
.lbs-driver-form__submit:hover,
.lbs-driver-form__verify:hover {
    background: #c73a52;
}

.lbs-driver-form__continue:disabled,
.lbs-driver-form__submit:disabled,
.lbs-driver-form__verify:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.lbs-driver-form__code-input {
    text-align: center;
    font-size: 1.5em;
    font-weight: 700;
    letter-spacing: 6px;
    max-width: 200px;
}

.lbs-driver-form__resend {
    margin-top: 12px;
    font-size: 0.9em;
}

.lbs-driver-form__resend a {
    color: #e94560;
    text-decoration: none;
}

.lbs-driver-form__resend a:hover {
    text-decoration: underline;
}

.lbs-driver-form__notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9em;
    line-height: 1.5;
}

.lbs-driver-form__notice--info {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    color: #0c5460;
}

.lbs-driver-form__message {
    padding: 16px;
    border-radius: 6px;
    margin-top: 16px;
    font-size: 0.95em;
}

.lbs-driver-form__message p {
    margin: 0;
}

.lbs-driver-form__message--success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.lbs-driver-form__message--error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.lbs-driver-form-error {
    color: #721c24;
    font-style: italic;
}
