/* ============================================================
   H&A Racing — Hoja de estilos compartida
   Consolidada a partir de los <style> repetidos en cada página.
   Incluye ajustes responsive para móvil / tablet / escritorio.
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* === Estilos Generales === */
body {
    background-color: #2b1b33; /* Fondo Lila Oscuro */
    color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Encabezado y Navegación === */
header {
    background-color: #333333; /* Gris oscuro para contraste */
    padding: 15px 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #5a3d69;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: relative;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-brand img {
    max-height: 55px;
    width: auto;
}

header h1 {
    margin: 0;
    font-size: 2.2em;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Botón hamburguesa (oculto en escritorio) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    cursor: pointer;
    order: 2;
}

.nav-toggle span {
    width: 28px;
    height: 3px;
    background-color: #f5f5f5;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
}

nav a {
    color: #f5f5f5;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 600;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #b08cbd; /* Lila claro al pasar el cursor */
}

.btn-login {
    background-color: #5a3d69;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.btn-login:hover {
    background-color: #b08cbd;
    color: #1a1a1a;
}

/* === Estructura Central (usada en index.html) === */
.container {
    display: flex;
    flex: 1;
    padding: 30px 40px;
    gap: 30px;
    box-sizing: border-box;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Páginas de una sola columna (pilotos, información, galería, merch) */
.container.single-column {
    padding: 40px;
}

/* Contenido Principal (Izquierda en index / única columna en otras páginas) */
.main-content {
    flex: 3;
    background-color: rgba(51, 51, 51, 0.85); /* Panel gris */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    min-width: 0; /* evita overflow de flex en móvil */
}

.container.single-column .main-content {
    flex: 1;
    width: 100%;
    padding: 40px;
}

.hero-image {
    width: 100%;
    height: 350px;
    background-color: #222;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #5a3d69;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.copas-container {
    display: flex;
    gap: 20px;
    margin-top: 25px;
}

.copa-card {
    background-color: #222;
    padding: 15px;
    border-radius: 8px;
    flex: 1;
    border-left: 4px solid #b08cbd;
}

.copa-card h3 {
    margin-top: 0;
    color: #b08cbd;
}

/* === Sección Partnerships === */
.partnerships {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px dashed #5a3d69;
    text-align: center;
}

.partnerships h3 {
    color: #b08cbd;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
}

.logos-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logos-container img {
    max-width: 22%; /* Para que entren 4 logos perfectamente en escritorio */
    height: auto;
    max-height: 80px;
    object-fit: contain;
    filter: grayscale(100%) opacity(0.8); /* Escala de grises por defecto */
    transition: all 0.3s ease;
}

.logos-container img:hover {
    filter: grayscale(0%) opacity(1); /* Vuelven a su color original al pasar el mouse */
    transform: scale(1.05); /* Pequeño efecto de zoom */
}

/* Sección de Noticias (Derecha, index.html) */
.sidebar {
    flex: 1;
    background-color: rgba(51, 51, 51, 0.85);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    min-width: 0;
}

.news-item {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #5a3d69;
}

.news-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.news-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
    background-color: #222;
}

.news-item h4 {
    margin: 0 0 5px 0;
    color: #b08cbd;
}

.news-item p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.4;
}

/* === Títulos de sección (pilotos, información, galería, merch) === */
.section-title {
    text-align: center;
    color: #b08cbd;
    font-size: 2.5em;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 0;
    margin-bottom: 40px;
    border-bottom: 2px dashed #5a3d69;
    padding-bottom: 15px;
}

.section-subtitle {
    text-align: center;
    color: #cccccc;
    font-size: 1.1em;
    max-width: 800px;
    margin: 0 auto 40px auto;
    line-height: 1.6;
    border-bottom: 2px dashed #5a3d69;
    padding-bottom: 25px;
}

/* En páginas con subtítulo (galería, merchandising) el título no lleva
   su propio borde: el borde lo aporta el subtítulo inmediatamente debajo. */
.section-title.has-subtitle {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 15px;
}

/* === Grillas fluidas (pilotos / información / galería / merch) ===
   auto-fit + minmax reemplaza la grilla fija de 3 columnas: se adapta
   sola a 1 columna en móvil, 2 en tablet y 3-4 en escritorio, sin
   necesidad de breakpoints manuales para cada grilla. */
.pilotos-grid,
.info-grid,
.galeria-grid,
.merch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
}

.info-grid,
.merch-grid {
    margin-bottom: 40px;
}

/* Tarjeta de cada Piloto */
.piloto-card {
    background-color: #222222;
    border: 2px solid #5a3d69;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(90, 61, 105, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.piloto-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(176, 140, 189, 0.8);
}

.piloto-card img {
    width: 100%;
    height: 300px; /* Altura fija para uniformidad */
    object-fit: cover;
    border-bottom: 3px solid #5a3d69;
}

.piloto-info-box {
    padding: 20px;
    text-align: center;
}

.piloto-info-box h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 1.5em;
    letter-spacing: 1px;
}

.piloto-info-box p {
    margin: 5px 0;
    color: #cccccc;
    font-size: 1em;
    line-height: 1.5;
}

.piloto-info-box .categoria {
    color: #b08cbd;
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
}

/* Tarjeta de foto (información y galería comparten .foto-card,
   se diferencian por el contenedor padre) */
.foto-card {
    background-color: #222222;
    border: 2px solid #5a3d69;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(90, 61, 105, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
}

.foto-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(176, 140, 189, 0.8);
}

.foto-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-grid .foto-card {
    height: 300px;
}

.galeria-grid .foto-card {
    height: 350px;
}

/* === Sección de Texto Largo (información) === */
.info-text-container {
    background-color: #222222;
    padding: 30px 40px;
    border-radius: 10px;
    border-left: 4px solid #b08cbd;
}

.info-text-container p {
    color: #cccccc;
    font-size: 1.1em;
    line-height: 1.8;
    text-align: justify;
    margin-top: 0;
    margin-bottom: 20px;
}

.info-text-container p:last-child {
    margin-bottom: 0;
}

/* === Tarjeta de producto (merchandising) === */
.product-card {
    background-color: #222222;
    border: 2px solid #5a3d69;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(90, 61, 105, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(176, 140, 189, 0.8);
}

.product-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-bottom: 3px solid #5a3d69;
    background-color: #1a1a1a;
}

.product-info {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-info h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 1.4em;
}

.product-info .precio {
    color: #b08cbd;
    font-size: 1.3em;
    font-weight: bold;
    margin: 5px 0;
}

.product-info .talle {
    color: #aaaaaa;
    font-size: 0.95em;
    margin: 5px 0;
}

.product-info .desc {
    color: #cccccc;
    font-size: 0.95em;
    line-height: 1.5;
    margin-top: 15px;
}

/* === Aviso de Disponibilidad y WhatsApp (merchandising) === */
.merch-notice {
    background-color: rgba(90, 61, 105, 0.15);
    border: 1px solid #5a3d69;
    border-left: 5px solid #b08cbd;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    margin-top: 20px;
}

.merch-notice p {
    margin: 0 0 10px 0;
    color: #e0e0e0;
    font-size: 1.1em;
    line-height: 1.6;
}

.merch-notice p:last-child {
    margin-bottom: 0;
}

.merch-notice strong {
    color: #b08cbd;
}

/* === Pie de Página (Footer) === */
footer {
    background-color: #222222;
    padding: 30px 40px;
    border-top: 4px solid #5a3d69;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

footer div {
    flex: 1;
    min-width: 200px;
    margin: 10px;
}

footer h3 {
    color: #b08cbd;
    border-bottom: 1px solid #5a3d69;
    padding-bottom: 10px;
}

footer p, footer a {
    color: #cccccc;
    text-decoration: none;
    line-height: 1.6;
}

footer a:hover {
    color: #ffffff;
}

/* ============================================================
   RESPONSIVE — Tablet (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    header {
        padding: 15px 25px;
    }

    .container {
        padding: 25px;
        gap: 20px;
    }

    .container.single-column {
        padding: 25px;
    }

    .main-content,
    .container.single-column .main-content {
        padding: 25px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .section-title {
        font-size: 2em;
    }
}

/* ============================================================
   RESPONSIVE — Móvil / Tablet vertical (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    header {
        padding: 12px 20px;
    }

    .header-brand img {
        max-height: 42px;
    }

    header h1 {
        font-size: 1.4em;
        letter-spacing: 1px;
    }

    /* Muestra el botón hamburguesa y oculta el menú por defecto */
    .nav-toggle {
        display: flex;
    }

    header nav {
        order: 3;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    header nav.is-open {
        max-height: 400px;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #5a3d69;
    }

    nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .btn-login {
        display: inline-block;
    }

    /* index.html: la barra lateral pasa a ir debajo del contenido principal */
    .container {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .main-content,
    .container.single-column .main-content {
        padding: 20px;
    }

    .hero-image {
        height: 220px;
    }

    .copas-container {
        flex-direction: column;
    }

    .logos-container img {
        max-width: 40%;
    }

    .section-title {
        font-size: 1.6em;
        letter-spacing: 1.5px;
    }

    .section-subtitle {
        font-size: 1em;
    }

    .pilotos-grid,
    .info-grid,
    .galeria-grid,
    .merch-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }

    .info-text-container {
        padding: 20px;
    }

    footer {
        padding: 25px 20px;
        text-align: center;
    }

    footer div {
        min-width: 45%;
    }
}

/* ============================================================
   RESPONSIVE — Móvil pequeño (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    .header-brand {
        gap: 10px;
    }

    .header-brand img {
        max-height: 36px;
    }

    header h1 {
        font-size: 1.15em;
    }

    .hero-image {
        height: 180px;
    }

    .piloto-card img,
    .info-grid .foto-card,
    .galeria-grid .foto-card,
    .product-card img {
        height: 220px;
    }

    .pilotos-grid,
    .info-grid,
    .galeria-grid,
    .merch-grid {
        grid-template-columns: 1fr;
    }

    .logos-container img {
        max-width: 45%;
    }

    footer div {
        min-width: 100%;
        text-align: center;
    }
}
        /* ============================================================
           Estilos exclusivos del Panel del Piloto (sesionpiloto.html)
           Reutilizan la misma paleta de styles.css:
           fondo #2b1b33, paneles #222/#333, borde #5a3d69, acento #b08cbd
           ============================================================ */

        .piloto-wrapper {
            display: flex;
            flex-direction: column;
            gap: 30px;
        }

        /* --- Panel de inicio de sesión --- */
        .login-panel {
            background-color: #222222;
            border: 2px solid #5a3d69;
            border-radius: 12px;
            padding: 35px;
            max-width: 420px;
            width: 100%;
            margin: 0 auto;
            box-shadow: 0 0 15px rgba(90, 61, 105, 0.5);
        }

        .login-panel h3 {
            margin-top: 0;
            color: #b08cbd;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 2px;
            border-bottom: 2px dashed #5a3d69;
            padding-bottom: 15px;
            margin-bottom: 20px;
        }

        .campo {
            margin-bottom: 18px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .campo label {
            color: #cccccc;
            font-size: 0.9em;
            font-weight: 600;
            letter-spacing: 0.5px;
        }

        .campo input,
        .campo select {
            background-color: #1a1a1a;
            border: 1px solid #5a3d69;
            border-radius: 6px;
            padding: 10px 12px;
            color: #f5f5f5;
            font-size: 1em;
            font-family: inherit;
        }

        .campo input:focus,
        .campo select:focus {
            outline: none;
            border-color: #b08cbd;
        }

        .campo input:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .campo-hint {
            color: #999999;
            font-size: 0.8em;
            margin-top: -4px;
        }

        .btn {
            display: inline-block;
            background-color: #5a3d69;
            color: #f5f5f5;
            border: none;
            border-radius: 6px;
            padding: 11px 22px;
            font-size: 1em;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.3s ease;
            font-family: inherit;
        }

        .btn:hover {
            background-color: #b08cbd;
            color: #1a1a1a;
        }

        .btn-full {
            width: 100%;
        }

        .btn-secundario {
            background-color: transparent;
            border: 1px solid #5a3d69;
        }

        .btn-secundario:hover {
            background-color: #333333;
            color: #f5f5f5;
        }

        .btn-pequeno {
            padding: 7px 14px;
            font-size: 0.9em;
        }

        .login-error {
            color: #e07a7a;
            font-size: 0.9em;
            text-align: center;
            margin-top: -8px;
            margin-bottom: 14px;
            display: none;
        }

        /* --- Encabezado del panel (una vez logueado) --- */
        .panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
            background-color: rgba(90, 61, 105, 0.15);
            border: 1px solid #5a3d69;
            border-left: 5px solid #b08cbd;
            border-radius: 8px;
            padding: 20px 25px;
            margin-bottom: 30px;
        }

        .panel-header .saludo {
            font-size: 1.2em;
            color: #f5f5f5;
        }

        .panel-header .saludo strong {
            color: #b08cbd;
        }

        /* --- Panel de datos del piloto --- */
        .piloto-panel {
            background-color: #222222;
            border: 2px solid #5a3d69;
            border-radius: 12px;
            padding: 30px;
            box-shadow: 0 0 15px rgba(90, 61, 105, 0.5);
            margin-bottom: 30px;
        }

        .piloto-panel-titulo {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
            border-bottom: 2px dashed #5a3d69;
            padding-bottom: 15px;
            margin-bottom: 25px;
        }

        .piloto-panel-titulo h3 {
            margin: 0;
            color: #b08cbd;
            text-transform: uppercase;
            letter-spacing: 2px;
        }

        .datos-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 20px;
        }

        .dato-item {
            background-color: #1a1a1a;
            border-radius: 8px;
            padding: 15px 18px;
            border-left: 3px solid #5a3d69;
        }

        .dato-item.bloqueado {
            border-left-color: #444444;
        }

        .dato-item label {
            display: block;
            color: #999999;
            font-size: 0.8em;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 6px;
        }

        .dato-item .dato-valor {
            color: #f5f5f5;
            font-size: 1.15em;
            font-weight: 600;
        }

        .dato-item input,
        .dato-item select {
            width: 100%;
            background-color: #2b1b33;
            border: 1px solid #5a3d69;
            border-radius: 6px;
            padding: 8px 10px;
            color: #f5f5f5;
            font-size: 1em;
            font-family: inherit;
        }

        .dato-item input:disabled,
        .dato-item select:disabled {
            background: transparent;
            border: none;
            padding: 0;
            color: #f5f5f5;
            font-size: 1.15em;
            font-weight: 600;
            appearance: none;
        }

        .badge-numero {
            display: inline-block;
            background-color: #5a3d69;
            color: #f5f5f5;
            font-weight: bold;
            font-size: 1.3em;
            padding: 4px 14px;
            border-radius: 6px;
        }

        .acciones-panel {
            margin-top: 25px;
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        .guardado-msg {
            color: #9ed08c;
            font-size: 0.9em;
            margin-top: 12px;
            display: none;
        }

        /* --- Panel de resultados / tabla --- */
        .tabla-wrap {
            overflow-x: auto;
            border-radius: 8px;
            border: 1px solid #5a3d69;
        }

        table.tabla-resultados {
            width: 100%;
            border-collapse: collapse;
            min-width: 480px;
        }

        table.tabla-resultados thead th {
            background-color: #5a3d69;
            color: #f5f5f5;
            text-align: left;
            padding: 12px 15px;
            font-size: 0.9em;
            text-transform: uppercase;
            letter-spacing: 1px;
            white-space: nowrap;
        }

        table.tabla-resultados tbody td {
            padding: 12px 15px;
            color: #cccccc;
            border-top: 1px solid #3a2a44;
            background-color: #1a1a1a;
        }

        table.tabla-resultados tbody tr:nth-child(even) td {
            background-color: #1f1526;
        }

        table.tabla-resultados tbody tr:hover td {
            background-color: rgba(176, 140, 189, 0.1);
        }

        table.tabla-resultados .col-puntaje,
        table.tabla-resultados .col-accion {
            text-align: center;
            white-space: nowrap;
        }

        table.tabla-resultados tfoot td {
            background-color: #333333;
            color: #b08cbd;
            font-weight: bold;
            font-size: 1.1em;
            padding: 14px 15px;
            border-top: 2px solid #5a3d69;
        }

        .fila-vacia td {
            text-align: center;
            color: #777777;
            font-style: italic;
            padding: 25px 15px !important;
            background-color: #1a1a1a !important;
        }

        .btn-eliminar {
            background: none;
            border: 1px solid #7a4a4a;
            color: #e07a7a;
            border-radius: 5px;
            padding: 5px 10px;
            font-size: 0.85em;
            cursor: pointer;
            font-family: inherit;
        }

        .btn-eliminar:hover {
            background-color: #7a4a4a;
            color: #f5f5f5;
        }

        /* --- Formulario para cargar resultados manualmente --- */
        .form-resultado {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 15px;
            align-items: end;
            margin-top: 25px;
            padding-top: 25px;
            border-top: 2px dashed #5a3d69;
        }

        .form-resultado .campo {
            margin-bottom: 0;
        }

        .form-resultado .campo-btn {
            display: flex;
        }

        .nota-panel {
            color: #999999;
            font-size: 0.85em;
            margin-top: 15px;
            line-height: 1.5;
        }

        .oculto {
            display: none !important;
        }

        /* ============================================================
           RESPONSIVE
           ============================================================ */
        @media (max-width: 768px) {
            .login-panel {
                padding: 25px;
            }

            .piloto-panel {
                padding: 20px;
            }

            .panel-header {
                flex-direction: column;
                align-items: flex-start;
            }

            .acciones-panel {
                flex-direction: column;
            }

            .acciones-panel .btn {
                width: 100%;
                text-align: center;
            }
        }

        @media (max-width: 480px) {
            .badge-numero {
                font-size: 1.1em;
            }

            table.tabla-resultados thead th,
            table.tabla-resultados tbody td,
            table.tabla-resultados tfoot td {
                padding: 10px 8px;
                font-size: 0.9em;
            }
        }

/* ============================================================
   Estilos exclusivos del Panel de Administrador (administrador.html)
   Reutilizan la misma paleta y componentes del panel del piloto.
   ============================================================ */

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.admin-toolbar h3 {
    margin: 0;
}

.badge-estado {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-activo {
    background-color: rgba(158, 208, 140, 0.2);
    color: #9ed08c;
    border: 1px solid #9ed08c;
}

.badge-baja {
    background-color: rgba(224, 122, 122, 0.2);
    color: #e07a7a;
    border: 1px solid #e07a7a;
}

.tabla-pilotos-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #5a3d69;
}

table.tabla-pilotos {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

table.tabla-pilotos thead th {
    background-color: #5a3d69;
    color: #f5f5f5;
    text-align: left;
    padding: 12px 15px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

table.tabla-pilotos tbody td {
    padding: 12px 15px;
    color: #cccccc;
    border-top: 1px solid #3a2a44;
    background-color: #1a1a1a;
    vertical-align: middle;
}

table.tabla-pilotos tbody tr:nth-child(even) td {
    background-color: #1f1526;
}

table.tabla-pilotos tbody tr:hover td {
    background-color: rgba(176, 140, 189, 0.1);
}

table.tabla-pilotos .col-acciones {
    white-space: nowrap;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-mini {
    padding: 5px 10px;
    font-size: 0.8em;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid #5a3d69;
    background: none;
    color: #cccccc;
}

.btn-mini:hover {
    background-color: #5a3d69;
    color: #f5f5f5;
}

.btn-mini.baja {
    border-color: #7a4a4a;
    color: #e07a7a;
}

.btn-mini.baja:hover {
    background-color: #7a4a4a;
    color: #f5f5f5;
}

.btn-mini.alta {
    border-color: #6a9a5a;
    color: #9ed08c;
}

.btn-mini.alta:hover {
    background-color: #4a6a3a;
    color: #f5f5f5;
}

.panel-desplegable {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #5a3d69;
}

.crear-piloto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.crear-piloto-grid .campo-btn-full {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

.panel-resultados-admin {
    margin-top: 15px;
    padding: 20px;
    background-color: #1a1a1a;
    border-radius: 8px;
    border-left: 3px solid #b08cbd;
}

.panel-resultados-admin .titulo-piloto-seleccionado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.panel-resultados-admin .titulo-piloto-seleccionado h4 {
    margin: 0;
    color: #b08cbd;
}

.mensaje-vacio {
    color: #999999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.form-error-inline {
    color: #e07a7a;
    font-size: 0.9em;
    margin-top: 8px;
    display: none;
}

@media (max-width: 768px) {
    .admin-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    table.tabla-pilotos .col-acciones {
        flex-direction: column;
    }
}

/* ============================================================
   Estilos del Panel Unificado (panel.html) — foto carnet,
   posición de carrera y credenciales de administrador.
   ============================================================ */

/* --- Foto carnet: saludo del piloto --- */
.saludo-con-foto {
    display: flex;
    align-items: center;
    gap: 14px;
}

.foto-carnet-mini {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #b08cbd;
    background-color: #1a1a1a;
    flex-shrink: 0;
}

.foto-carnet-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px dashed #5a3d69;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a3d69;
    font-size: 1.4em;
    flex-shrink: 0;
}

/* --- Miniatura en la tabla de pilotos del admin --- */
.foto-carnet-tabla {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #5a3d69;
    background-color: #1a1a1a;
    vertical-align: middle;
}

.foto-carnet-tabla-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px dashed #5a3d69;
    background-color: #1a1a1a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #5a3d69;
    font-size: 1em;
    vertical-align: middle;
}

/* --- Vista previa de foto en los formularios --- */
.foto-preview-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.foto-preview {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #5a3d69;
    background-color: #1a1a1a;
}

.foto-preview-vacia {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px dashed #5a3d69;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a3d69;
    font-size: 1.6em;
    background-color: #1a1a1a;
}

.campo input[type="file"] {
    background-color: #1a1a1a;
    border: 1px solid #5a3d69;
    border-radius: 6px;
    padding: 8px;
    color: #cccccc;
    font-size: 0.9em;
}

/* --- Columna de posición en la tabla de resultados --- */
table.tabla-resultados .col-posicion {
    text-align: center;
    white-space: nowrap;
}

.badge-posicion {
    display: inline-block;
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 20px;
    background-color: rgba(176, 140, 189, 0.15);
    border: 1px solid #b08cbd;
    color: #b08cbd;
    font-weight: bold;
    font-size: 0.9em;
}

.badge-posicion.podio {
    background-color: rgba(158, 208, 140, 0.15);
    border-color: #9ed08c;
    color: #9ed08c;
}

/* --- Panel de credenciales del administrador --- */
.credenciales-panel .datos-grid {
    margin-bottom: 10px;
}

.selector-rol-oculto {
    display: none;
}

@media (max-width: 480px) {
    .saludo-con-foto {
        gap: 10px;
    }

    .foto-carnet-mini,
    .foto-carnet-placeholder {
        width: 42px;
        height: 42px;
    }
}

/* ============================================================
   Pantalla de carga — animación del karting mientras se espera
   la respuesta del servidor (login / verificación de sesión).
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(43, 27, 51, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.oculto {
    display: none;
}

.loading-track {
    position: relative;
    width: min(320px, 78vw);
    height: 56px;
    border-bottom: 3px solid #5a3d69;
    overflow: hidden;
    margin-bottom: 18px;
}

.loading-kart {
    position: absolute;
    top: 0;
    left: 0;
    width: 64px;
    height: auto;
    animation: loadingKartSlide 1.5s ease-in-out infinite alternate;
}

@keyframes loadingKartSlide {
    0% {
        left: 0;
        transform: scaleX(1);
    }
    100% {
        left: calc(100% - 64px);
        transform: scaleX(-1);
    }
}

.loading-text {
    color: #b08cbd;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0;
}

/* ============================================================
   Lightbox — amplía las fotos de la galería al hacer clic.
   ============================================================ */
body.lightbox-abierto {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    background-color: rgba(20, 12, 24, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    z-index: 10000;
    animation: lightboxFade 0.2s ease-out;
}

.lightbox.oculto {
    display: none;
}

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

.lightbox-img {
    max-width: 80vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid #5a3d69;
    animation: lightboxZoom 0.2s ease-out;
}

@keyframes lightboxZoom {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-cerrar {
    position: fixed;
    top: 20px;
    right: 25px;
    background-color: #5a3d69;
    color: #f5f5f5;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background-color 0.2s ease;
}

.lightbox-cerrar:hover {
    background-color: #b08cbd;
    color: #2b1b33;
}

@media (max-width: 480px) {
    .lightbox {
        padding: 20px;
    }

    .lightbox-cerrar {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

/* ============================================================
   Botones "Crear piloto" / "Crear administrador" lado a lado
   ============================================================ */
.botones-crear-perfil {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================================
   Ranking de pilotos (panel de administrador y panel de piloto)
   ============================================================ */
.ranking-subtitulo {
    color: #b08cbd;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.95em;
    margin: 22px 0 12px;
}

.fila-podio-1 td {
    background-color: rgba(176, 140, 189, 0.22) !important;
    border-left: 3px solid #b08cbd;
}

.fila-podio-2 td {
    background-color: rgba(176, 140, 189, 0.13) !important;
}

.fila-podio-3 td {
    background-color: rgba(176, 140, 189, 0.07) !important;
}

.fila-piloto-actual td {
    background-color: rgba(158, 208, 140, 0.16) !important;
    border-left: 3px solid #9ed08c;
    font-weight: 600;
    color: #f5f5f5;
}

.ranking-campeonato-bloque {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px dashed #3a2a44;
}

.ranking-campeonato-bloque h4 {
    color: #b08cbd;
    margin: 0 0 10px;
    font-size: 1em;
}
