/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    flex: 1;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 0;
}

.subtitle {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 5px;
    border-left: 3px solid rgba(255, 255, 255, 0.5);
    padding-left: 15px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    font-size: 14px;
}

.stat-item strong {
    font-size: 18px;
}

.last-update {
    font-size: 13px;
    opacity: 0.9;
}

/* ===== ОСНОВНОЙ КОНТЕНТ ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

/* ===== КАРТА ===== */
.map-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 600px;
}

#map {
    width: 100%;
    height: 100%;
}

/* ===== САЙДБАР ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== СПИСОК АВТОБУСОВ ===== */
.bus-list {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    max-height: 400px;
    overflow-y: auto;
}

.bus-list h3,
.controls h3 {
    margin-bottom: 15px;
    color: #555;
    font-size: 16px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 10px;
}

/* Стилизация скроллбара */
.bus-list::-webkit-scrollbar {
    width: 6px;
}

.bus-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.bus-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.bus-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* ===== ЭЛЕМЕНТ АВТОБУСА В СПИСКЕ ===== */
.bus-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.bus-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.bus-item .id {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
}

.bus-item .route {
    font-size: 13px;
    color: #666;
}

.bus-item .driver {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.bus-item .speed {
    font-size: 12px;
    color: #999;
    text-align: right;
    margin-top: 4px;
}

.bus-item .status {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
}

/* Статусы */
.status-en-route {
    background: #d4edda;
    color: #155724;
}

.status-stopped {
    background: #fff3cd;
    color: #856404;
}

.status-maintenance {
    background: #f8d7da;
    color: #721c24;
}

/* ===== УПРАВЛЕНИЕ ===== */
.controls {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group select,
.control-group button {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.control-group button {
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.control-group button:hover {
    background: #764ba2;
}

.control-group button:active {
    transform: scale(0.98);
}

.footer-hint {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 11px;
    color: #aaa;
    text-align: center;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        align-items: flex-start;
    }
    
    .stats {
        gap: 10px;
    }
    
    .stat-item {
        font-size: 12px;
        padding: 5px 12px;
    }
    
    .stat-item strong {
        font-size: 15px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .map-container {
        height: 400px;
    }
    
    .bus-list {
        max-height: 300px;
    }
    
    .subtitle {
        font-size: 13px;
        padding-left: 10px;
        margin-top: 8px;
    }
    
    .header-left h1 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 12px 15px;
    }
    
    .header-left h1 {
        font-size: 17px;
    }
    
    .subtitle {
        font-size: 12px;
        padding-left: 8px;
    }
    
    .stats {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .stat-item {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .stat-item strong {
        font-size: 13px;
    }
    
    .map-container {
        height: 300px;
    }
    
    .controls {
        padding: 15px;
    }
    
    .footer-hint {
        font-size: 10px;
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bus-item {
    animation: fadeIn 0.3s ease;
}

/* ===== ДОПОЛНИТЕЛЬНО ДЛЯ КАРТЫ ===== */
/* Скрываем лишние элементы управления Leaflet если нужно */
.leaflet-control-zoom {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
}

.leaflet-popup-content {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    line-height: 1.6;
}

.leaflet-popup-content strong {
    color: #667eea;
}