/* ===== Variables - Paleta del logo ===== */
:root {
    --ty-black: #1a1a1a;
    --ty-grey: #6b6b6b;
    --ty-grey-light: #f5f5f5;
    --ty-red: #d42b2b;
    --ty-red-dark: #b01e1e;
}

/* ===== Base ===== */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ty-black);
    background: #fafafa;
}

main {
    flex: 1;
}

/* ===== Navbar ===== */
.navbar {
    background: var(--ty-black) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.navbar-brand img {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===== Hero Home ===== */
.hero-home {
    background: linear-gradient(135deg, var(--ty-black) 0%, #2d2d2d 100%);
    color: #fff;
    border-bottom: 4px solid var(--ty-red);
}

.hero-logo {
    max-width: 340px;
    width: 80%;
    height: auto;
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
}

.hero-tagline {
    font-size: 1.15rem;
    color: rgba(255,255,255,.7);
    letter-spacing: .5px;
}

/* ===== Boton pulsante EN DIRECTO ===== */
.pulse-live {
    animation: pulse-red 2s infinite;
    border: none;
    background: var(--ty-red);
    font-weight: 600;
}

.pulse-live:hover {
    background: var(--ty-red-dark);
}

@keyframes pulse-red {
    0%   { box-shadow: 0 0 0 0 rgba(212, 43, 43, .6); }
    70%  { box-shadow: 0 0 0 14px rgba(212, 43, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 43, 43, 0); }
}

/* ===== Section headers ===== */
.section-header {
    border-left: 4px solid var(--ty-grey);
    padding-left: 1rem;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--ty-black);
}

.section-header h2 i {
    margin-right: .4rem;
}

.section-header--live {
    border-left-color: var(--ty-red);
}

.section-header--live h2 {
    color: var(--ty-red);
}

.section-header--next {
    border-left-color: var(--ty-black);
}

.section-header--history {
    border-left-color: var(--ty-grey);
}

.section-header--history h2 {
    color: var(--ty-grey);
}

/* ===== Card Live ===== */
.card-live {
    border: 2px solid var(--ty-red);
    border-radius: .75rem;
    box-shadow: 0 4px 20px rgba(212, 43, 43, .1);
    background: #fff;
}

.badge-live {
    background: var(--ty-red) !important;
    color: #fff;
    font-size: .75rem;
    padding: .35em .7em;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50%      { opacity: .6; }
}

.clasificacion-link {
    border: none !important;
    border-bottom: 1px solid #eee !important;
    padding: .6rem .8rem;
    transition: background .15s;
}

.clasificacion-link:last-child {
    border-bottom: none !important;
}

.clasificacion-link:hover {
    background: var(--ty-grey-light);
}

.waiting-box {
    background: var(--ty-grey-light);
    border-radius: .5rem;
}

/* ===== Cards proximas carreras ===== */
.card-next {
    border: none;
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    border-top: 3px solid var(--ty-black);
    transition: transform .2s, box-shadow .2s;
}

.card-next:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
}

.date-badge {
    background: var(--ty-black);
    color: #fff;
    padding: .3rem .65rem;
    border-radius: .4rem;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== Tabla historico ===== */
.table-history {
    background: #fff;
    border-radius: .5rem;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}

.table-history thead {
    background: var(--ty-black);
    color: #fff;
}

.table-history thead th {
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .75rem 1rem;
    border: none;
}

.table-history tbody tr {
    transition: background .15s;
}

.table-history tbody tr:hover {
    background: var(--ty-grey-light);
}

.table-history tbody td {
    padding: .75rem 1rem;
    border-color: #eee;
}

.table-history .btn-dark {
    background: var(--ty-black);
    border: none;
    font-size: .8rem;
}

.table-history .btn-dark:hover {
    background: var(--ty-red);
}

/* ===== Empty states ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

.empty-state i {
    font-size: 2.5rem;
    color: #ccc;
    display: block;
    margin-bottom: .5rem;
}

.empty-state p {
    color: var(--ty-grey);
    margin: 0;
    font-size: .95rem;
}

/* ===== Footer ===== */
.footer-custom {
    background: var(--ty-black);
    border-top: 3px solid var(--ty-red);
}

.footer-custom img {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===== Clasificacion viewer ===== */
.clasificacion-content {
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.clasificacion-content table {
    width: 100%;
}

/* ===== Bannerola / Imagen de carrera ===== */

/* Banner dentro de card-live (carrera en curso) */
.card-banner {
    border-radius: .75rem .75rem 0 0;
    overflow: hidden;
    background: var(--ty-grey-light);
    text-align: center;
}

.card-banner img {
    max-height: 160px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    padding: .75rem;
}

/* Imagen en tarjetas de proximas carreras */
.card-img-top-wrap {
    overflow: hidden;
    background: var(--ty-grey-light);
    text-align: center;
    border-bottom: 1px solid #eee;
}

.card-img-top-wrap .card-img-top {
    max-height: 110px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    padding: .5rem;
}

/* Miniatura en tabla historico */
.img-history {
    max-height: 36px;
    max-width: 60px;
    object-fit: contain;
    border-radius: 3px;
}

/* Banner cabecera en pagina de detalle de carrera */
.carrera-header-banner {
    background: var(--ty-grey-light);
    border-radius: .5rem;
    overflow: hidden;
    text-align: center;
    padding: 1rem;
}

.carrera-header-banner img {
    max-height: 180px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* ===== Generic card shadow ===== */
.card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
