/* ==========================================================================
   1. VARIABLES LOCALES & CONTENEDOR PRINCIPAL
   ========================================================================== */
:root {
    --brand: #9000bf;
    --brand-glow: rgba(144, 0, 191, 0.5);
    --card-bg: rgba(144, 0, 191, 0.04);
    --card-border: rgba(144, 0, 191, 0.2);
}

.drivers-section {
    padding: 0 60px 100px;
}

.drivers-grid {
    max-width: 1280px;
    margin: 28px auto 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ==========================================================================
   2. ESTRUCTURA DE LA TARJETA (CARD & WRAPPER)
   ========================================================================== */
.driver-card-wrapper {
    position: relative;
    margin-top: 22px;
    transition: transform 0.3s ease;
}

.driver-card-wrapper:has(.driver-card:hover) {
    transform: translateY(-4px);
}

.driver-status-tag {
    position: absolute;
    top: -14px;
    left: 20px;
    background: rgba(30, 8, 38, 0.95);
    border: 1px solid rgba(144, 0, 191, 0.6);
    color: #fff;
    font-family: "Roboto Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 7px 16px;
    border-radius: 6px;
    box-shadow:
        0 0 8px var(--brand-glow),
        0 0 16px rgba(144, 0, 191, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.driver-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.driver-card:hover {
    border-color: rgba(144, 0, 191, 0.5);
    box-shadow: 0 10px 30px rgba(144, 0, 191, 0.15);
}

/* ==========================================================================
   3. FOTO / AVATAR
   ========================================================================== */
.driver-photo {
    height: 160px;
    background: #111013;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.driver-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.driver-photo-fallback {
    font-size: 44px;
    color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   4. INFORMACIÓN DEL PILOTO
   ========================================================================== */
.driver-info {
    padding: 18px;
}

.driver-info-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.driver-name {
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.driver-country {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-family: "Roboto Mono", monospace;
    margin-top: 4px;
}

.license-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.flag {
    font-size: 16px;
    line-height: 1;
}

.safety-rating {
    font-size: 10px;
    font-family: "Roboto Mono", monospace;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
}

/* Badges de Licencia iRacing */
.license-badge {
    display: inline-flex;
    align-items: center;
    font-family: "Roboto Mono", monospace;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 5px;
    line-height: 1;
    flex-shrink: 0;
}

.license-badge.rookie { background: #fc0706; color: #ffdcdc; }
.license-badge.d      { background: #fc8a27; color: #4a2c0a; }
.license-badge.c      { background: #ffe920; color: #4a4306; }
.license-badge.b      { background: #33cc33; color: #0a3d0a; }
.license-badge.a      { background: #0153db; color: #dbe9ff; }
.license-badge.pro    { background: #000000; color: #ff9838; border: 1px solid #ff9838; }
.license-badge.wc     { background: #000000; color: #fdfdfd; border: 1px solid #ffffff; }

/* ==========================================================================
   5. FILA DE ESTADÍSTICAS (CLASE & IRATING)
   ========================================================================== */
.driver-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.driver-car-class {
    font-size: 11px;
    font-weight: 700;
    font-family: "Roboto Mono", monospace;
    color: var(--brand);
    background: rgba(144, 0, 191, 0.12);
    border: 1px solid rgba(144, 0, 191, 0.4);
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.driver-irating {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.driver-irating-label {
    color: var(--brand);
    font-size: 11px;
    font-family: "Roboto Mono", monospace;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.driver-irating-value {
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    font-family: "Roboto Mono", monospace;
}

.driver-irating-value.loading {
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
    letter-spacing: 2px;
}

/* ==========================================================================
   6. RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 900px) {
    .drivers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .drivers-section {
        padding: 0 20px 60px;
    }
    
    .drivers-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   3. FOTO / AVATAR
   ========================================================================== */
.driver-photo {
    position: relative;
    height: 220px;
    width: 100%;
    background: #0f0b14;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.driver-photo img,
.driver-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%; /* Centra mejor el rostro y torso */
    display: block;
    transition: transform 0.35s ease;
}

.driver-card:hover .driver-photo img,
.driver-card:hover .driver-photo-img {
    transform: scale(1.03);
}

/* Sombra inferior sutil sin tapar la cara */
.driver-photo::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px; /* Reducido para no cubrir la barbilla ni el cuello */
    background: linear-gradient(to top, rgba(14, 8, 18, 0.9), transparent);
    pointer-events: none;
}

.driver-photo-fallback {
    font-size: 44px;
    color: rgba(255, 255, 255, 0.12);
}