/* ============================================
   NGC F1 Races - Estilos v5
   NewGearCars - #E10600
   Rompe el contenedor del tema para ser full-width
   ============================================ */

/* --- Container: rompe el parent del tema --- */
.ngc-f1-container {
    --ngc-red: #E10600;
    --ngc-dark: #111111;
    --ngc-darker: #0a0a0a;
    --ngc-card: #1a1a1a;
    --ngc-card-hover: #222222;
    --ngc-border: #2a2a2a;
    --ngc-text: #ffffff;
    --ngc-text-muted: #888888;
    --ngc-gold: #FFD700;
    --ngc-silver: #C0C0C0;
    --ngc-bronze: #CD7F32;

    background: var(--ngc-dark);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--ngc-text);
    box-sizing: border-box;

    /* Ocupar fila completa si estamos dentro de un grid del tema */
    grid-column: 1 / -1;
    /* Ocupar fila completa si estamos dentro de un flex del tema */
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;

    margin: 0 0 40px 0;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    /* Asegurar que no se apliquen estilos del tema a este bloque */
    float: none !important;
    clear: both;
}

.ngc-f1-container *, .ngc-f1-container *::before, .ngc-f1-container *::after {
    box-sizing: border-box;
}

.ngc-f1-inner {
    padding: 28px 32px;
}

/* ============================================
   GRID PRINCIPAL: 3 COLUMNAS HORIZONTALES
   ============================================ */
.ngc-f1-top-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 16px;
    align-items: stretch;
}

/* ============================================
   TARJETA PRINCIPAL DEL GP (columna 1)
   ============================================ */
.ngc-f1-main-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--ngc-border);
}

.ngc-f1-main-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.ngc-f1-main-card-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 50%, #151515 100%);
    z-index: 0;
}

.ngc-f1-main-card--has-image .ngc-f1-main-card-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ngc-f1-main-card--has-image .ngc-f1-main-card-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.92) 0%,
        rgba(0, 0, 0, 0.5) 40%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

.ngc-f1-main-card:not(.ngc-f1-main-card--has-image) .ngc-f1-main-card-bg::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(225, 6, 0, 0.12) 0%, transparent 70%);
}

.ngc-f1-main-card-bg::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ngc-red);
    z-index: 1;
}

.ngc-f1-main-card-content {
    position: relative;
    z-index: 1;
    padding: 28px;
}

.ngc-f1-main-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.ngc-f1-main-card-round {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--ngc-text);
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 10px;
    border-radius: 4px;
}

.ngc-f1-main-card-flag {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.ngc-f1-main-card-title {
    font-size: 26px;
    font-weight: 900;
    margin: 0 0 6px 0;
    color: var(--ngc-text);
    letter-spacing: 0.5px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.ngc-f1-main-card-circuit {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 4px 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.ngc-f1-main-card-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.ngc-f1-main-card-cta {
    display: inline-block;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ngc-red);
    letter-spacing: 1px;
    transition: transform 0.2s;
}

.ngc-f1-main-card:hover .ngc-f1-main-card-cta {
    transform: translateX(6px);
}

/* ============================================
   CLASIFICACIONES (columnas 2 y 3)
   ============================================ */
.ngc-f1-standings {
    background: var(--ngc-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--ngc-border);
    display: flex;
    flex-direction: column;
}

.ngc-f1-standings-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--ngc-red);
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ngc-border);
}

.ngc-f1-standings-empty {
    color: var(--ngc-text-muted);
    font-size: 13px;
    margin: 0;
}

.ngc-f1-standings-table {
    width: 100%;
    border-collapse: collapse;
    flex: 1;
}

.ngc-f1-standings-table tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ngc-f1-standings-table tr:last-child {
    border-bottom: none;
}

.ngc-f1-standings-table td {
    padding: 8px 4px;
    vertical-align: middle;
    font-size: 13px;
    height: 40px;
}

.ngc-f1-st-pos {
    width: 34px;
    text-align: center;
}

.ngc-f1-st-pos .ngc-f1-pos {
    width: 24px;
    height: 24px;
    font-size: 11px;
    vertical-align: middle;
}

.ngc-f1-st-driver {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
}

.ngc-f1-st-code {
    font-weight: 800;
    font-size: 13px;
    color: var(--ngc-text);
    min-width: 32px;
}

.ngc-f1-st-name {
    color: var(--ngc-text-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ngc-f1-st-pts {
    text-align: right;
    font-weight: 700;
    vertical-align: middle;
    color: var(--ngc-text);
    font-variant-numeric: tabular-nums;
    width: 40px;
}

/* ============================================
   GRANDES PREMIOS ANTERIORES
   ============================================ */
.ngc-f1-past-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--ngc-border);
}

.ngc-f1-past-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--ngc-text-muted);
    margin: 0 0 14px 0;
}

.ngc-f1-past-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

/* Mini tarjeta de GP anterior */
.ngc-f1-mini-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ngc-card);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--ngc-border);
    border-left: 3px solid var(--ngc-border);
}

.ngc-f1-mini-card:hover {
    background: var(--ngc-card-hover);
    border-left-color: var(--ngc-red);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.ngc-f1-mini-flag {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.ngc-f1-mini-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ngc-f1-mini-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ngc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ngc-f1-mini-date {
    font-size: 12px;
    color: var(--ngc-text-muted);
}

/* ============================================
   DETALLE: HEADER CON FOTO
   ============================================ */
.ngc-f1-detail-header {
    position: relative;
    min-height: 260px;
    display: flex;
    align-items: flex-end;
    padding: 36px 32px;
    overflow: hidden;
}

.ngc-f1-detail-header-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 50%, #151515 100%);
    z-index: 0;
}

.ngc-f1-detail-header--has-image .ngc-f1-detail-header-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ngc-f1-detail-header--has-image .ngc-f1-detail-header-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.92) 0%,
        rgba(0, 0, 0, 0.5) 40%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

.ngc-f1-detail-header-bg::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ngc-red);
    z-index: 1;
}

.ngc-f1-detail-header-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.ngc-f1-detail-header-info {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-top: 16px;
}

.ngc-f1-detail-flag {
    font-size: 60px;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.ngc-f1-detail-header-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ngc-f1-detail-round {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--ngc-text-muted);
}

.ngc-f1-detail-title {
    font-size: 32px;
    font-weight: 900;
    margin: 0 0 6px 0;
    color: var(--ngc-text);
}

.ngc-f1-detail-circuit {
    font-size: 15px;
    color: var(--ngc-text-muted);
    margin: 0 0 4px 0;
}

.ngc-f1-detail-date {
    font-size: 14px;
    color: var(--ngc-text-muted);
    opacity: 0.7;
    margin: 0;
}

/* --- Boton volver --- */
.ngc-f1-back {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--ngc-text);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
}

.ngc-f1-back:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--ngc-red);
    color: var(--ngc-red);
}

.ngc-f1-back svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   BADGES
   ============================================ */
.ngc-f1-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

.ngc-f1-badge--upcoming {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ngc-text-muted);
}

.ngc-f1-badge--finished {
    background: #4CAF50;
    color: #fff;
}

.ngc-f1-badge--live {
    background: var(--ngc-red);
    color: #fff;
    position: relative;
    padding-left: 24px;
}

.ngc-f1-badge--live::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: ngc-f1-pulse 1.2s ease-in-out infinite;
}

@keyframes ngc-f1-pulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.4; transform: translateY(-50%) scale(0.7); }
}

/* ============================================
   SECCION EN DIRECTO
   ============================================ */
.ngc-f1-live-section {
    background: rgba(225, 6, 0, 0.06);
    border: 1px solid rgba(225, 6, 0, 0.25);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.ngc-f1-live-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ngc-red);
}

.ngc-f1-live-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ngc-f1-live-session-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--ngc-text);
}

.ngc-f1-live-update {
    font-size: 11px;
    color: var(--ngc-text-muted);
    margin-left: auto;
    font-style: italic;
}

/* ============================================
   BARRA DE SESIONES
   ============================================ */
.ngc-f1-schedule-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    background: var(--ngc-darker);
    border-radius: 8px;
    overflow: hidden;
}

.ngc-f1-schedule-item {
    flex: 1;
    padding: 14px 10px;
    text-align: center;
    background: var(--ngc-card);
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.ngc-f1-schedule-item:hover {
    background: var(--ngc-card-hover);
}

.ngc-f1-schedule-item.active {
    background: var(--ngc-card-hover);
    border-bottom-color: var(--ngc-red);
}

.ngc-f1-schedule-item.active .ngc-f1-schedule-label {
    color: var(--ngc-text);
}

.ngc-f1-schedule-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--ngc-red);
    transition: color 0.2s;
}

.ngc-f1-schedule-date {
    font-size: 11px;
    color: var(--ngc-text-muted);
}

.ngc-f1-schedule-time {
    font-size: 11px;
    color: var(--ngc-text-muted);
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   PANELES DE SESION
   ============================================ */
.ngc-f1-session-panel {
    display: none;
}

.ngc-f1-session-panel.active {
    display: block;
    animation: ngc-f1-fade-in 0.2s ease;
}

.ngc-f1-session-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--ngc-text-muted);
    margin: 0 0 16px 0;
}

@keyframes ngc-f1-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ngc-f1-no-results {
    text-align: center;
    padding: 48px 20px;
    color: var(--ngc-text-muted);
    font-size: 14px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px dashed var(--ngc-border);
}

/* ============================================
   TABLA DE RESULTADOS
   ============================================ */
.ngc-f1-results-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ngc-f1-results-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ngc-f1-results-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--ngc-text-muted);
    border-bottom: 1px solid var(--ngc-border);
    white-space: nowrap;
}

.ngc-f1-results-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.ngc-f1-results-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ngc-f1-results-table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    white-space: nowrap;
}

.ngc-f1-pos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ngc-text-muted);
}

.ngc-f1-pos--1 { background: var(--ngc-gold); color: #000; }
.ngc-f1-pos--2 { background: var(--ngc-silver); color: #000; }
.ngc-f1-pos--3 { background: var(--ngc-bronze); color: #fff; }

.ngc-f1-driver { display: flex; align-items: center; gap: 8px; }
.ngc-f1-driver-code { font-weight: 800; font-size: 14px; color: var(--ngc-text); min-width: 36px; }
.ngc-f1-driver-name { color: var(--ngc-text); font-size: 13px; font-weight: 600; }

/* En desktop: si hay foto, ocultar el codigo (se muestra el nombre completo) */
.ngc-f1-driver-photo + .ngc-f1-driver-code { display: none; }
.ngc-f1-team { color: var(--ngc-text-muted); font-size: 13px; }
.ngc-f1-team-wrap { display: inline-flex; align-items: center; gap: 6px; }

/* Foto de piloto (circulo) */
.ngc-f1-driver-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--ngc-border);
}

.ngc-f1-driver-photo--sm {
    width: 24px;
    height: 24px;
}

/* Logo de equipo (circulo con borde color equipo) */
.ngc-f1-team-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--ngc-border);
}

.ngc-f1-team-logo--sm {
    width: 22px;
    height: 22px;
}

.ngc-f1-time {
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--ngc-text);
}

.ngc-f1-points { font-weight: 700; color: var(--ngc-text); text-align: center; }
.ngc-f1-col-pts { text-align: center; width: 50px; }
.ngc-f1-col-pos { width: 50px; }

.ngc-f1-row--dnf { opacity: 0.5; }
.ngc-f1-row--dnf .ngc-f1-time { color: var(--ngc-red); font-family: inherit; font-size: 12px; }

/* ============================================
   LOADING
   ============================================ */
.ngc-f1-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
}

.ngc-f1-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ngc-border);
    border-top-color: var(--ngc-red);
    border-radius: 50%;
    animation: ngc-f1-spin 0.8s linear infinite;
}

@keyframes ngc-f1-spin {
    to { transform: rotate(360deg); }
}

.ngc-f1-race-detail {
    animation: ngc-f1-fade-in 0.3s ease;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .ngc-f1-top-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .ngc-f1-main-card {
        grid-column: 1 / -1;
        min-height: 280px;
    }
}

@media (max-width: 768px) {
    .ngc-f1-container {
        border-radius: 0;
    }

    .ngc-f1-inner { padding: 20px 16px; }

    .ngc-f1-top-grid {
        grid-template-columns: 1fr;
    }

    .ngc-f1-main-card {
        grid-column: auto;
        min-height: 240px;
    }

    .ngc-f1-detail-header {
        min-height: 200px;
        padding: 24px 16px;
    }

    .ngc-f1-detail-title { font-size: 24px; }
    .ngc-f1-detail-flag { font-size: 44px; }

    .ngc-f1-past-grid { grid-template-columns: 1fr; }

    .ngc-f1-schedule-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ngc-f1-schedule-item { min-width: 65px; padding: 10px 6px; }

    .ngc-f1-driver-name { display: none; }
    .ngc-f1-driver-photo + .ngc-f1-driver-code { display: inline !important; }
    .ngc-f1-col-team, .ngc-f1-team { display: none; }
}

@media (max-width: 480px) {
    .ngc-f1-detail-header { min-height: 160px; padding: 20px 12px; }
    .ngc-f1-detail-title { font-size: 20px; }
    .ngc-f1-main-card-title { font-size: 20px; }
    .ngc-f1-main-card-flag { font-size: 40px; }
    .ngc-f1-inner { padding: 16px 12px; }
}
