/* Professional Scientific Theme - Find Available Transit */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
    /* Palette: Scientific / Professional */
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-header: #2c3e50;

    --primary: #2980b9;
    /* Professional Blue */
    --primary-dark: #1c5985;
    --accent: #e74c3c;
    /* Alert/Highlight Red */
    --success: #27ae60;
    /* Good/Visible Green */

    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --text-light: #ecf0f1;

    --border-color: #dcdde1;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);

    --radius-sm: 4px;
    --radius-md: 8px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    line-height: 1.5;
}

/* Layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
header {
    background: var(--bg-header);
    color: var(--text-light);
    padding: 15px 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.brand h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

#db-info {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* Language Switcher */
.lang-switch {
    display: flex;
    gap: 5px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.7);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 20px;
}

/* Form Controls */
.controls-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

input {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

/* Buttons */
.btn-main {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.btn-main:hover {
    background-color: var(--primary-dark);
}

.btn-main:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Map */
.map-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
    /* Taller map */
}

#map {
    flex: 1;
    width: 100%;
    background: #eee;
    z-index: 1;
    /* Ensure map is below header if overlapping occurs */
}

.map-hint {
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

/* Status Bar */
#status-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Table */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: #f1f2f6;
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background: #e1e2e6;
}

th.sort-asc::after {
    content: " ▲";
    font-size: 0.7em;
}

th.sort-desc::after {
    content: " ▼";
    font-size: 0.7em;
}

td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8f9fa;
}

/* Data Formatting */
.font-mono {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
}

.tag-bright {
    display: inline-block;
    background: #f1c40f;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.val-high {
    color: var(--success);
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 20px 0;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .container {
        padding: 10px;
        gap: 15px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
        justify-content: center;
    }

    .lang-switch {
        justify-content: center;
        margin-top: 10px;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .map-card {
        min-height: 350px;
        /* Smaller map on mobile but still usable */
    }

    .about-section {
        padding: 15px;
    }
}