/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 20px;
}

.nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.json-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
}

.json-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.last-updated {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Summary stats */
.summary {
    display: flex;
    justify-content: space-around;
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.5em;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Table */
.trains-table {
    width: 100%;
    border-collapse: collapse;
}

.trains-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.trains-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trains-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

.trains-table tbody tr:hover {
    background-color: #f8f9fa;
}

.trains-table td {
    padding: 16px;
}

/* Row states */
.trains-table tr.stuck {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.trains-table tr.stuck:hover {
    background-color: #ffecb5;
}

.trains-table tr.cancelled {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    opacity: 0.8;
}

.trains-table tr.cancelled:hover {
    background-color: #f5c2c7;
}

.trains-table tr.delayed {
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
}

.trains-table tr.delayed:hover {
    background-color: #ffe0b2;
}

/* Line ref column */
.line-ref {
    font-weight: 600;
}

.line-ref strong {
    display: block;
    font-size: 1.1em;
    color: #667eea;
}

.data-source {
    display: block;
    font-size: 0.75em;
    color: #6c757d;
    margin-top: 2px;
}

/* Stop name */
.stop-name {
    font-weight: 500;
    color: #495057;
}

/* Time columns */
.time {
    font-family: 'Courier New', monospace;
    color: #6c757d;
    font-size: 0.95em;
}

/* Delay badges */
.delay {
    font-weight: 600;
}

.delay-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    display: inline-block;
}

.delay-badge.minor {
    background: #fff3e0;
    color: #e65100;
}

.delay-badge.moderate {
    background: #ffe0b2;
    color: #e65100;
}

.delay-badge.severe {
    background: #ffcdd2;
    color: #c62828;
    font-weight: 700;
}

.delay-badge.early {
    background: #e8f5e9;
    color: #2e7d32;
}

.on-time {
    color: #4caf50;
    font-weight: 600;
}

/* Next stop */
.next-stop {
    color: #495057;
}

.next-time {
    display: block;
    font-size: 0.85em;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    margin-top: 2px;
}

.no-data {
    color: #adb5bd;
}

/* Status badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.status-badge.running {
    background: #d4edda;
    color: #155724;
}

.status-badge.waiting {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.stuck {
    background: #fff3cd;
    color: #856404;
}

.status-badge.cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* No data message */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 1.2em;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 30px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
    color: #6c757d;
    font-size: 0.9em;
}

footer p {
    margin: 5px 0;
}

footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1200px) {
    .trains-table {
        font-size: 0.9em;
    }

    .trains-table th,
    .trains-table td {
        padding: 12px 8px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 2em;
    }

    .summary {
        flex-direction: column;
        gap: 20px;
    }

    .trains-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .trains-table th,
    .trains-table td {
        padding: 10px 6px;
        font-size: 0.85em;
    }
}
