/**
 * Race Results & Standings Display Styles
 * @since 1.2.15
 */

/* =========================================
   COMMON STYLES
   ========================================= */

.gt7-race-results,
.gt7-standings,
.gt7-race-history {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    max-width: 100%;
    margin: 0 auto 2.5rem;
}

.gt7-standings + .gt7-standings {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 3px solid #e9ecef;
}

.gt7-standings-pro .gt7-standings-table thead {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.gt7-standings-proam .gt7-standings-table thead {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
}

.gt7-error,
.gt7-no-results {
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
}

/* =========================================
   RACE RESULTS
   ========================================= */

.gt7-results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.gt7-results-round {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.gt7-results-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #212529;
}

.gt7-results-track {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0.25rem 0 0;
}

.gt7-results-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gt7-results-tournament {
    font-weight: 600;
    color: #495057;
}

.gt7-results-date {
    font-size: 0.875rem;
    color: #6c757d;
}

.gt7-race-stats-bar {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.25rem;
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #adb5bd;
    overflow: hidden;
}

.gt7-race-stats-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    padding: 0.6rem 1rem;
}

.gt7-race-stats-row + .gt7-race-stats-row {
    border-top: 1px solid rgba(255,255,255,0.08);
}

.gt7-race-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.gt7-race-stat-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.7rem;
    opacity: 0.7;
}

.gt7-race-stat-value {
    font-weight: 600;
    color: #dee2e6;
}

.gt7-race-stat-divider {
    width: 1px;
    height: 1rem;
    background: rgba(255,255,255,0.15);
    align-self: center;
}

.gt7-condition-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gt7-condition-dry { background: #198754; color: #fff; }
.gt7-condition-damp { background: #fd7e14; color: #fff; }
.gt7-condition-wet { background: #0d6efd; color: #fff; }

.gt7-results-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gt7-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.gt7-results-table thead {
    background: #1a1a2e;
    color: #fff;
}

.gt7-results-table th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    color: #fff;
}

.gt7-results-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.gt7-results-table tbody tr:hover {
    background: #f8f9fa;
}

.gt7-col-pos {
    width: 50px;
    text-align: center !important;
}

.gt7-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
}

.gt7-pos-1 { background: linear-gradient(135deg, #ffd700, #ffec8b); color: #000; }
.gt7-pos-2 { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); color: #000; }
.gt7-pos-3 { background: linear-gradient(135deg, #cd7f32, #daa06d); color: #fff; }

.gt7-col-class-pos {
    width: 60px;
    text-align: center !important;
}

.gt7-class-position { font-weight: 600; color: #495057; }
.gt7-class-position-pro { color: #dc3545; font-weight: 700; }
.gt7-class-position-proam { color: #0d6efd; font-weight: 700; }

.gt7-class-pos-1 { background: linear-gradient(135deg, #ffd700, #ffec8b); color: #000 !important; padding: 0.15rem 0.4rem; border-radius: 3px; }
.gt7-class-pos-2 { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); color: #000 !important; padding: 0.15rem 0.4rem; border-radius: 3px; }
.gt7-class-pos-3 { background: linear-gradient(135deg, #cd7f32, #daa06d); color: #fff !important; padding: 0.15rem 0.4rem; border-radius: 3px; }

.gt7-col-driver { min-width: 180px; }

.gt7-driver-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gt7-driver-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.gt7-standing-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}

.gt7-standing-champ {
    position: absolute;
    bottom: -2px;
    left: -2px;
    line-height: 0;
    cursor: help;
}

.gt7-standing-champ img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    object-fit: cover;
    display: block;
}

.gt7-standing-champ-inline {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4rem;
    line-height: 0;
    cursor: help;
}

.gt7-standing-champ-inline img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
}

.gt7-driver-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gt7-driver-name {
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gt7-driver-number {
    font-weight: 700;
    color: #6c757d;
    margin-right: 0.25rem;
}

.gt7-driver-team-compact {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gt7-fastest-lap-badge,
.gt7-pole-badge,
.gt7-led-laps-badge {
    display: inline-block !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    padding: 0.15rem 0.35rem !important;
    border-radius: 3px !important;
    margin-left: 0.35rem !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
}

.gt7-fastest-lap-badge { background: #6f42c1 !important; color: #fff !important; }
.gt7-pole-badge { background: #20c997 !important; color: #fff !important; }
.gt7-led-laps-badge { background: #fd7e14 !important; color: #fff !important; }

.gt7-col-team,
.gt7-col-car {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit; /* inherits row text color; overridable via Table Styling row_text_color */
}

.gt7-col-driver-class { width: 60px; }

.gt7-class-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.gt7-class-pro { background: #dc3545; color: #fff; }
.gt7-class-proam { background: #0d6efd; color: #fff; }
.gt7-class-am { background: #28a745; color: #fff; }

.gt7-col-points {
    width: 60px;
    text-align: center !important;
    font-size: 1rem;
}

.gt7-col-bonus {
    width: 80px;
    font-size: 0.75rem;
    color: #6c757d;
}

.gt7-col-incidents {
    width: 50px;
    text-align: center !important;
}

.gt7-inc-med { color: #fd7e14; font-weight: 600; }
.gt7-inc-high { color: #dc3545; font-weight: 700; }

.gt7-col-fastest {
    width: 90px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    color: #495057;
}

.gt7-status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.gt7-dns { background: #6c757d; color: #fff; }
.gt7-dnf { background: #dc3545; color: #fff; }

.gt7-result-podium { background: rgba(255, 215, 0, 0.05); }
.gt7-result-dns td,
.gt7-result-dnf td { opacity: 0.6; }

.gt7-results-legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    font-size: 0.75rem;
    color: #6c757d;
}

.gt7-compact .gt7-results-table { font-size: 0.8rem; }
.gt7-compact .gt7-driver-avatar { width: 24px; height: 24px; }
.gt7-compact .gt7-results-table td { padding: 0.4rem 0.35rem; }

/* =========================================
   TOURNAMENT STANDINGS
   ========================================= */

.gt7-standings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.gt7-standings-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #212529;
}

.gt7-standings-season {
    font-weight: 400;
    color: #6c757d;
}

.gt7-standings-class-filter {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
}

.gt7-standings-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gt7-standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.gt7-standings-table thead {
    background: #1a1a2e;
    color: #fff;
}

.gt7-standings-table th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    color: #fff;
}

.gt7-standings-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.gt7-standings-table tbody tr:hover { background: #f8f9fa; }

.gt7-standing-top { background: rgba(255, 215, 0, 0.05); }
.gt7-standing-top:nth-child(1) { background: rgba(255, 215, 0, 0.1); }
.gt7-standing-top:nth-child(2) { background: rgba(192, 192, 192, 0.1); }
.gt7-standing-top:nth-child(3) { background: rgba(205, 127, 50, 0.1); }

.gt7-col-races,
.gt7-col-wins,
.gt7-col-podiums,
.gt7-col-top5,
.gt7-col-top10 {
    width: 60px;
    text-align: center !important;
}

.gt7-standings-table td.gt7-col-wins,
.gt7-results-table td.gt7-col-wins,
.gt7-history-table td.gt7-col-wins { color: #28a745 !important; }
.gt7-standings-table td.gt7-col-podiums,
.gt7-results-table td.gt7-col-podiums,
.gt7-history-table td.gt7-col-podiums { color: #fd7e14 !important; }

/* =========================================
   DRIVER RACE HISTORY
   ========================================= */

.gt7-history-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: #212529;
}

.gt7-history-tournament { margin-bottom: 2rem; }

.gt7-history-tournament-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    color: #212529;
}

.gt7-history-year { font-weight: 400; color: #6c757d; }

.gt7-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.gt7-history-table thead { background: #1a1a2e; }

.gt7-history-table th {
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #fff;
    border-bottom: 2px solid #e9ecef;
}

.gt7-history-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.gt7-history-table tbody tr:hover { background: #f8f9fa; }

.gt7-history-race-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.gt7-history-race-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

@media (max-width: 768px) {
    .gt7-results-header,
    .gt7-standings-header { flex-direction: column; text-align: center; }
    .gt7-results-meta { text-align: center; }
    .gt7-race-stats-row { justify-content: center; font-size: 0.75rem; gap: 0.4rem 0.75rem; }
    .gt7-race-stat-divider { display: none; }
    .gt7-results-table,
    .gt7-standings-table,
    .gt7-history-table { font-size: 0.8rem; }
    .gt7-results-table th,
    .gt7-results-table td,
    .gt7-standings-table th,
    .gt7-standings-table td { padding: 0.5rem 0.35rem; }
    .gt7-driver-avatar { width: 28px; height: 28px; }
    .gt7-standing-champ img { width: 14px; height: 14px; border-width: 1.5px; }
    .gt7-standing-champ-inline img { width: 16px; height: 16px; }
    .gt7-col-team,
    .gt7-col-car,
    .gt7-col-bonus,
    .gt7-col-fastest { display: none; }
    .gt7-col-driver { min-width: 140px; }
    .gt7-results-legend { justify-content: center; }
}

@media (max-width: 480px) {
    .gt7-results-title,
    .gt7-standings-title,
    .gt7-history-title { font-size: 1.25rem; }
    .gt7-position { width: 24px; height: 24px; font-size: 0.75rem; }
    .gt7-driver-avatar { width: 24px; height: 24px; }
    .gt7-standing-champ img { width: 12px; height: 12px; border-width: 1px; }
    .gt7-standing-champ { bottom: -1px; left: -1px; }
    .gt7-standing-champ-inline img { width: 14px; height: 14px; }
    .gt7-standing-champ-inline { margin-left: 0.3rem; }
    .gt7-driver-number { display: none; }
    .gt7-col-class { display: none; }
}

/* ==========================================================================
   MOBILE IMPROVEMENTS — appended v1.0.27
   ========================================================================== */

@media (max-width: 600px) {
    .gt7-results-title,
    .gt7-standings-title {
        font-size: 1.1rem;
    }

    .gt7-results-header,
    .gt7-standings-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .gt7-results-table,
    .gt7-standings-table {
        font-size: 0.78rem;
    }

    .gt7-results-table th,
    .gt7-results-table td,
    .gt7-standings-table th,
    .gt7-standings-table td {
        padding: 0.45rem 0.3rem;
    }

    .gt7-col-team,
    .gt7-col-car,
    .gt7-col-bonus,
    .gt7-col-fastest,
    .gt7-col-incidents {
        display: none;
    }

    .gt7-col-driver {
        min-width: 120px;
    }

    .gt7-driver-number {
        display: none;
    }

    .gt7-position {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    .gt7-race-stats-row {
        font-size: 0.7rem;
        gap: 0.3rem 0.6rem;
        padding: 0.5rem 0.75rem;
    }

    .gt7-race-stat-divider {
        display: none;
    }

    .gt7-results-legend {
        font-size: 0.7rem;
        gap: 0.75rem;
        justify-content: center;
    }

    .gt7-col-races,
    .gt7-col-top5,
    .gt7-col-top10 {
        display: none;
    }

    .gt7-col-wins,
    .gt7-col-podiums,
    .gt7-col-points {
        width: 44px;
    }
}

@media (max-width: 380px) {
    .gt7-results-table,
    .gt7-standings-table {
        font-size: 0.72rem;
    }

    .gt7-driver-avatar {
        width: 22px;
        height: 22px;
    }
}
