@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Montserrat:wght@400;500;600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    background-color: #080808; 
}

:root {
    --fondo: #080808; /* Minimalista oscuro */
    --tarjeta: #121212; /* Paneles limpios */
    --acento: #007BFF; /* Mantenemos la variable de acento */
    --acento-hover: #0056b3; 
    --secundario: #e6cc00; 
    --texto: #e5e5e5; /* Texto limpio */
    --texto-secundario: #888888;
    --borde: #222222;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--fondo);
    color: var(--texto);
    margin: 0;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* --- TIPOGRAFÍA RACING --- */
h1, h2, h3, .logo, button {
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    font-weight: 500;
}

/* --- NAVEGACIÓN --- */
nav { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 20px 5%; 
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--borde);
    position: sticky; top: 0; z-index: 100; 
}
.logo { display: flex; align-items: center; cursor: pointer; }
.logo-img { height: 75px; width: auto; max-width: 300px; object-fit: contain; transition: 0.3s; }
.logo:hover .logo-img { transform: scale(1.05); filter: drop-shadow(0 4px 10px rgba(0, 123, 255, 0.3)); }
.menu-icon { font-size: 1.5rem; cursor: pointer; transition: 0.3s; color: var(--texto); }
.menu-icon:hover { color: var(--texto); transform: scale(1.1); }

/* --- ESTADO DE SESIÓN NAVEGACIÓN (HUD) --- */
.nav-user-status {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(18, 18, 18, 0.85);
    padding: 6px 20px;
    border-radius: 50px;
    border: 1px solid var(--borde);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    
    /* Posicionamiento central absoluto para escritorio */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: dropDownHUD 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes dropDownHUD {
    0% { opacity: 0; top: -30px; }
    100% { opacity: 1; top: 50%; }
}

.status-info { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.conexion-text { font-size: 0.65rem; color: #4ade80; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.conexion-text i { font-size: 0.55rem; animation: blink 2s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.piloto-text { font-size: 0.95rem; font-weight: bold; color: var(--texto); font-family: 'Montserrat', sans-serif; }

.nav-tag { font-size: 0.65rem; padding: 3px 8px; border-radius: 12px; font-weight: bold; border: 1px solid var(--borde); font-family: 'Montserrat', sans-serif; text-transform: uppercase; letter-spacing: 1px; }
.nav-tag.admin { background: rgba(217, 83, 79, 0.1); color: #d9534f; border-color: #d9534f; }
.nav-tag.miembro { background: rgba(255, 255, 255, 0.1); color: var(--texto-secundario); border-color: var(--texto-secundario); }
.nav-tag.pendiente { background: rgba(230, 204, 0, 0.1); color: var(--secundario); border-color: var(--secundario); }

.btn-desconectar { background: transparent; color: var(--texto-secundario); border: none; padding: 5px; cursor: pointer; transition: 0.3s; width: auto; font-size: 1.1rem; }
.btn-desconectar:hover { color: #d9534f; transform: scale(1.1); box-shadow: none; background: transparent; }

/* Adaptación móvil del HUD de conexión */
@media (max-width: 850px) {
    .nav-user-status {
        position: static;
        transform: none;
        animation: dropDownMobile 0.5s ease forwards;
        padding: 5px 12px;
        gap: 8px;
    }
    @keyframes dropDownMobile { 0% { opacity: 0; transform: translateY(-10px); } 100% { opacity: 1; transform: translateY(0); } }
    .conexion-text { display: none; }
    .logo-img { height: 45px; }
}

/* --- CONTROLES DE NAVEGACIÓN --- */
.nav-controls { display: flex; align-items: center; gap: 20px; }
.auth-buttons-mini { display: flex; gap: 10px; }
.btn-mini { width: auto; padding: 8px 18px; font-size: 0.85rem; border-radius: 6px; }
.btn-mini-outline { background: transparent; border: 1px solid var(--texto-secundario); color: var(--texto); border-radius: 6px; }
.btn-mini-outline:hover { background: var(--texto); color: var(--fondo); border-color: var(--texto); }

/* --- MENÚ LATERAL --- */
.sidebar { position: fixed; right: -300px; top: 0; width: 280px; height: 100%; background: rgba(11, 12, 16, 0.95); backdrop-filter: blur(10px); z-index: 200; display: flex; flex-direction: column; padding: 40px 20px; transition: 0.4s ease-in-out; border-left: 1px solid var(--borde); }
.sidebar.active { right: 0; }
.sidebar a { text-decoration: none; color: var(--texto-secundario); font-size: 1.1rem; font-family: 'Montserrat', sans-serif; font-weight: 500; margin: 5px 0; padding: 12px 20px; border-radius: 8px; transition: 0.3s; display: flex; align-items: center; gap: 15px; }
.sidebar a:hover { background: rgba(255, 255, 255, 0.05); color: var(--texto); transform: translateX(-5px); }
.close-btn { align-self: flex-end; font-size: 2rem; cursor: pointer; color: var(--texto-secundario); margin-bottom: 20px; }
.close-btn:hover { color: var(--acento); }
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: none; z-index: 150; }
.overlay.active { display: block; }

/* --- CONTENIDO PRINCIPAL --- */
.contenedor { max-width: 1100px; margin: 40px auto; padding: 0 20px; }
.tab-content { display: none; animation: slideUp 0.5s ease forwards; opacity: 0; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- BOTONES ESTILO COMPETICIÓN (Cortados) --- */
button { 
    width: 100%; padding: 14px 20px; 
    background: var(--acento); color: var(--texto); 
    border: none; font-weight: 700; cursor: pointer; transition: 0.3s; 
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
}
button:hover { background: var(--acento-hover); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); }
button.btn-secundario { background: transparent; border: 1px solid var(--acento); color: var(--acento); border-radius: 8px; }
button.btn-secundario:hover { background: var(--acento); color: var(--texto); }
button.btn-peligro { background: rgba(217, 83, 79, 0.1); border: 1px solid #d9534f; color: #d9534f; border-radius: 8px; }
button.btn-peligro:hover { background: #d9534f; color: var(--texto); }
button.btn-alerta { background: var(--secundario); color: #000; }
button.btn-alerta:hover { background: #fff; }

/* --- PANELES HUD (Formularios y Cajas) --- */
.panel-racing {
    background: var(--tarjeta);
    padding: 40px;
    margin: 0 auto 30px;
    border: 1px solid var(--borde);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.panel-racing h3 { color: var(--texto); margin-top: 0; font-size: 1.5rem; border-bottom: 1px solid var(--borde); padding-bottom: 10px; }

/* Formularios */
input, select, textarea { 
    width: 100%; padding: 14px; margin: 10px 0 20px; 
    background: rgba(255,255,255,0.03); border: 1px solid var(--borde); color: var(--texto); 
    font-family: 'Inter', sans-serif; font-size: 1rem;
    border-radius: 8px; box-sizing: border-box; transition: 0.3s;
}
input:focus { outline: none; border-color: var(--acento); background: rgba(255,255,255,0.06); }
select option { background-color: var(--tarjeta); color: var(--texto); }

/* --- CARRUSEL --- */
.swiper { 
    width: 100vw; 
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    height: 550px; 
    overflow: hidden; 
}
.swiper-slide img { 
    width: 100%; height: 100%; object-fit: cover; 
    filter: grayscale(30%) contrast(120%); 
    /* Fade superior e inferior aplicado directo a la foto */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}
.slide-info { 
    position: absolute; bottom: 60px; 
    left: max(20px, calc(50% - 530px)); /* Mantiene la alineación perfecta con los otros paneles */
    background: rgba(0,0,0,0.8); padding: 20px 30px; border-radius: 12px; backdrop-filter: blur(10px); 
}
.slide-info h2 { font-size: 2.2rem; margin: 0; color: var(--texto); }
.slide-info p { color: var(--texto-secundario); font-size: 1.1rem; margin: 5px 0 0; font-family: 'Inter', sans-serif; }

/* --- SECCIÓN PILOTOS --- */
.grid-pilotos { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-top: 20px; }
.card-piloto { background: var(--tarjeta); overflow: hidden; text-align: center; padding-bottom: 25px; border: 1px solid var(--borde); transition: 0.3s; border-radius: 16px; }
.card-piloto:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(0,0,0,0.3); border-color: #333; }
.img-piloto { width: 100%; height: 200px; background: #000; object-fit: cover; margin-bottom: 15px; filter: contrast(110%); }
.card-piloto h3 { margin: 10px 0 5px; font-size: 1.5rem; color: var(--texto); }
.card-piloto p { color: var(--texto-secundario); margin: 0; font-size: 1rem; }
.rol-tag { display: inline-block; margin-top: 15px; padding: 6px 18px; background: rgba(255,255,255,0.05); color: var(--texto); font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 0.85rem; letter-spacing: 1px; border-radius: 20px; border: 1px solid var(--borde); }
.cat-tag { display: inline-block; padding: 6px 18px; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 0.85rem; letter-spacing: 1px; border-radius: 20px; border: 1px solid var(--borde); }
.cat-tag.lmp2 { background: rgba(0, 123, 255, 0.1); color: var(--acento); border-color: var(--acento); }
.cat-tag.gt3 { background: rgba(230, 204, 0, 0.1); color: var(--secundario); border-color: var(--secundario); }

/* --- CALENDARIO --- */
.calendario-img { 
    width: 100%; 
    max-width: 1000px; 
    display: block; 
    margin: 30px auto; 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    border-radius: 16px; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.4); 
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
}
.calendario-img:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 123, 255, 0.15);
    border-color: rgba(0, 123, 255, 0.4);
}

/* --- CABECERAS DE SECCIÓN --- */
header { text-align: center; margin-bottom: 50px; }
header h2 { color: var(--texto); font-size: 2.5rem; margin: 0 0 10px; font-weight: 600; }
header p { color: var(--texto-secundario); font-size: 1.1rem; margin: 0; font-family: 'Inter', sans-serif; }

/* --- CONTADOR EVENTOS --- */
.countdown-timer {
    background: rgba(0,0,0,0.4);
    padding: 10px 15px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-align: center;
    margin: 15px 0;
    border: 1px dashed var(--borde);
    letter-spacing: 1px;
}

/* Utilidades dinámicas para JS */
.telemetria-data { background: rgba(0,0,0,0.3); padding: 20px; border: 1px solid var(--borde); margin: 15px 0; border-radius: 8px; }
.telemetria-data p { margin: 0 0 10px; font-weight: 600; color: var(--texto); }
.telemetria-data ul { list-style: none; padding: 0; margin: 0; }
.telemetria-data li { padding: 8px 10px; border-bottom: 1px solid var(--borde); font-family: 'Inter', sans-serif; color: var(--texto-secundario); }
.telemetria-data li:last-child { border-bottom: none; }
.telemetria-data i { color: var(--acento); width: 20px; }

/* --- PANEL DE ADMINISTRACIÓN --- */
.admin-table-container {
    overflow-x: auto;
    background: var(--tarjeta);
    border-radius: 12px;
    border: 1px solid var(--borde);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
}
.admin-table th {
    padding: 15px 10px;
    border-bottom: 2px solid var(--borde);
    color: var(--texto-secundario);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.admin-table td {
    padding: 15px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-select {
    width: 100%;
    padding: 10px;
    margin: 0;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--borde);
    color: var(--texto);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}
.admin-table select option { background: var(--tarjeta); color: var(--texto); }

/* --- SECCIÓN GARAJE --- */
.vehiculo-garaje {
    display: flex;
    gap: 30px;
    align-items: center;
    background: var(--tarjeta);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--borde);
    margin-bottom: 25px;
    transition: 0.3s;
}
.vehiculo-garaje:hover {
    border-color: #333;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.vehiculo-garaje:last-child {
    margin-bottom: 0;
}
.vehiculo-img {
    width: 250px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--borde);
}
.vehiculo-info h3 { margin-top: 0; margin-bottom: 10px; color: var(--texto); font-size: 1.6rem; border-bottom: none; padding-bottom: 0; }
.vehiculo-info p { color: var(--texto-secundario); margin-bottom: 10px; font-size: 0.95rem; }

@media (max-width: 700px) {
    .vehiculo-garaje { flex-direction: column; text-align: center; }
    .vehiculo-img { width: 100%; max-width: 400px; height: auto; }
}

/* --- FOOTER GLOBAL --- */
.footer-global {
    background: var(--tarjeta);
    border-top: 1px solid var(--borde);
    padding: 60px 5% 20px;
    margin-top: 60px;
    font-family: 'Inter', sans-serif;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.footer-brand p {
    color: var(--texto-secundario);
    margin-top: 15px;
    font-size: 0.95rem;
}

.footer-logo { max-width: 220px; height: auto; display: block; filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.5)); }

.social-icons { display: flex; gap: 15px; margin-top: 25px; }
.social-icons a { color: var(--texto-secundario); font-size: 1.5rem; transition: 0.3s; }
.social-icons a:hover { color: var(--acento); transform: translateY(-4px); }

.footer-links h4 { color: var(--texto); font-family: 'Montserrat', sans-serif; font-size: 1.2rem; margin-top: 0; margin-bottom: 20px; letter-spacing: 1px; }
.footer-links ul { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { color: var(--texto-secundario); text-decoration: none; transition: 0.3s; display: inline-block; font-size: 0.95rem; }
.footer-links a:hover { color: var(--acento); transform: translateX(5px); }

.footer-bottom {
    max-width: 1100px;
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--borde);
    text-align: center;
    color: var(--texto-secundario);
    font-size: 0.85rem;
}
