/* Root Design Tokens & Variables */
:root {
    --bg-app: #090d16;
    --bg-sidebar: #0e1320;
    --bg-card: rgba(22, 30, 49, 0.6);
    --bg-card-hover: rgba(30, 41, 67, 0.85);
    --border-card: rgba(255, 255, 255, 0.06);
    --border-active: rgba(59, 130, 246, 0.35);
    
    /* Harmonious Color Palette */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-blue: #3b82f6;
    --color-blue-glow: rgba(59, 130, 246, 0.15);
    --color-emerald: #10b981;
    --color-emerald-glow: rgba(16, 185, 129, 0.15);
    --color-orange: #f59e0b;
    --color-orange-glow: rgba(245, 158, 11, 0.15);
    --color-red: #ef4444;
    --color-red-glow: rgba(239, 68, 68, 0.15);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-sidebar-btn {
    position: absolute;
    right: -12px;
    top: 46px; /* Aligned with center of logo (24px padding-top + 22px half logo) */
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle-sidebar-btn:hover {
    color: var(--text-primary);
    background-color: var(--color-blue-glow);
    border-color: var(--border-active);
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-md);
    background: linear-gradient(135deg, var(--color-blue), var(--color-emerald));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 200px;
    opacity: 1;
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 14px 16px;
    border-radius: var(--border-radius-md);
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 200px;
    opacity: 1;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: white;
    background-color: var(--color-blue-glow);
    border: 1px solid var(--border-active);
}

/* Scraper Status Widget */
.status-widget {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    margin-top: auto;
    font-size: 0.85rem;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                margin-top 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                border-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 250px;
    opacity: 1;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
}

.status-initializing { color: var(--text-muted); background-color: var(--text-muted); }
.status-idle { color: var(--color-emerald); background-color: var(--color-emerald); }
.status-running { color: var(--color-blue); background-color: var(--color-blue); }
.status-error { color: var(--color-red); background-color: var(--color-red); }

.status-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.status-row {
    display: flex;
    justify-content: space-between;
}

.status-row .label {
    color: var(--text-muted);
}

.status-row .value {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Collapsed Sidebar State Rules */
.sidebar.collapsed {
    width: 80px;
    padding: 24px 16px;
}

.sidebar.collapsed .brand {
    gap: 0;
}

.sidebar.collapsed .brand-text {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .nav-item {
    padding: 14px;
    gap: 0;
}

.sidebar.collapsed .nav-text {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .status-widget {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-width: 0;
    pointer-events: none;
}

/* Main Panel */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    max-height: 100vh;
}

/* Tab Display Logic */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Content Header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.content-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.content-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    outline: none;
}

.btn-primary {
    background-color: var(--color-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-card);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-4px);
    background-color: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.icon-blue { background-color: var(--color-blue-glow); color: var(--color-blue); }
.icon-orange { background-color: var(--color-orange-glow); color: var(--color-orange); }
.icon-emerald { background-color: var(--color-emerald-glow); color: var(--color-emerald); }
.icon-red { background-color: var(--color-red-glow); color: var(--color-red); }

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Section Title Bar */
.section-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title-bar h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-live {
    background-color: var(--color-red-glow);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { opacity: 1; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { opacity: 0.7; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.badge-inbound {
    background-color: rgba(129, 140, 248, 0.12);
    color: #818cf8;
    border: 1px solid rgba(129, 140, 248, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-outbound {
    background-color: rgba(0, 188, 212, 0.12);
    color: #00bcd4;
    border: 1px solid rgba(0, 188, 212, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Line Selector Container & Pills */
.line-selector-container {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.line-selector-container::-webkit-scrollbar {
    height: 4px;
}

.line-selector-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
}

.pill-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 50px;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
    outline: none;
}

.pill-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.pill-btn.active {
    background: var(--color-blue-glow);
    border-color: var(--color-blue);
    color: white;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

/* Active Trips Cards Grid */
.live-trips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.live-trip-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.live-trip-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.trip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.trip-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.trip-number {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.delay-tag {
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.delay-tag.on-time { background-color: var(--color-emerald-glow); color: var(--color-emerald); }
.delay-tag.minor { background-color: var(--color-orange-glow); color: var(--color-orange); }
.delay-tag.major { background-color: var(--color-red-glow); color: var(--color-red); }

.trip-status-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.trip-status-row .label {
    color: var(--text-muted);
}

.trip-status-row .value {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Progress Bar Component */
.progress-container {
    margin-top: 4px;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-blue), var(--color-emerald));
    border-radius: 10px;
    transition: width 0.6s ease;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

/* Explorer Filter Card */
.filter-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
    min-width: 180px;
}

.search-group {
    flex-grow: 2;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.form-group input, .form-group select {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--color-blue);
    background-color: rgba(0, 0, 0, 0.35);
}

.filter-actions {
    margin-bottom: 2px;
}

/* Tables */
.table-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-card);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    background-color: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr {
    transition: var(--transition-smooth);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.text-right { text-align: right; }
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

/* Analytics Tab Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.span-2 {
    grid-column: span 2;
}

.card-header {
    margin-bottom: 20px;
}

.card-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-container {
    height: 280px;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG Chart Specific Styles */
.svg-chart {
    width: 100%;
    height: 100%;
}

.chart-bar {
    fill: var(--color-blue);
    transition: fill 0.3s;
    cursor: pointer;
}

.chart-bar:hover {
    fill: #2563eb;
}

.chart-axis-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
}

.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 1;
    stroke-dasharray: 4, 4;
}

.chart-text {
    fill: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 10px;
}

.chart-line {
    fill: none;
    stroke: var(--color-blue);
    stroke-width: 3;
}

.chart-area {
    fill: url(#line-chart-gradient);
    opacity: 0.15;
}

.chart-point {
    fill: var(--color-blue);
    stroke: var(--bg-app);
    stroke-width: 2;
    cursor: pointer;
    transition: r 0.2s;
}

.chart-point:hover {
    r: 6;
}

/* System Grid */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.system-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 24px;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-card);
}

.status-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.status-item .label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.status-item .value {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal and Details Timeline Overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-card);
    width: 90%;
    max-width: 600px;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-card);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-close {
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-md);
    padding: 14px;
    margin-bottom: 24px;
}

.m-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.m-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.m-val {
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
}

/* Vertical Stop Timeline */
.timeline-container {
    padding: 10px 0;
}

.timeline {
    list-style-type: none;
    position: relative;
    padding-left: 32px;
}

/* Connector line */
.timeline::before {
    content: '';
    background: rgba(255, 255, 255, 0.06);
    display: inline-block;
    position: absolute;
    left: 11px;
    width: 2px;
    height: 100%;
    top: 4px;
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

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

/* Point marker */
.timeline-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
    position: absolute;
    left: -26px;
    top: 6px;
    border: 2px solid var(--bg-sidebar);
    z-index: 2;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.02);
}

.timeline-item.completed .timeline-marker {
    background-color: var(--color-emerald);
    box-shadow: 0 0 8px var(--color-emerald);
}

.timeline-item.active .timeline-marker {
    background-color: var(--color-blue);
    box-shadow: 0 0 8px var(--color-blue);
    animation: timeline-pulse 1.5s infinite;
}

@keyframes timeline-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.timeline-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-station-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.timeline-times {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.sch-time {
    color: var(--text-muted);
}

.act-time {
    color: var(--text-primary);
    font-weight: 500;
}

.delay-val {
    font-weight: 700;
    font-size: 0.8rem;
}

.text-emerald { color: var(--color-emerald); }
.text-orange { color: var(--color-orange); }
.text-red { color: var(--color-red); }

.timeline-track {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Loading & Empty States */
.loading-state, .empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px;
    color: var(--text-muted);
    font-weight: 500;
}

.loading-state i {
    font-size: 1.75rem;
    color: var(--color-blue);
}

.empty-state i {
    font-size: 2.2rem;
    margin-bottom: 4px;
}

/* Responsive Rules */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-card);
        padding: 20px;
    }
    
    .brand {
        margin-bottom: 20px;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 16px;
    }
    
    .nav-item {
        padding: 10px 14px;
        flex-grow: 1;
        font-size: 0.85rem;
    }
    
    .status-widget {
        display: none; /* Hide widget on mobile to save vertical space */
    }
    
    .main-content {
        padding: 24px;
        max-height: none;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .span-2 {
        grid-column: span 1;
    }

    /* Collapsible Sidebar Mobile Overrides */
    .toggle-sidebar-btn {
        display: none !important;
    }
    
    .sidebar.collapsed {
        width: 100% !important;
        padding: 20px !important;
    }
    
    .sidebar.collapsed .brand {
        gap: 12px !important;
    }
    
    .sidebar.collapsed .brand-text {
        max-width: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .sidebar.collapsed .nav-item {
        padding: 10px 14px !important;
        gap: 12px !important;
    }
    
    .sidebar.collapsed .nav-text {
        max-width: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .sidebar.collapsed .status-widget {
        display: none !important;
    }
}
