:root {
    --primary-color: #0056b3;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --accent-color: #ffc107;
    --border-radius: 8px;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: var(--text-color);
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-controls {
    display: flex;
    gap: 10px;
}

#map-container {
    height: calc(100vh - 120px);
    width: 100%;
    z-index: 10;
}

#commute-btn,
#map-mode-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

#commute-btn.active,
#map-mode-btn.active {
    background-color: var(--accent-color);
    color: #333;
    border-color: var(--accent-color);
    font-weight: bold;
}

header h1 {
    margin: 0;
    font-size: 1.2rem;
}

#status-bar {
    font-size: 0.8rem;
    opacity: 0.8;
}

nav#highway-tabs {
    display: flex;
    overflow-x: auto;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    white-space: nowrap;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 20px;
    color: #555;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
}

#direction-container {
    background-color: white;
    padding: 0.5rem 1rem;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}

.dir-btn {
    background: #e9ecef;
    border: none;
    padding: 0.4rem 1rem;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 15px;
    color: #555;
    transition: all 0.2s;
}

.dir-btn:hover {
    background-color: #dee2e6;
}

.dir-btn.active {
    background-color: var(--accent-color);
    color: #000;
    font-weight: 500;
}

main#content-area {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.direction-section {
    margin-bottom: 2rem;
}

.direction-title {
    font-size: 1.2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.events-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.event-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--card-shadow);
    border-left: 5px solid #ddd;
}

/* Event types coloring based on description keywords or custom logic */
.event-card.construction {
    border-left-color: #ff9800;
}

/* Orange for construction */
.event-card.congestion {
    border-left-color: #f44336;
}

/* Red for congestion */
.event-card.accident {
    border-left-color: #e91e63;
}

/* Pink for accident */

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.km-badge {
    background-color: #e9ecef;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: bold;
    font-family: monospace;
}

.event-time {
    font-size: 0.8rem;
    color: #888;
}

.event-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #444;
}

.event-desc {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #666;
}

.event-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.8rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}

@media (max-width: 600px) {
    .events-container {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1rem;
    }
}

footer {
    text-align: center;
    color: #888;
    padding: 1.5rem 0;
    font-size: 0.9rem;
    margin-top: 2rem;
}