* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    max-height: 95vh;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
     overflow: auto;
}

header {
    background: linear-gradient(90deg, #4b6cb7, #182848);
    color: white;
    padding: 15px 25px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-content {
    max-width: 800px;
}

h1 {
    font-size: 24px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-info {
    font-size: 14px;
    opacity: 0.9;
}

.controls-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.input-group {
    position: relative;
}

input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

input:focus {
    border-color: #4b6cb7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(75, 108, 183, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
    font-size: 16px;
}

.results-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    min-height: 180px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-top: 10px;
}

.result-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: all 0.2s;
    cursor: pointer;
    border-radius: 6px;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.result-title {
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 3px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-address {
    color: #666;
    font-size: 12px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.coordinates {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    color: #495057;
    font-size: 13px;
    flex-wrap: wrap;
}

.coordinate-box {
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    font-family: monospace;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 4px;
}

.loading {
    display: none;
    text-align: center;
    padding: 15px;
}

.loading .spinner {
    width: 35px;
    height: 35px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4b6cb7;
    border-radius: 50%;
    margin: 0 auto 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    color: #dc3545;
    padding: 12px;
    text-align: center;
    background: #fff5f5;
    border-radius: 8px;
    margin-top: 12px;
    display: none;
    font-size: 13px;
}

.no-results {
    text-align: center;
    padding: 15px;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 13px;
}

.point-selector {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.point-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: #e9ecef;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
}

.point-btn.active {
    background: #4b6cb7;
    color: white;
    box-shadow: 0 0 0 2px rgba(75, 108, 183, 0.5); /* Добавляем тень для лучшей видимости */
    transform: scale(1.02); /* Легкое увеличение для акцента */
}

.selected-points {
    background: #e7f5ff;
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
    font-size: 14px;
}

.point-info {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #ccc;
}

.point-info:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.point-title {
    font-weight: 600;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.route-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.route-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: #4b6cb7;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 100px;
    font-size: 13px;
}

.st {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: #4caf50;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 100px;
    font-size: 13px;
}

.st:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.st:hover:not(:disabled) {
    background: #3d8b40;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.route-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.route-btn:hover:not(:disabled) {
    background: #3a559f;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.px {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: #dc8504;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 100px;
    font-size: 13px;
}

.px:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.px:hover:not(:disabled) {
    background: #c27600;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.distance-info {
    margin-top: 12px;
    padding: 10px;
    background: #e0f7fa;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: none;
    font-size: 14px;
}

.similar-routes {
    margin-top: 15px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    display: none;
    font-size: 13px;
}

.similar-route {
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.similar-route-title {
    font-weight: 600;
    color: #5e35b1;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.similar-route-btn {
    padding: 6px 10px;
    border-radius: 5px;
    border: none;
    background: #5e35b1;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 6px;
    width: 100%;
    justify-content: center;
}

.similar-route-btn:hover {
    background: #4527a0;
}

/* Карта жестко зафиксирована внизу */
.map-section {
    height: 40%;
    min-height: 250px;
    background: #e9ecef;
    flex-shrink: 0;
    position: relative;
    border-top: 2px solid #d0d6e0;
}

#map {
    width: 100%;
    height: 100%;
}

.map-controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.map-btn {
    padding: 6px 10px;
    border-radius: 5px;
    border: none;
    background: #4b6cb7;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.map-btn:hover {
    background: #3a559f;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        max-height: 97vh;
    }
    
    header {
        padding: 12px 15px;
    }
    
    h1 {
        font-size: 20px;
        gap: 8px;
    }
    
    .controls-container {
        padding: 15px;
    }
    
    .point-selector {
        flex-direction: column;
    }
    
    .route-controls {
        flex-direction: column;
    }
    
    .route-btn, .st, .px {
        width: 100%;
    }
    
    .map-section {
        height: 45%;
        min-height: 300px;
    }
    
    .map-controls {
        bottom: 10px;
        right: 10px;
        padding: 6px;
    }
    
    .map-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
}

/* Адаптация для маленьких экранов */
@media (max-width: 480px) {
    header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .api-info {
        margin-top: 5px;
    }
    
    .coordinates {
        flex-direction: column;
        gap: 4px;
    }
    
    .coordinate-box {
        width: 100%;
        justify-content: center;
    }
    
    .map-section {
        height: 45%;
        min-height: 300px;
    }
}

/* Отключаем прокрутку для всего, кроме функциональных блоков */
body {
    overflow: hidden;
}

.controls-container {
    overflow-y: auto;
}

.map-section {
    overflow: hidden;
}
/* Разрешаем прокрутку контейнера */
.container {
    overflow: auto;
}

/* Стили для блока деталей маршрута */
.route-details {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: none; /* Скрыт по умолчанию */
}

.route-details h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 8px;
}

#details-content {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.detail-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.detail-label {
    font-weight: bold;
    color: #4b6cb7;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-value {
    color: #495057;
    font-size: 14px;
    padding-left: 22px;
}


