:root {
    --primary-color: #333;
    --secondary-color: #4CAF50;
    --background-color: #f4f4f4;
    --border-color: #ddd;
    --text-color: #333;
    --header-bg: #333;
    --header-text: white;
    --hover-color: #f2f2f2;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --popup-bg: rgba(0, 0, 0, 0.5);
    --error-color: #ff4444;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --grid-gap: 20px;
    --border-radius: 8px;
    --transition-speed: 0.3s;
    --font-family: Arial, Helvetica, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: bold;
    color: var(--primary-color);
}

h1 {
    font-size: 2em;
    text-align: center;
    margin: 20px 0;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px var(--shadow-color);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.header h1 {
    margin: 0;
    order: -1;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#logo {
    max-width: 200px;
    height: auto;
    margin: 0 10px;
    display: block;
    transition: transform var(--transition-speed) ease;
}

#logo2 {
    max-width: 200px;
    height: auto;
    margin: 0 10px;
    display: block;
    transition: transform var(--transition-speed) ease;
}

#logo:hover  { transform: scale(1.05); }
#logo2:hover { transform: scale(1.05); }

.back-button {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: all var(--transition-speed) ease;
    font-weight: bold;
}

.btn-back:hover {
    background-color: #444;
    transform: translateX(-2px);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    gap: 15px;
}

.loader {
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top: 3px solid var(--secondary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px;
    text-align: center;
    color: var(--text-color);
}

.no-data-message i {
    font-size: 2em;
    color: var(--info-color);
}

.controls-container {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 30px;
}

.competition-title {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
    padding: 10px;
    border-bottom: 2px solid var(--border-color);
}

.race-controls,
.event-controls,
.status-container {
    display: flex;
    align-items: center;
    gap: var(--grid-gap);
    margin-bottom: 15px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.select-container {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-color);
    font-weight: bold;
}

select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

select:hover { border-color: var(--secondary-color); }

.competitions-container {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px var(--shadow-color);
    margin: 20px auto;
    max-width: 1200px;
    position: relative;
}

#competitionsTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#competitionsTable th,
#competitionsTable td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

#competitionsTable th {
    background-color: var(--header-bg);
    color: var(--header-text);
    font-weight: bold;
    white-space: nowrap;
}

#competitionsTable tbody tr {
    transition: background-color var(--transition-speed) ease;
}

#competitionsTable tbody tr:hover { background-color: var(--hover-color); }

.competition-name {
    font-weight: bold;
    color: var(--primary-color);
}

.competition-date {
    color: var(--text-color);
    font-size: 0.9em;
    white-space: nowrap;
    cursor: help;
}

.table-container {
    overflow-x: auto;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px var(--shadow-color);
    margin: 20px 0;
    position: relative;
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

#resultsTable th,
#resultsTable td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    white-space: nowrap;
}

#resultsTable th {
    background-color: var(--header-bg);
    color: var(--header-text);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: pointer;
}

#resultsTable th:hover { background-color: #444; }

#resultsTable th::after      { content: '↕'; margin-left: 5px; opacity: 0.5; }
#resultsTable th.sort-asc::after  { content: '↑'; opacity: 1; }
#resultsTable th.sort-desc::after { content: '↓'; opacity: 1; }

#resultsTable tbody { border-top: 2px solid var(--header-bg); }

#resultsTable tbody tr {
    transition: background-color var(--transition-speed) ease;
}

#resultsTable tbody tr:hover {
    background-color: var(--hover-color);
    cursor: pointer;
}

#resultsTable tbody tr:nth-child(even) { background-color: #f8f9fa; }

#resultsTable th:nth-child(1),
#resultsTable td:nth-child(1) { width: 80px; text-align: center; }

#resultsTable th:nth-child(2),
#resultsTable td:nth-child(2) { width: 80px; text-align: center; }

#resultsTable th:nth-child(3),
#resultsTable td:nth-child(3) { width: 200px; }

.position-cell { text-align: center; font-weight: bold; }
.bib-cell      { text-align: center; }
.team-cell     { font-weight: bold; }
.numeric-cell  { text-align: right; }

.best-lap      { background-color: rgba(76, 175, 80, 0.1) !important; }
.no-results    { background-color: rgba(255, 165, 0,  0.1) !important; }
.best-lap-cell { background-color: rgba(76, 175, 80, 0.1) !important; }
.winner-row    { background-color: rgba(76, 175, 80, 0.1) !important; }

.popup {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--popup-bg);
    z-index: 1000;
    animation: fadeIn var(--transition-speed) ease-in-out;
}

.popup-content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px var(--shadow-color);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    animation: slideIn var(--transition-speed) ease-out;
}

.popup-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.popup-header h2 {
    margin: 0;
    color: var(--header-text);
}

.popup-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    transition: all var(--transition-speed) ease;
}

.close-button:hover {
    color: var(--error-color);
    transform: scale(1.1);
}

#vueltasAnterioresTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#vueltasAnterioresTable th,
#vueltasAnterioresTable td {
    padding: 10px;
    text-align: left;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

#vueltasAnterioresTable th {
    background-color: var(--header-bg);
    color: var(--header-text);
    top: 0;
}

.mejor-vuelta { background-color: rgba(76, 175, 80, 0.1) !important; }

button {
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-speed) ease;
}

#exportButton {
    background-color: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    min-width: 150px;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-left: auto;
}

#exportButton:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#exportButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
}

.view-button:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-button:active { transform: translateY(0); }

.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    max-width: 90%;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    position: relative;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    pointer-events: auto;
    max-width: 100%;
    overflow: hidden;
    word-break: break-word;
}

.notification.success { background-color: rgba(40,  167,  69, 0.9); }
.notification.error   { background-color: rgba(220,  53,  69, 0.9); }
.notification.warning { background-color: rgba(255, 193,   7, 0.9); }
.notification.info    { background-color: rgba(23,  162, 184, 0.9); }

.notification i         { font-size: 18px; flex-shrink: 0; }
.notification .message  { flex-grow: 1; }

.notification .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.notification .close-btn:hover { opacity: 1; }

.notification.fade-out { animation: fadeOut 0.3s ease-out forwards; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

.error-message {
    position: relative;
    background-color: var(--error-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-in-out;
    pointer-events: auto;
    max-width: 100%;
}

.notification-message {
    position: relative;
    background-color: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-in-out;
    pointer-events: auto;
    max-width: 100%;
}

.actions-cell { text-align: center; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translate(-50%, -60%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);     opacity: 1; }
}

[title] { position: relative; cursor: help; }

[title]:hover:after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[title]:hover:before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    margin-bottom: -12px;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    font-size: 14px;
    color: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-badge i { margin-right: 5px; }

.status-badge[data-status="0"] { background-image: linear-gradient(to right, #6c757d, #868e96); }
.status-badge[data-status="1"] { background-image: linear-gradient(to right, #17a2b8, #19b5d2); }

.status-badge[data-status="2"] {
    background-image: linear-gradient(to right, #ffc107, #ffd32a);
    color: black;
}

.status-badge[data-status="2"] .fa-clock         { display: inline-block !important; margin-right: 5px; }
.status-badge[data-status="3"] .fa-flag-checkered { display: inline-block !important; margin-right: 5px; }
.status-badge .fa-clock { display: none; }

.time-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
    color: #000;
    background-image: linear-gradient(to right, #f0f0f0, #e0e0e0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.status-badge[data-status="3"] { background-image: linear-gradient(to right, #28a745, #34ce57); }
.status-badge[data-status="4"] { background-image: linear-gradient(to right, #007bff, #008bff); }
.status-badge[data-status="5"] { background-image: linear-gradient(to right, #dc3545, #e25065); }

.status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.competition-info-container {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 30px;
    text-align: center;
}

.competition-info-container h2 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.competition-info-container p {
    color: #666;
    font-size: 1.1em;
}

.prueba-name  { font-weight: bold; color: var(--primary-color); font-size: 1.1em; padding-right: 15px; }
.evento-name  { color: #444; font-size: 1em; }
.prueba-status { text-align: center; }

.event-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item    { flex: 1; min-width: 200px; }
.info-label   { font-weight: bold; color: var(--primary-color); margin-right: 8px; }
.info-value   { font-size: 1.1em; }

.status-pending    { background-image: linear-gradient(to right, #17a2b8, #19b5d2); }
.status-in-progress{ background-image: linear-gradient(to right, #ffc107, #ffd32a); color: black; }
.status-finished   { background-image: linear-gradient(to right, #28a745, #34ce57); }
.status-official   { background-image: linear-gradient(to right, #007bff, #008bff); }
.status-review     { background-image: linear-gradient(to right, #dc3545, #e25065); }

#pruebasTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#pruebasTable th,
#pruebasTable td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

#pruebasTable th {
    background-color: var(--header-bg);
    color: var(--header-text);
    font-weight: bold;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

#pruebasTable tbody tr {
    transition: background-color var(--transition-speed) ease;
    background-color: white;
}

#pruebasTable tbody tr:nth-child(even) { background-color: #f8f9fa; }
#pruebasTable tbody tr:hover           { background-color: var(--hover-color); }

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    font-size: 14px;
    color: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    justify-content: center;
}

#pruebasTable .view-button {
    padding: 10px 20px;
    font-size: 15px;
    transition: all 0.3s ease;
    min-width: 160px;
    justify-content: center;
}

#pruebasTable .view-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ─────────────────────────────────────────────────────────────────
   MEDIA QUERIES
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
    :root { --grid-gap: 15px; }

    .race-controls,
    .event-controls,
    .status-container {
        flex-direction: column;
        align-items: stretch;
    }

    .select-container { width: 100%; }

    #exportButton {
        width: 100%;
        margin-top: 10px;
        margin-left: 0;
    }

    .popup-content { width: 95%; max-height: 80vh; }
}

@media (max-width: 992px) {
    #pruebasTable th,
    #pruebasTable td { padding: 14px; }

    .status-badge { min-width: 130px; font-size: 13px; }

    #pruebasTable .view-button { min-width: 140px; padding: 8px 16px; }
}

@media (max-width: 768px) {
    body { padding: 10px; }

    :root { --grid-gap: 10px; }

    .header { margin-bottom: 20px; flex-direction: column; }

    .header h1 { font-size: 1.4em; margin-bottom: 10px; }

    #logo, #logo2 { max-width: 120px; margin: 0 auto; }

    .back-button {
        position: static;
        width: 100%;
        margin-bottom: 10px;
        transform: none;
    }

    .btn-back { width: 100%; justify-content: center; }

    #competitionsTable th,
    #competitionsTable td,
    #resultsTable th,
    #resultsTable td { padding: 8px; font-size: 12px; }

    .error-message { font-size: 14px; padding: 10px 15px; }

    .competition-name { white-space: normal; }

    .competition-date { font-size: 0.8em; }

    .event-info { flex-direction: column; align-items: flex-start; }

    .info-item { width: 100%; margin-bottom: 10px; }

    #exportButton { width: 100%; margin-left: 0; }

    #pruebasTable { border: none; background: transparent; box-shadow: none; }

    #pruebasTable thead { display: none; }

    #pruebasTable tbody tr {
        display: block;
        margin-bottom: 16px;
        border-radius: var(--border-radius);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        background-color: white;
        overflow: hidden;
    }

    #pruebasTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        border-bottom: 1px solid #eee;
        min-height: 52px;
        text-align: right;
        position: static;
    }

    #pruebasTable tbody td:last-child { border-bottom: none; }

    #pruebasTable tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--primary-color);
        flex-shrink: 0;
        margin-right: 12px;
        text-align: left;
        white-space: nowrap;
        position: static;
        transform: none;
        top: auto;
        left: auto;
    }

    #pruebasTable .prueba-name,
    #pruebasTable .evento-name { text-align: right; font-size: 0.95em; word-break: break-word; }

    #pruebasTable .prueba-status { justify-content: space-between; }

    #pruebasTable .status-badge { min-width: unset; font-size: 12px; padding: 6px 12px; white-space: nowrap; }

    #pruebasTable .actions-cell { justify-content: center; padding: 14px 16px; }

    #pruebasTable .actions-cell::before { display: none; }

    #pruebasTable .view-button {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
        min-width: unset;
    }

    .type-badge { font-size: 0.72em; padding: 2px 7px; }
}

@media print {
    .controls-container,
    #exportButton,
    .close-button,
    .back-button,
    .loading-overlay { display: none !important; }

    body { padding: 0; background: white; }

    .table-container { box-shadow: none; }

    #resultsTable th { background-color: #f4f4f4 !important; color: black !important; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ─────────────────────────────────────────────────────────────────
   Badge tipo de competición — Circuito / Urbana
   ───────────────────────────────────────────────────────────────── */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: bold;
    white-space: nowrap;
    vertical-align: middle;
    font-style: normal;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.type-badge.circuito {
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #90caf9;
}

.type-badge.circuito i { color: #1565c0; }

.type-badge.urbana {
    background: #f3e5f5;
    color: #6a1b9a;
    border: 1px solid #ce93d8;
}

.type-badge.urbana i { color: #7b1fa2; }

/* ─────────────────────────────────────────────────────────────────
   Vueltas calculadas en popup de detalle
   ───────────────────────────────────────────────────────────────── */
.calculated-lap {
    background-color: rgba(173, 216, 230, 0.35) !important;
    font-style: italic;
}

.calculated-lap td { color: #1a4f72; }

.calculated-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.72em;
    font-weight: bold;
    font-style: normal;
    background: #ADD8E6;
    border: 1px solid #7bb8d4;
    border-radius: 3px;
    padding: 1px 5px;
    color: #011432;
    vertical-align: middle;
    white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────
   Tooltip del badge de vuelta calculada
   Usa data-tooltip en lugar de title para evitar el tooltip nativo
   del navegador, que se posiciona mal sobre elementos <tr>.
   ───────────────────────────────────────────────────────────────── */
.calculated-badge[data-tooltip] {
    position: relative;
    cursor: help;
}

.calculated-badge[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(1, 20, 50, 0.92);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    font-style: normal;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.calculated-badge[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(1, 20, 50, 0.92);
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────
   Corredor (RegName)
   ───────────────────────────────────────────────────────────────── */
.rider-cell {
    font-style: italic;
    color: #555;
}