/* 
 * Tablo V3 — Стили
 * Тёмная тема, mobile-first, крупные элементы для использования на морозе
 */

:root {
    /* Цветовая схема — тёмная с акцентами */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-hover: #22222e;
    
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #555566;
    
    --accent-primary: #00d4aa;
    --accent-secondary: #00a8ff;
    --accent-warning: #ffaa00;
    --accent-danger: #ff4466;
    --accent-success: #44dd88;
    
    /* Отклонения */
    --status-normal: #44dd88;
    --status-ahead: #00a8ff;
    --status-late: #ffaa00;
    --status-very-late: #ff4466;
    --status-stale: #555566;
    
    /* Размеры */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

/* Утилитарные классы */
.hidden {
    display: none !important;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Экраны */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ========================================
   ГЛОБАЛЬНАЯ НАВИГАЦИЯ
   ======================================== */

.global-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.global-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.global-nav .nav-logo {
    font-size: 24px;
    line-height: 1;
}

.global-nav .nav-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.global-nav .nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius-md);
}

.global-nav .nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.global-nav .nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.global-nav .nav-tab.active {
    color: var(--bg-primary);
    background: var(--accent-primary);
}

.global-nav .nav-tab .tab-icon {
    font-size: 16px;
    line-height: 1;
}

.global-nav .nav-tab .tab-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.global-nav .nav-tab.active .tab-badge {
    background: rgba(0, 0, 0, 0.2);
    color: var(--bg-primary);
}

.global-nav .nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.global-nav .nav-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 18px;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s ease;
}

.global-nav .nav-action:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Мобильная адаптация навигации */
@media (max-width: 600px) {
    .global-nav {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .global-nav .nav-brand {
        order: 1;
    }
    
    .global-nav .nav-actions {
        order: 2;
        margin-left: auto;
    }
    
    .global-nav .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .global-nav .nav-tab {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }
    
    .global-nav .nav-tab .tab-text {
        display: none;
    }
    
    .global-nav .nav-tab .tab-icon {
        font-size: 20px;
    }
}

/* ========================================
   ЗАГОЛОВКИ СТРАНИЦ
   ======================================== */

.board-page-header {
    padding: 20px;
    text-align: center;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

/* ========================================
   СТАРЫЕ СТИЛИ ХЕДЕРА (для совместимости)
   ======================================== */

/* Хедер */
.header {
    flex-shrink: 0;
    padding: 24px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.subtitle {
    margin-top: 4px;
    font-size: 16px;
    color: var(--text-secondary);
}

/* Футер */
.footer {
    flex-shrink: 0;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.status {
    font-size: 10px;
}

.status.online {
    color: var(--status-normal);
}

.status.offline {
    color: var(--status-very-late);
}

/* Сетка маршрутов */
.routes-grid {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    align-content: start;
    overflow-y: auto;
}

.route-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 140px;
}

.route-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.route-btn:active {
    transform: translateY(0);
}

.route-btn .number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 48px;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}

.route-btn .vehicles {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.route-btn .vehicles strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Хедер табло */
.board-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.back-btn:hover {
    background: var(--bg-hover);
}

.route-info {
    flex: 1;
}

.route-info .route-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-primary);
}

.route-info .route-name {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.vehicles-count {
    text-align: right;
}

.vehicles-count .count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.vehicles-count .label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Контент табло */
.board-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Список ТС */
.vehicles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vehicle-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    border-left: 4px solid var(--status-normal);
    transition: all 0.15s ease;
}

.vehicle-card.ahead {
    border-left-color: var(--status-ahead);
}

.vehicle-card.late {
    border-left-color: var(--status-late);
}

.vehicle-card.very-late {
    border-left-color: var(--status-very-late);
}

.vehicle-card.stale {
    border-left-color: var(--status-stale);
    opacity: 0.6;
}

.vehicle-card.exception {
    border-left-color: var(--text-muted);
    opacity: 0.5;
}

.vehicle-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vehicle-gos {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.vehicle-direction {
    font-size: 14px;
    color: var(--text-secondary);
}

.vehicle-status {
    text-align: right;
}

.deviation {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.deviation.normal {
    color: var(--status-normal);
}

.deviation.ahead {
    color: var(--status-ahead);
}

.deviation.late {
    color: var(--status-late);
}

.deviation.very-late {
    color: var(--status-very-late);
}

.deviation-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Состояние загрузки */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Пустое состояние */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state .message {
    font-size: 18px;
    color: var(--text-secondary);
}

.empty-state .hint {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

/* Адаптивность */
@media (min-width: 600px) {
    .routes-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 600px;
        margin: 0 auto;
    }
    
    .board-content {
        max-width: 800px;
        margin: 0 auto;
        width: 100%;
    }
}

/* Анимации */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Footer link и spacer */
.footer .spacer {
    flex: 1;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: var(--accent-primary);
}



