* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #f8fafc;
}

.header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.btn-back,
.btn-performance {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-back:hover,
.btn-performance:hover {
    background: rgba(255, 255, 255, 0.3);
}

.legend {
    position: absolute;
    top: 100px;
    right: 20px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 999;
    min-width: 180px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #000;
}

.legend-marker.ontime {
    background-color: #22c55e;
}

.legend-marker.late {
    background-color: #eab308;
}

.legend-marker.verylate {
    background-color: #ef4444;
}

.legend-marker.unknown {
    background-color: #6b7280;
}

.legend-item span {
    font-size: 0.875rem;
    color: #374151;
}

#map {
    width: 100%;
    height: calc(100vh - 80px);
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Info Window Styles */
.train-info {
    padding: 0.5rem;
    min-width: 250px;
}

.train-info h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.75rem;
}

.train-info p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.train-info strong {
    font-weight: 600;
    color: #1f2937;
}

.delay-ontime {
    color: #22c55e;
    font-weight: 600;
}

.delay-late {
    color: #eab308;
    font-weight: 600;
}

.delay-verylate {
    color: #ef4444;
    font-weight: 600;
}

.delay-unknown {
    color: #6b7280;
    font-weight: 600;
}

.btn-view-performance {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-view-performance:hover {
    background: #2563eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .legend {
        top: 80px;
        right: 10px;
        padding: 0.75rem;
        min-width: 150px;
    }

    .legend-item {
        gap: 0.5rem;
    }

    .legend-marker {
        width: 16px;
        height: 16px;
    }

    .legend-item span {
        font-size: 0.75rem;
    }

    #map {
        height: calc(100vh - 100px);
    }
}
