/**
 * Formula 1 Data - Frontend Styles
 */

/* ==========================================================================
   Box Base
   ========================================================================== */

.f1-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.f1-header {
    background: linear-gradient(135deg, #e10600 0%, #ff1801 100%);
    color: #fff;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.f1-header-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* ==========================================================================
   Tabelle - Allineamento Perfetto
   ========================================================================== */

.f1-table-wrap {
    overflow-x: auto;
}

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

.f1-table th,
.f1-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.f1-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.f1-table tbody tr:hover {
    background: #fafafa;
}

.f1-table tbody tr:last-child td {
    border-bottom: none;
}

/* Colonne con larghezza fissa */
.f1-table .col-pos {
    width: 50px;
    text-align: center !important;
    font-weight: 700;
}

.f1-table .col-pts,
.f1-table .col-wins,
.f1-table .col-num {
    width: 70px;
    text-align: center !important;
}

.f1-table .col-time {
    width: 100px;
    text-align: center !important;
}

.f1-table .col-date {
    width: 110px;
    text-align: center !important;
}

.f1-table .col-status {
    width: 120px;
    text-align: center !important;
}

.f1-table .col-driver {
    width: 220px;
    text-align: left !important;
}

.f1-table .col-team {
    width: 180px;
    text-align: left !important;
}

.f1-table .col-gp {
    min-width: 200px;
    text-align: left !important;
}

.f1-table .col-circuit {
    min-width: 180px;
    text-align: left !important;
}

/* Posizioni colorate */
.f1-table tbody tr:nth-child(1) .col-pos { color: #ffd700; font-size: 16px; }
.f1-table tbody tr:nth-child(2) .col-pos { color: #c0c0c0; font-size: 16px; }
.f1-table tbody tr:nth-child(3) .col-pos { color: #cd7f32; font-size: 16px; }

/* Punti e Vittorie */
.f1-table .col-pts {
    font-weight: 700;
    color: #e10600;
    font-size: 15px;
}

.f1-table .col-wins {
    color: #28a745;
    font-weight: 600;
}

/* ==========================================================================
   Celle Pilota e Team
   ========================================================================== */

.f1-driver-cell {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
}

.f1-driver-photo {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}

.f1-driver-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.f1-driver-name {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.f1-driver-abbr {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
}

.f1-team-cell {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
}

.f1-team-logo {
    width: 24px;
    height: 24px;
    min-width: 24px;
    object-fit: contain;
}

.f1-team-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Celle GP e Circuito */
.f1-gp-cell {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
}

.f1-flag {
    width: 28px;
    height: 20px;
    min-width: 28px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.f1-circuit-cell {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
}

.f1-circuit-img {
    width: 60px;
    height: 40px;
    min-width: 60px;
    object-fit: contain;
}

/* Status badges */
.f1-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.f1-completed {
    background: #d4edda;
    color: #155724;
}

.f1-scheduled {
    background: #fff3cd;
    color: #856404;
}

.f1-live {
    background: #e10600;
    color: #fff;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Driver Detail Hero */
.f1-driver-hero {
    display: flex;
    align-items: center;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: #fff;
}

.f1-driver-hero-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #e10600;
}

.f1-driver-hero-info {
    margin-left: 30px;
}

.f1-driver-hero-info h2 {
    margin: 0 0 10px;
    font-size: 28px;
}

/* ==========================================================================
   Team
   ========================================================================== */

.f1-team-cell {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
}

.f1-team-col {
    min-width: 150px;
}

.f1-team-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.f1-team-logo-big {
    width: 100px;
    height: 60px;
    object-fit: contain;
}

.f1-team-name {
    font-weight: 500;
}

/* ==========================================================================
   Calendario
   ========================================================================== */

.f1-gp-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.f1-flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
}

.f1-circuit-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.f1-circuit-img {
    width: 60px;
    height: 40px;
    object-fit: contain;
}

.f1-date {
    white-space: nowrap;
    color: #666;
}

.f1-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.f1-completed {
    background: #d4edda;
    color: #155724;
}

.f1-scheduled {
    background: #e2e3e5;
    color: #383d41;
}

.f1-live {
    background: #e10600;
    color: #fff;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==========================================================================
   Race Card (Next/Last Race)
   ========================================================================== */

.f1-race-card {
    padding: 20px;
}

.f1-circuit-preview {
    text-align: center;
    margin-bottom: 20px;
}

.f1-circuit-preview img {
    max-width: 100%;
    height: auto;
    max-height: 200px;
}

.f1-race-info {
    text-align: center;
}

.f1-race-title {
    font-size: 22px;
    margin: 0 0 10px;
    color: #333;
}

.f1-circuit-name,
.f1-race-date,
.f1-circuit-length,
.f1-circuit-laps {
    margin: 5px 0;
    color: #666;
}

.f1-fastest-lap-info {
    margin-top: 15px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 6px;
}

.f1-fastest-lap-info p {
    margin: 0;
    color: #856404;
    font-weight: 500;
}

/* ==========================================================================
   Giri Veloci
   ========================================================================== */

.f1-fastest {
    background: #fff3cd !important;
}

.f1-fastest .f1-time {
    color: #9400d3;
    font-weight: 700;
}

.f1-time {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.f1-pit-time {
    font-family: 'Courier New', monospace;
    color: #e10600;
    font-weight: 600;
}

/* ==========================================================================
   Circuiti Grid
   ========================================================================== */

.f1-circuits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.f1-circuit-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.f1-circuit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.f1-circuit-image {
    max-width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 15px;
}

.f1-circuit-card h4 {
    margin: 0 0 10px;
    color: #333;
    font-size: 16px;
}

.f1-circuit-card p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.f1-lap-record {
    color: #9400d3 !important;
    font-weight: 500;
}

/* Circuit Detail */
.f1-circuit-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 20px;
}

.f1-circuit-img-wrap img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .f1-circuit-content {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Teams Grid
   ========================================================================== */

.f1-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
}

.f1-team-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s;
}

.f1-team-card:hover {
    transform: translateY(-3px);
}

.f1-team-card h4 {
    margin: 15px 0 10px;
    font-size: 15px;
}

.f1-team-card p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.f1-team-wc {
    color: #ffc107 !important;
    font-weight: 600;
}

/* ==========================================================================
   Drivers Grid
   ========================================================================== */

.f1-drivers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px;
}

.f1-driver-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s;
}

.f1-driver-card:hover {
    transform: translateY(-3px);
}

.f1-driver-card h4 {
    margin: 15px 0 5px;
    font-size: 15px;
}

.f1-driver-card p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.f1-driver-wc {
    color: #ffc107 !important;
    font-weight: 600;
}

.f1-driver-number {
    font-size: 24px;
    font-weight: 800;
    color: #e10600;
}

/* ==========================================================================
   Info Table (Details)
   ========================================================================== */

.f1-info-table {
    width: 100%;
    border-collapse: collapse;
}

.f1-info-table th,
.f1-info-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.f1-info-table th {
    width: 40%;
    color: #666;
    font-weight: 500;
    background: #fafafa;
}

.f1-info-table td {
    color: #333;
    font-weight: 600;
}

.f1-info-table tr:last-child th,
.f1-info-table tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   Error & Empty States
   ========================================================================== */

.f1-error {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
}

.f1-error p {
    margin: 0;
}

.f1-empty {
    padding: 40px;
    text-align: center;
    color: #666;
}

/* ==========================================================================
   Dashboard Interattiva
   ========================================================================== */

.f1-dashboard {
    margin-bottom: 20px;
}

.f1-dashboard-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.f1-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f1-control-group label {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.f1-select {
    padding: 10px 35px 10px 15px;
    font-size: 14px;
    border: 2px solid #444;
    border-radius: 6px;
    background: #333;
    color: #fff;
    cursor: pointer;
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.f1-select:hover {
    border-color: #e10600;
}

.f1-select:focus {
    outline: none;
    border-color: #e10600;
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.2);
}

.f1-select option {
    background: #333;
    color: #fff;
    padding: 10px;
}

.f1-select optgroup {
    background: #222;
    color: #999;
    font-weight: 600;
}

.f1-btn {
    padding: 10px 25px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #e10600 0%, #ff1801 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.f1-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(225, 6, 0, 0.4);
}

.f1-btn:active {
    transform: translateY(0);
}

.f1-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.f1-dashboard-content {
    background: #fff;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.f1-dashboard-content .f1-box {
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
}

.f1-loading-placeholder {
    padding: 60px 20px;
    text-align: center;
    color: #666;
    font-size: 16px;
}

.f1-loading-placeholder p {
    margin: 0;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .f1-header {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .f1-table th,
    .f1-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .f1-driver-photo {
        width: 35px;
        height: 35px;
    }
    
    .f1-driver-hero {
        flex-direction: column;
        text-align: center;
    }
    
    .f1-driver-hero-info {
        margin-left: 0;
        margin-top: 20px;
    }
    
    .f1-circuits-grid,
    .f1-teams-grid,
    .f1-drivers-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
        padding: 15px;
    }
    
    /* Dashboard responsive */
    .f1-dashboard-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 15px;
    }
    
    .f1-control-group {
        width: 100%;
    }
    
    .f1-select {
        width: 100%;
        min-width: auto;
    }
    
    .f1-btn {
        width: 100%;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .f1-table {
        font-size: 12px;
    }
    
    .f1-driver-cell {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .f1-team-cell {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================================================
   Dark Mode Support (DISABILITATO - decommentare per attivare)
   ========================================================================== */

/*
@media (prefers-color-scheme: dark) {
    .f1-box {
        background: #1e1e1e;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    
    .f1-table th {
        background: #2d2d2d;
        color: #aaa;
    }
    
    .f1-table td {
        border-color: #333;
    }
    
    .f1-table tbody tr:hover {
        background: #252525;
    }
    
    .f1-driver-name,
    .f1-circuit-card h4,
    .f1-team-card h4,
    .f1-driver-card h4,
    .f1-race-title {
        color: #eee;
    }
    
    .f1-circuit-card,
    .f1-team-card,
    .f1-driver-card {
        background: #2d2d2d;
    }
    
    .f1-info-table th {
        background: #252525;
        color: #aaa;
    }
    
    .f1-info-table td {
        color: #ddd;
    }
    
    .f1-info-table th,
    .f1-info-table td {
        border-color: #333;
    }
}
*/
