/* Transit Info Desk - Stylesheet */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #334155;
    --accent: #dc2626;
    --warning: #d97706;
    --success: #16a34a;
    --bg: #e2e8f0;
    --card-bg: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --up-color: #2563eb;
    --dn-color: #7c3aed;
    --border: #cbd5e1;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --transition: 0.3s ease;
}

body.dark-theme {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --secondary: #334155;
    --accent: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --up-color: #3b82f6;
    --dn-color: #8b5cf6;
    --border: #334155;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Source Sans Pro', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.header {
    background: #1e40af; /* Fallback for invalid CSS variable */
    background: var(--primary);
    color: #ffffff;
    padding: 20px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    color: #fff;
    flex-shrink: 0;
}

.title-section h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: 400;
}

.datetime-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.day-name {
    font-family: 'Oswald', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    opacity: 0.8;
}

.full-date {
    font-size: 0.9rem;
    opacity: 0.9;
}

.time-box {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: var(--radius);
}

.time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 2px;
}

.period {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.8;
}

/* Theme Toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

body.dark-theme .sun-icon { display: none; }
body.dark-theme .moon-icon { display: block !important; }

/* Professional Download Button */
.pro-download-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pro-download-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.pro-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.15);
    padding: 8px;
    border-radius: 8px;
}

.pro-icon-wrapper svg {
    width: 24px;
    height: 24px;
}

.pro-text-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.pro-subtext {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fde047; /* Professional yellow accent */
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pro-pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #fde047;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(253, 224, 71, 0.7);
    animation: proPulse 2s infinite;
}

@keyframes proPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(253, 224, 71, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(253, 224, 71, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(253, 224, 71, 0); }
}

.pro-maintext {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0;
    margin: 24px 0 0;
    border-bottom: 2px solid var(--border);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
}

.tab-btn {
    flex: 1;
    max-width: 220px;
    padding: 14px 20px;
    border: none;
    background: transparent;
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(26, 54, 93, 0.05);
}

body.dark-theme .tab-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tab-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    min-width: 22px;
    text-align: center;
}

.tab-badge.alert {
    background: var(--accent);
}

/* Content Area */
.content-area {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    padding: 24px 0 16px;
}

.section-header h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.direction-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.direction-indicator.up {
    background: var(--up-color);
}

.direction-indicator.dn {
    background: var(--dn-color);
}

.direction-indicator.alert {
    background: var(--warning);
}

/* Next Train Widget */
.next-train-widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--success);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background var(--transition);
}

.next-train-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.next-train-info {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

/* Controls Container */
.controls-container {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.route-filter-container {
    min-width: 150px;
    flex-shrink: 0;
}

.route-selector {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.route-selector:focus {
    outline: none;
    border-color: var(--primary);
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color var(--transition), background var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-bottom: 24px;
    transition: background var(--transition);
}

.train-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.train-table thead {
    background: var(--primary);
    color: #fff;
    transition: background var(--transition);
}

.train-table th {
    padding: 14px 16px;
    text-align: left;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.train-table th:hover {
    background: rgba(255, 255, 255, 0.1);
}

.train-table th.sortable .sort-icon {
    margin-left: 6px;
    opacity: 0.5;
    font-size: 0.75rem;
}

.train-table th.sort-asc .sort-icon,
.train-table th.sort-desc .sort-icon {
    opacity: 1;
}

.train-table th.sort-asc .sort-icon::after {
    content: " ↑";
}

.train-table th.sort-desc .sort-icon::after {
    content: " ↓";
}

.train-table th.sortable .sort-icon::after {
    content: " ⇅";
}

.train-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
}

.train-table tbody tr:nth-child(even) {
    background: #f9f6f1;
}

body.dark-theme .train-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.train-table tbody tr:hover {
    background: #ede8e1;
}

.train-table td {
    padding: 12px 16px;
    white-space: nowrap;
}

.train-table td:nth-child(3),
.train-table td:nth-child(4) {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.9rem;
}

.train-no {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
}

.train-name {
    font-weight: 600;
}

.time-ampm {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 2px;
    font-weight: 400;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-badge.available {
    background: #dcfce7;
    color: #166534;
}

body.dark-theme .status-badge.available {
    background: #166534;
    color: #dcfce7;
}

.status-badge.running {
    background: #dbeafe;
    color: #1e40af;
}

body.dark-theme .status-badge.running {
    background: #1e40af;
    color: #dbeafe;
}

.status-badge.reached {
    background: #e2e8f0;
    color: #475569;
}

body.dark-theme .status-badge.reached {
    background: #334155;
    color: #cbd5e1;
}

.status-badge.error {
    background: #fee2e2;
    color: #991b1b;
}

body.dark-theme .status-badge.error {
    background: #991b1b;
    color: #fee2e2;
}

/* Real-time status indicators */
.loading-indicator {
    display: inline-block;
    animation: spin 1s linear infinite;
    font-size: 1.2em;
    color: var(--warning);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-timestamp {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}

/* Enhanced status tooltips */
.status-badge[title] {
    position: relative;
    cursor: help;
}

.status-badge[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.status-badge.running-late {
    background: #fef3c7;
    color: #92400e;
}

body.dark-theme .status-badge.running-late {
    background: #92400e;
    color: #fef3c7;
}

.status-badge.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

body.dark-theme .status-badge.cancelled {
    background: #991b1b;
    color: #fee2e2;
}

.status-badge.short-origin {
    background: #ffedd5;
    color: #9a3412;
}

body.dark-theme .status-badge.short-origin {
    background: #9a3412;
    color: #ffedd5;
}

.status-badge.short-terminate {
    background: #ffedd5;
    color: #9a3412;
}

body.dark-theme .status-badge.short-terminate {
    background: #9a3412;
    color: #ffedd5;
}

.status-badge.rescheduled {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.ntese-status {
    background: #f3e5f5;
    color: #6a1b9a;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: normal;
    line-height: 1.4;
}

.status-badge.live {
    background: #10b981;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
}

.status-badge.live::before {
    content: "📍";
    margin-right: 4px;
}

.status-badge.delayed {
    background: #f59e0b;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
}

.status-badge.delayed::before {
    content: "⏱️ ";
    margin-right: 4px;
}

.status-badge.early {
    background: #3b82f6;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
}

.status-badge.early::before {
    content: "⏰ ";
    margin-right: 4px;
}

.status-badge.on-time {
    background: #10b981;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
}

.status-badge.on-time::before {
    content: "✅ ";
    margin-right: 4px;
}

body.dark-theme .status-badge.ntese-status {
    background: #6a1b9a;
    color: #f3e5f5;
}

body.dark-theme .status-badge.rescheduled {
    background: #1e40af;
    color: #dbeafe;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transition: background var(--transition);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background var(--transition);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-theme .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 24px;
}

.modal-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
    border: none;
}

.real-time-item {
    margin-bottom: 12px;
    padding: 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.9em;
}

.real-time-item strong {
    color: var(--primary);
}

.real-time-error {
    color: #dc2626;
    font-style: italic;
}

.modal-info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.modal-info-row:last-child {
    border-bottom: none;
}

.modal-info-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 140px;
    font-size: 0.9rem;
}

.modal-info-value {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.modal-info-value.train-no-modal {
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary);
    font-weight: 600;
}

.modal-info-value.time-modal {
    font-family: 'JetBrains Mono', monospace;
}

.modal-status-badge {
    display: inline-block;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-timestamp {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.modal-btn {
    padding: 8px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

.modal-btn:hover {
    background: var(--primary-dark);
}

/* Special Notices */
.notices-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.notice-date-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notice-date-header {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 10px 16px;
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 2px solid var(--border);
}

body.dark-theme .notice-date-header {
    color: var(--text-primary);
}

.notice-group {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: background var(--transition);
}

.notice-group-header {
    padding: 14px 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice-group-header.cancelled-header {
    background: var(--accent);
}

.notice-group-header.short-origin-header {
    background: var(--warning);
}

.notice-group-header.short-terminate-header {
    background: var(--warning);
}

.notice-group-header.rescheduled-header {
    background: var(--primary-light);
}

.notice-group-header.running-late-header {
    background: var(--warning);
}

.notice-group-header .count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
}

.notice-list {
    list-style: none;
}

.notice-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    transition: background var(--transition);
}

.notice-item:last-child {
    border-bottom: none;
}

.notice-item:hover {
    background: #f9f6f1;
}

body.dark-theme .notice-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.notice-train-no {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    min-width: 80px;
}

.notice-train-name {
    font-weight: 600;
    flex: 1;
    min-width: 150px;
}

.notice-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.notice-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 100%;
    padding-top: 4px;
}

.notice-badge {
    margin-left: auto;
}

.empty-notices {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-notices svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* Alert Popup */
.alert-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 600px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid #4f46e5;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(700px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.4s ease;
}

.alert-popup.active {
    transform: translateX(0);
    opacity: 1;
}

.alert-popup.dark-theme {
    background: rgba(30, 41, 59, 0.85);
    border-color: #4f46e5;
}

.alert-content {
    padding: 0;
}

.alert-header {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.alert-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 0.7;
}

.alert-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.alert-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-item {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 6px;
    border-left: 4px solid;
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-item.cancelled {
    border-left-color: var(--accent);
}

.alert-item.short-origin {
    border-left-color: var(--warning);
}

.alert-item.short-terminate {
    border-left-color: var(--warning);
}

.alert-item.rescheduled {
    border-left-color: var(--success);
}

.alert-train-info {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 4px;
}

.alert-train-no {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.alert-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.alert-detail {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.alert-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
}

.alert-time {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}

.alert-status {
    margin: 4px 0;
}

/* Footer */
.footer {
    background: var(--secondary);
    color: #fff;
    padding: 20px 0;
    margin-top: 40px;
    transition: background var(--transition);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
}

.station-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.station-name {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    letter-spacing: 1px;
}

.separator {
    opacity: 0.4;
}

.copyright {
    opacity: 0.7;
}

.footer-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0.8;
}

.visitor-count, .last-updated {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .logo-section {
        justify-content: center;
    }

    .datetime-display {
        justify-content: center;
        flex-wrap: wrap;
    }

    .title-section h1 {
        font-size: 1.4rem;
    }

    .tab-btn {
        font-size: 0.8rem;
        padding: 12px 10px;
    }

    .tab-btn span:not(.tab-badge):not(.tab-icon) {
        display: none;
    }

    .section-header h2 {
        font-size: 1.2rem;
    }

    .train-table th,
    .train-table td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .notice-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .notice-badge {
        margin-left: 0;
    }

    .modal-info-label {
        min-width: 100px;
    }

    .next-train-widget {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0 8px;
    }

    .tab-navigation {
        padding: 0 8px;
    }

    .content-area {
        padding: 0 8px;
    }

    .time {
        font-size: 1.2rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .calendar-btn {
        margin-left: 8px;
    }
}

/* Calendar Modal */
#calendarModal {
    max-width: 600px;
}

.date-picker {
    width: 100%;
    padding: 12px;
    border: 2px solid #334155;
    border-radius: var(--radius);
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    margin-bottom: 16px;
}

.date-picker:focus {
    outline: none;
    border-color: var(--primary);
}

.schedule-display {
    max-height: 400px;
    overflow-y: auto;
}

.schedule-section {
    margin-bottom: 20px;
}

.schedule-section h4 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.schedule-table th {
    padding: 8px 12px;
    text-align: left;
    background: var(--primary);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
}

.schedule-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.schedule-table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-theme .schedule-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.no-train {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.no-train-msg {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

/* Refresh Button */
.refresh-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform 0.3s ease;
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.refresh-btn svg {
    width: 20px;
    height: 20px;
}

.refresh-btn.spinning svg {
    animation: spin 0.8s linear infinite;
}

/* Download App Button */
.download-app-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--success);
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius);
    text-decoration: none;
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition);
    position: relative;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.download-app-btn:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.5);
    color: white;
}

.download-app-btn svg {
    width: 18px;
    height: 18px;
}

.new-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Notice Cards */
.notice-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: background var(--transition);
}

.notice-card.info {
    border-left: 4px solid var(--primary);
}

.notice-card.tip {
    border-left: 4px solid var(--success);
}

.notice-card .notice-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notice-card .notice-content h4 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.notice-card .notice-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.notice-card .notice-content .notice-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 8px;
    display: block;
}

/* Schedule List (Calendar Modal) */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.schedule-item:nth-child(even) {
    background: rgba(0, 0, 0, 0.03);
}

body.dark-theme .schedule-item:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.schedule-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.dark-theme .schedule-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.schedule-train-no {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    min-width: 60px;
}

.schedule-train-name {
    flex: 1;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-train-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Next Train Widget Details */
.next-train-details {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.next-train-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.next-train-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.next-train-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 600;
}

/* Batch Result Items */
.batch-result-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.9rem;
    border-left: 3px solid var(--success);
}

.batch-result-item.error {
    border-left-color: var(--accent);
}

/* Train Checkbox Labels */
.train-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.85rem;
    cursor: pointer;
}

.train-checkbox-label:hover {
    color: var(--primary);
}

.train-checkbox {
    accent-color: var(--primary);
}

/* Data Source Badges (LIVE / EST) */
.source-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1.4;
}

.source-badge.source-live {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    animation: livePulse 2s ease-in-out infinite;
}

body.dark-theme .source-badge.source-live {
    background: #14532d;
    color: #86efac;
    border-color: #22c55e;
}

.source-badge.source-schedule {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

body.dark-theme .source-badge.source-schedule {
    background: #78350f;
    color: #fcd34d;
    border-color: #d97706;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
        padding: 12px;
    }

    .logo-section {
        flex-direction: column;
        gap: 8px;
    }

    .title-section h1 {
        font-size: 1.5rem;
    }

    .datetime-display {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .tab-navigation {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 45%;
        padding: 10px;
        font-size: 0.9rem;
    }

    .controls-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        width: 100%;
        min-width: unset;
    }

    .route-filter-container {
        width: 100%;
        min-width: unset;
    }

    .modal {
        margin: 16px;
        width: calc(100% - 32px);
    }
    
    .train-table th, .train-table td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .datetime-display {
        flex-direction: column;
        gap: 8px;
    }

    .time-box {
        width: 100%;
        justify-content: center;
    }

    .date-box {
        align-items: center;
    }

    .tab-btn {
        flex: 1 1 100%;
    }
    
    .title-section h1 {
        font-size: 1.3rem;
    }
}
