/* --- All .page-sub-nav, .racing-sub-menu, .race-title-bar, .race-tabs styles --- */
/* --- are inherited from race-card.css, which is also loaded --- */
/* --- We only need to style the new table --- */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    /* This makes the table scroll horizontally BY DEFAULT */
    background-color: var(--color-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.race-results-table {
    width: 100%;
    min-width: 1600px;
    /* Force scrolling on smaller screens */
    border-collapse: collapse;
}

.race-results-table th {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
}

.race-results-table tbody tr {
    transition: background-color 0.2s ease;
}

.race-results-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.race-results-table tbody tr:hover {
    background-color: #f0f8ff;
    /* Light blue hover */
}

.race-results-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-dark);
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.race-results-table td strong {
    color: #000;
}

.race-results-table td a {
    color: var(--color-primary);
    text-decoration: none;
}

/*
 * Styles for scratched horses in race-results.css
 */
tr.is-scratched {
    /* Fades out the entire row */
    opacity: 0.6;

    /* Adds a line-through to all text in the row */
    text-decoration: line-through;

    /* Optional: A neutral background. Use !important to override inline styles */
    background-color: #f8f8f8 !important;
}

/* * This keeps the "SCR" text itself clean:
 * - Removes the line-through
 * - Makes it red and bold so it stands out
 */
tr.is-scratched td:first-child strong {
    text-decoration: none;
    color: #d9534f;
    /* A shade of red */
    font-weight: bold;
}

/* --- Desktop Table Logic (1200px and up) --- */
@media (min-width: 1200px) {
    .table-wrapper {
        overflow-x: hidden;
        /* Disable horizontal scroll on desktop */
    }

    .race-results-table {
        table-layout: fixed;
        /* Force table to fit 100% width */
        min-width: 100%;
        /* Override the min-width */
    }

    .race-results-table th,
    .race-results-table td {
        white-space: normal;
        /* Allow text to wrap */
        word-break: break-word;
        /* Break long words */
    }

    /* --- Set specific widths for 14 columns --- */

    /* 1. Finish */
    .race-results-table th:nth-child(1),
    .race-results-table td:nth-child(1) {
        width: 5%;
    }

    /* 2. No */
    .race-results-table th:nth-child(2),
    .race-results-table td:nth-child(2) {
        width: 4%;
    }

    /* 3. Horse Name */
    .race-results-table th:nth-child(3),
    .race-results-table td:nth-child(3) {
        width: 15%;
    }

    /* 4. Rating */
    .race-results-table th:nth-child(4),
    .race-results-table td:nth-child(4) {
        width: 5%;
    }

    /* 5. Horse Wt */
    .race-results-table th:nth-child(5),
    .race-results-table td:nth-child(5) {
        width: 6%;
    }

    /* 6. Rider Wt */
    .race-results-table th:nth-child(6),
    .race-results-table td:nth-child(6) {
        width: 6%;
    }

    /* 7. Jockey */
    .race-results-table th:nth-child(7),
    .race-results-table td:nth-child(7) {
        width: 12%;
    }

    /* 8. Act Wt */
    .race-results-table th:nth-child(8),
    .race-results-table td:nth-child(8) {
        width: 6%;
    }

    /* 9. Trainer */
    .race-results-table th:nth-child(9),
    .race-results-table td:nth-child(9) {
        width: 12%;
    }

    /* 10. Bar */
    .race-results-table th:nth-child(10),
    .race-results-table td:nth-child(10) {
        width: 4%;
    }

    /* 11. 800m */
    .race-results-table th:nth-child(11),
    .race-results-table td:nth-child(11) {
        width: 5%;
    }

    /* 12. 400m */
    .race-results-table th:nth-child(12),
    .race-results-table td:nth-child(12) {
        width: 5%;
    }

    /* 13. Finish Time */
    .race-results-table th:nth-child(13),
    .race-results-table td:nth-child(13) {
        width: 8%;
    }

    /* 14. Margin */
    .race-results-table th:nth-child(14),
    .race-results-table td:nth-child(14) {
        width: 7%;
    }
}