/* ============================================
   F1 Calendar Page Styles
   Dedicated stylesheet for calendar template
   ============================================ */

/* Header */
.calendar-header {
    margin-bottom: 20px;
}

.calendar-header h1 {
    font-size: 28px;
    font-weight: bold;
    color: #e0e0e0;
    margin: 0 0 10px 0;
}

.calendar-header .last-updated {
    font-size: 12px;
    color: #888;
    margin: 0;
}

.calendar-header .timezone-info {
    font-size: 13px;
    color: #aaa;
    margin: 8px 0 0 0;
}

.calendar-header .timezone-info span {
    color: #e10600;
    font-weight: bold;
}

/* Next Race Banner */
.next-race-banner {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid #333;
    z-index: 1;
}

.next-race-banner::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 100%;
    background: rgba(225, 6, 0, 0.1);
    transform: skewX(-15deg);
    z-index: -1;
}

.next-race-label {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #e10600;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.next-race-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.next-race-flag img {
    width: 48px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.next-race-info {
    flex: 1;
    min-width: 200px;
}

.next-race-round {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.next-race-name {
    display: block;
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 4px;
}

.next-race-circuit {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.next-race-date {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    background: rgba(225, 6, 0, 0.2);
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(225, 6, 0, 0.3);
}

/* Next Race Sessions */
.next-race-sessions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.next-race-sessions .session-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 14px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    border: 1px solid #333;
}

.next-race-sessions .session-name {
    font-size: 10px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
}

.next-race-sessions .session-time {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    margin-top: 4px;
}

/* Sprint Badge */
.sprint-badge {
    display: inline-block;
    background: #ff6b00;
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Stats */
.calendar-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-item {
    background-color: #2a2a2a;
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
    flex: 1;
    min-width: 100px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #e10600;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Table Container */
.calendar-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #1a1a1a;
    border-radius: 8px;
}

/* Table Styles */
.calendar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.calendar-table th,
.calendar-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.calendar-table th {
    background-color: #2a2a2a;
    color: #e0e0e0;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-table tbody tr {
    transition: background-color 0.2s ease;
}

.calendar-table tbody tr:nth-child(odd) {
    background-color: #222;
}

.calendar-table tbody tr:nth-child(even) {
    background-color: #1a1a1a;
}

.calendar-table tbody tr:hover {
    background-color: #333;
}

.calendar-table td {
    color: #e0e0e0;
}

/* Completed races - muted style */
.race-row.status-completed {
    opacity: 0.6;
}

.race-row.status-completed:hover {
    opacity: 0.8;
}

/* Current race - highlighted */
.race-row.status-current {
    background-color: rgba(225, 6, 0, 0.15) !important;
    border-left: 3px solid #e10600;
}

/* Round Column */
.calendar-table .col-round {
    width: 70px;
    text-align: center;
}

.round-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #3a3a3a;
    font-weight: bold;
    font-size: 14px;
    color: #e0e0e0;
}

.race-row.status-current .round-badge {
    background-color: #e10600;
    color: #ffffff;
}

/* Race Column */
.calendar-table .col-race {
    min-width: 180px;
}

.race-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.race-flag {
    width: 28px;
    height: auto;
    border-radius: 2px;
}

.race-name {
    font-weight: bold;
    color: #fff;
}

/* Circuit Column */
.calendar-table .col-circuit {
    color: #aaa;
    font-size: 13px;
}

/* Date Column */
.calendar-table .col-date {
    white-space: nowrap;
    font-weight: 500;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.completed {
    background-color: #2a5d2a;
    color: #7fff7f;
}

.status-badge.current {
    background-color: #e10600;
    color: #ffffff;
    animation: pulse 2s infinite;
}

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

/* Race Card List Layout */
.calendar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.race-card {
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.race-card.status-completed {
    opacity: 0.7;
}

.race-card.status-completed:hover {
    opacity: 0.9;
}

.race-card.status-current {
    border: 2px solid #e10600;
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.2);
}

/* Highlight first upcoming race if no current race exists */
.calendar-list:not(:has(.race-card.status-current)) .race-card.status-upcoming:first-of-type {
    border: 2px solid #e10600;
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.2);
}

.race-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.race-card-header:hover {
    background-color: #252525;
}

.race-round {
    flex-shrink: 0;
}

.round-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #333;
    font-weight: bold;
    font-size: 14px;
    color: #e0e0e0;
}

.race-card.status-current .round-number {
    background-color: #e10600;
    color: #fff;
}

.race-flag {
    flex-shrink: 0;
}

.race-flag img {
    width: 36px;
    height: auto;
    border-radius: 3px;
}

.race-details {
    flex: 1;
    min-width: 0;
}

.race-name {
    display: block;
    font-weight: bold;
    font-size: 16px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.race-circuit {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.race-date-wrapper {
    flex-shrink: 0;
    text-align: right;
}

.race-date {
    display: block;
    font-weight: 600;
    color: #e0e0e0;
    font-size: 14px;
}

.race-expand {
    flex-shrink: 0;
    padding: 4px;
}

.expand-icon {
    width: 20px;
    height: 20px;
    color: #666;
    transition: transform 0.3s ease;
}

.race-card.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Race Sessions Panel */
.race-sessions {
    display: none;
    background-color: #222;
    padding: 16px;
    border-top: 1px solid #333;
}

.race-card.expanded .race-sessions {
    display: block;
}

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

.sessions-table th,
.sessions-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.sessions-table th {
    color: #888;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.sessions-table td {
    color: #e0e0e0;
}

.session-row.highlight {
    background-color: rgba(225, 6, 0, 0.1);
}

.session-row.highlight .session-name-cell {
    font-weight: bold;
    color: #e10600;
}

.session-name-cell {
    font-weight: 500;
}

.session-date {
    color: #aaa;
}

.session-time-cell {
    font-weight: bold;
    color: #fff;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-top: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.completed {
    background-color: #2a5d2a;
    color: #7fff7f;
}

.status-badge.current {
    background-color: #e10600;
    color: #ffffff;
    animation: pulse 2s infinite;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .calendar-header h1 {
        font-size: 22px;
    }
    
    .next-race-banner {
        padding: 16px;
    }
    
    .next-race-name {
        font-size: 18px;
    }
    
    .next-race-date {
        width: 100%;
        text-align: center;
        margin-top: 12px;
    }
    
    .next-race-sessions {
        justify-content: center;
    }
    
    .calendar-stats {
        gap: 8px;
    }
    
    .stat-item {
        padding: 12px 16px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .race-card-header {
        gap: 12px;
        padding: 12px;
    }
    
    .round-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .race-flag img {
        width: 28px;
    }
    
    .race-name {
        font-size: 14px;
    }
    
    .race-circuit {
        font-size: 12px;
    }
    
    .race-date {
        font-size: 12px;
    }
    
    .sessions-table th,
    .sessions-table td {
        padding: 8px 10px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .race-circuit {
        display: none;
    }
    
    .race-card-header {
        gap: 10px;
        padding: 10px;
    }
    
    .round-number {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    
    .race-flag img {
        width: 24px;
    }
    
    .race-name {
        font-size: 13px;
    }
    
    .race-date {
        font-size: 11px;
    }
    
    .expand-icon {
        width: 16px;
        height: 16px;
    }
    
    .sessions-table th,
    .sessions-table td {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .sprint-badge {
        font-size: 8px;
        padding: 1px 4px;
    }
}

/* Circuit Information */
.circuit-info {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    border: 1px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.circuit-info h3 {
    font-size: 18px;
    font-weight: 700;
    color: #e10600;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #e10600;
    padding-bottom: 8px;
}

.circuit-info-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

.circuit-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.circuit-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.circuit-stat:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(225, 6, 0, 0.3);
    transform: translateY(-2px);
}

.circuit-stat-wide {
    grid-column: span 2;
}

.stat-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #e0e0e0;
    line-height: 1.2;
}

.stat-driver {
    font-size: 12px;
    font-weight: 500;
    color: #aaa;
    margin-top: 4px;
}

.circuit-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 280px;
}

.track-map {
    width: 85%;
    max-width: 85%;
    height: auto;
    filter: brightness(0) invert(1) opacity(0.9);
    transition: all 0.3s ease;
}

.track-map:hover {
    filter: brightness(0) invert(1) opacity(1);
    transform: scale(1.05);
}

.track-map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
    width: 100%;
    height: 200px;
}

.track-map-placeholder svg {
    width: 100px;
    height: 100px;
}

@media screen and (max-width: 1024px) {
    .circuit-info-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .circuit-layout {
        order: -1;
        max-width: 400px;
        margin: 0 auto;
    }
}

@media screen and (max-width: 768px) {
    .circuit-info {
        padding: 20px;
    }
    
    .circuit-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .circuit-stat-wide {
        grid-column: span 1;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .circuit-layout {
        min-height: 200px;
        padding: 16px;
    }
}

@media screen and (max-width: 480px) {
    .circuit-info {
        padding: 16px;
    }
    
    .circuit-info h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    .circuit-stats {
        gap: 12px;
    }
    
    .circuit-stat {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .circuit-layout {
        min-height: 150px;
        padding: 12px;
        width: 100%;
        max-width: 100%;
    }
}
