/* MMTCI Theme Overrides */

/* 
   Racing Red & Carbon Theme 
   Concept: High-performance, sporty aesthetic. 
   Primary: Bright, classic racing red (#D32F2F).
   Secondary: Deep Charcoal/Carbon (#212121).
   Eliminates all traces of "Gold" or "Pink".
*/
:root {
    /* Brand Colors */
    --mmtci-red: #D32F2F;
    /* Classic Racing Red */
    --mmtci-red-hover: #B71C1C;
    /* Darker Red for hover */
    --mmtci-carbon: #212121;
    /* Deep Charcoal */
    --mmtci-grey-dark: #424242;
    /* Dark Grey */
    --mmtci-grey-light: #F5F5F5;
    /* Ultra Light Grey */
    --mmtci-white: #FFFFFF;

    /* Override System Variables to kill the Green/Gold */
    --color-primary: var(--mmtci-red);
    --color-primary-dark: var(--mmtci-red-hover);
    --color-secondary: var(--mmtci-grey-light);
    --color-secondary-dark: var(--mmtci-grey-dark);
    --color-accent: var(--mmtci-red);
}

/* Header Override */
.mmtci-header {
    background-color: var(--mmtci-carbon);
    border-bottom: 4px solid var(--mmtci-red);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Race Title Bar */
.race-title-bar {
    border-left: 5px solid var(--mmtci-red);
    background-color: var(--mmtci-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    /* Reset layout for clean look */
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 1rem;
}

/* Resetting the angled block layout from race-card.css */
.race-title,
.race-date {
    background-color: transparent !important;
    clip-path: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
}

.race-title span {
    color: var(--mmtci-red);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.5rem;
    /* Ensure size matches previous look */
}

.race-date,
.race-date span {
    color: var(--mmtci-grey-dark) !important;
    font-weight: 600;
    font-size: 1.1rem;
    /* Slightly smaller than title */
    text-transform: uppercase;
}

/* Divider between title and date for visual structure */
.race-title::after {
    content: "|";
    color: #e0e0e0;
    margin-left: 1rem;
    font-weight: 300;
}

/* Buttons (Calendar & Quick Link) */
.btn-calendar-toggle,
.btn-quick-link {
    background-color: var(--mmtci-white);
    color: var(--mmtci-carbon);
    border: 2px solid var(--mmtci-grey-dark);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    box-shadow: none;
    transition: all 0.2s;
}

.btn-calendar-toggle:hover,
.btn-quick-link:hover {
    background-color: var(--mmtci-carbon);
    color: white;
    border-color: var(--mmtci-carbon);
}

/* Tabs */
.race-tabs a {
    background-color: var(--mmtci-grey-dark);
    color: #9e9e9e;
    /* Dimmed text */
    border: none;
    margin-right: 2px;
    border-radius: 4px 4px 0 0;
    font-weight: 700;
    text-transform: uppercase;
}

.race-tabs a.active {
    background-color: var(--mmtci-red);
    color: white;
}

.race-tabs a:hover:not(.active) {
    background-color: var(--mmtci-carbon);
    color: white;
}

/* Calendar Widget */
.calendar-days-header span {
    color: var(--mmtci-carbon);
    font-weight: 800;
}

.cal-day.has-event {
    background-color: white;
    color: var(--mmtci-carbon);
    border: 2px solid var(--mmtci-grey-light);
    font-weight: bold;
}

.cal-day.has-event:hover {
    border-color: var(--mmtci-red);
    color: var(--mmtci-red);
    cursor: pointer;
}

.cal-day.is-selected {
    background-color: var(--mmtci-red) !important;
    color: white !important;
    border-color: var(--mmtci-red);
}

/* Tables */
.race-card-table,
.race-results-table {
    width: 100%;
    table-layout: fixed;
    /* Fix layout to respect widths */
    border-collapse: collapse;
    background-color: white;
    font-size: 0.9rem;
}

.race-card-table thead th,
.race-results-table thead th {
    background-color: var(--mmtci-carbon);
    color: white;
    border-bottom: 3px solid var(--mmtci-red);
    text-transform: uppercase;
    font-size: 0.75rem;
    /* Reduced font size */
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.5rem 0.25rem;
    /* Tighter padding */
    text-align: left;
    white-space: normal;
    /* Allow wrapping */
    vertical-align: bottom;
    /* Align to bottom */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.1;
    /* Tighter line height */
}

.race-card-table td,
.race-results-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #eee;
    color: #333;

    /* Robust Wrapping Logic */
    white-space: normal;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;

    /* Remove global overflow hidden to allow height expansion for wrapping */
    /* overflow: hidden; */

    vertical-align: middle;
    line-height: 1.3;
    font-size: 0.85rem;
}

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

.race-card-table tbody tr:hover,
.race-results-table tbody tr:hover {
    background-color: #EEEEEE;
}

/* Links */
a {
    color: var(--mmtci-red);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    color: var(--mmtci-carbon);
    text-decoration: underline;
}

/* Race Info Box */
.race-info-box {
    background-color: white;
    border: 1px solid var(--mmtci-grey-light);
    border-top: 4px solid var(--mmtci-carbon);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.race-info-text h3 {
    color: var(--mmtci-red);
    border-bottom: 2px solid var(--mmtci-grey-light);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.race-details-line {
    color: var(--mmtci-grey-dark);
}

/* Force single line for short columns (Header & Data) + Prevent Bleeding */
.race-card-table th:nth-child(1),
.race-card-table td:nth-child(1),
/* No */
.race-card-table th:nth-child(2),
.race-card-table td:nth-child(2),
/* Last 5 */
.race-card-table th:nth-child(4),
.race-card-table td:nth-child(4),
/* CO */
.race-card-table th:nth-child(5),
.race-card-table td:nth-child(5),
/* Rtg */
.race-card-table th:nth-child(6),
.race-card-table td:nth-child(6),
/* EA */
.race-card-table th:nth-child(7),
.race-card-table td:nth-child(7),
/* Gears */
.race-card-table th:nth-child(9),
.race-card-table td:nth-child(9),
/* Wt */
.race-card-table th:nth-child(11),
.race-card-table td:nth-child(11)

/* Bar */
    {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.race-card-table th:nth-child(10),
.race-card-table td:nth-child(10) {
    white-space: wrap;
    overflow: visible;
    text-overflow: unset;
}