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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-box h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.login-box h2 {
    font-size: 1rem;
    color: #888;
    margin-bottom: 30px;
    font-weight: normal;
}

/* Dashboard Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    color: #888;
    font-size: 1rem;
}

.logout-btn {
    padding: 8px 20px;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Stats Bar */
.stats-bar {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 40px;
    justify-content: center;
}

.stat {
    font-size: 0.95em;
}

.stat strong {
    color: #888;
}

.stat span {
    color: #f59e0b;
    font-weight: 600;
    margin-left: 5px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #f59e0b;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e0e0e0;
}

input[type="password"],
.select-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
}

input[type="password"]:focus,
.select-input:focus {
    outline: none;
    border-color: #f59e0b;
}

.select-input option {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Upload Area */
.upload-area {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.file-name {
    color: #888;
    font-style: italic;
}

.info-text {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* Filters */
.filters {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.filters .btn {
    margin-bottom: 0;
}

/* Status Messages */
.status-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95em;
}

.status-message.info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-message.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Graph Container */
#graphContainer {
    min-height: 400px;
    width: 100%;
}

#plotlyGraph {
    width: 100%;
    height: 500px;
}

.placeholder-text {
    text-align: center;
    color: #888;
    padding: 60px 20px;
    font-size: 1.1em;
}

.error-text {
    text-align: center;
    color: #ef4444;
    padding: 60px 20px;
    font-size: 1.1em;
}

/* Source Items */
.source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.source-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.source-name {
    color: #e0e0e0;
    font-weight: 500;
}

.source-meta {
    color: #888;
    font-size: 0.85em;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Password Section */
.password-section {
    margin-bottom: 20px;
}

.password-section h3 {
    font-size: 1rem;
    color: #e0e0e0;
    margin-bottom: 15px;
}

.password-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.password-input {
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.95em;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    flex: 1;
    min-width: 200px;
}

.password-input:focus {
    outline: none;
    border-color: #f59e0b;
}

.divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* Actions */
.actions {
    display: flex;
    gap: 15px;
}

/* Legend (custom for chart) */
.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e0e0e0;
    font-size: 0.9em;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.arrival {
    background: rgba(59, 130, 246, 0.7);
}

.legend-dot.departure {
    background: rgba(239, 68, 68, 0.7);
}

/* Track Visualization */
.track-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.track-time-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.track-time-group .time-input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    text-align: center;
}

.track-time-group .time-input:focus {
    outline: none;
    border-color: #f59e0b;
}

.track-info {
    color: #888;
    font-size: 0.9em;
}

.track-canvas-wrapper {
    overflow-x: auto;
    background: #0f172a;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.track-canvas-wrapper canvas {
    display: block;
    min-width: 100%;
}

.track-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85em;
    color: #e0e0e0;
    pointer-events: none;
    display: none;
    z-index: 100;
    white-space: nowrap;
}

.track-legend {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.legend-dot.nb { background: #3b82f6; }
.legend-dot.sb { background: #ef4444; }
.legend-dot.at-station { background: #fbbf24; }
.legend-dot.between { background: #60a5fa; opacity: 0.6; }
.legend-dot.arrival { background: rgba(59, 130, 246, 0.7); }
.legend-dot.departure { background: rgba(239, 68, 68, 0.7); }
.legend-dot.scheduled { background: rgba(59, 130, 246, 0.7); }
.legend-dot.actual { background: rgba(239, 68, 68, 0.7); }

/* Chart Sections */
.chart-title-text {
    font-size: 1.1em;
    font-weight: 600;
    color: #f59e0b;
    margin-bottom: 20px;
    text-align: center;
}

.chart-section-title {
    font-size: 1em;
    color: #e0e0e0;
    margin: 20px 0 10px 0;
}

.chart-container-box {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.chart-container-box canvas {
    max-height: 400px;
}

.chart-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 25px 0;
}

.chart-legend-row {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filters .form-group {
        width: 100%;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    #plotlyGraph {
        height: 400px;
    }
}