/* --- ОСНОВНІ НАЛАШТУВАННЯ --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
    height: 100%; width: 100%;
    font-family: 'Inter', sans-serif;
    background-color: #1a1a1a;
    color: #ececec;
    overflow: hidden;
}

a { text-decoration: none; }

.welcome-screen {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #000000;
    z-index: 9999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 20px;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.welcome-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.welcome-logo img { width: 50px; height: auto; margin-bottom: 20px; opacity: 1; }
.welcome-title { font-size: 32px; font-weight: 600; margin-bottom: 40px; color: #ffffff; text-align: center; }

/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
/* --- ОСНОВНИЙ КОНТЕЙНЕР --- */
.chatgpt-input-container {
    width: 100%; 
    max-width: 768px;
    padding: 8px 10px 8px 16px;
    
    display: flex; 
    align-items: center; 
    gap: 10px;
    
    border-radius: 26px; 
    
    position: relative; 
    z-index: 0; 
    
    /* Тінь блоку */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* --- 1. ШАР ПУЛЬСАЦІЇ ( ::before ) --- */
.chatgpt-input-container::before {
    content: '';
    position: absolute;
    z-index: -2;
    
    /* Розміри трохи більші за блок */
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border-radius: 30px;
    
    /* Градієнт "Магма" */
    background: linear-gradient(45deg, #ff4500, #ffcc00, #ff4500);
    background-size: 200% 200%;
    
    /* Анімація біжить постійно */
    animation: pulse-glow 6s ease-in-out infinite;
    
    /* Початковий стан: видно */
    opacity: 0.7;
    filter: blur(15px);
    
    /* ВАЖЛИВО: Плавний перехід для зникнення */
    transition: opacity 0.5s ease, filter 0.5s ease;
}

/* --- 2. ШАР СКЛА ( ::after ) --- */
.chatgpt-input-container::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: 20px;
    
    /* Ефект скла */
    background: rgba(40, 40, 40, 0.6); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05);
    
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* --- ПОВЕДІНКА ПРИ НАТИСКАННІ (FOCUS) --- */

/* 1. Анімація плавно розчиняється (але не зупиняється різко!) */
.chatgpt-input-container:focus-within::before {
    opacity: 0;        /* Повна прозорість */
    filter: blur(0px); /* Прибираємо розмиття, щоб не заважало */
    /* animation: none; <--- ПРИБРАЛИ ЦЕЙ РЯДОК, ЩОБ НЕ БУЛО РИВКА */
}

/* 2. Змінюємо вигляд скла на більш темний і зручний для читання */
.chatgpt-input-container:focus-within::after {
    background: rgba(30, 30, 30, 0.95); /* Майже непрозорий фон */
    border-color: rgba(255, 204, 0, 0.3); /* Легка жовта рамка */
}

.chatgpt-input-container:focus-within {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* --- АНІМАЦІЯ --- */
@keyframes pulse-glow {
    0% { opacity: 0.5; filter: blur(8px); background-position: 0% 50%; }
    50% { opacity: 0.8; filter: blur(14px); background-position: 100% 50%; }
    100% { opacity: 0.5; filter: blur(8px); background-position: 0% 50%; }
}

.input-wrapper { flex-grow: 1; display: flex; align-items: center; gap: 8px; }

#streetPrefix {
    background: transparent; border: none; color: #b4b4b4;
    font-family: inherit; font-size: 16px; cursor: pointer; outline: none; padding-right: 5px; font-weight: 500;
}

#streetNamePart {
    width: 100%; background: transparent; border: none; color: white;
    font-size: 16px; font-family: inherit; outline: none; padding: 8px 0;
}
#streetNamePart::placeholder { color: #8e8e8e; }

/* --- НОВІ СТИЛІ ДЛЯ ВИПАДАЮЧОГО СПИСКУ --- */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #000000;
    border: 1px solid #424242;
    border-radius: 0 0 12px 12px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: none;
    margin-top: 10px; /* Відступ від поля */
}

.suggestions-list li {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #424242;
    font-size: 14px;
    color: #ececec;
    transition: background 0.2s;
}

.suggestions-list li:hover {
    background-color: #424242;
}

.suggestions-list li:last-child {
    border-bottom: none;
}
/* ------------------------------------------ */
.quick-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
    margin-bottom: 15px;
}

/* Стиль Glass UI для кнопок */
.glass-chip {
    /* Ефект скла */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari support */
    
    /* Рамка та тіні */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    /* Текст та форма */
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    padding: 14px 28px;
    border-radius: 27px; /* Овальна форма */
    cursor: pointer;
    
    /* Анімація */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px; /* Відступ для емодзі */
}

/* Ефект при наведенні */
.glass-chip:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px); /* Легке підняття */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2); /* Світіння тіні */
}

/* Ефект натискання */
.glass-chip:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.1);
}
.icon-btn {
    background: transparent; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 6px; border-radius: 50%; transition: background 0.2s;
}
.icon-btn:hover { background-color: #424242; }

.send-btn {
    background-color: #676767; width: 32px; height: 32px;
    border-radius: 10px; transition: background-color 0.2s; flex-shrink: 0;
}
.send-btn:hover, .chatgpt-input-container:focus-within .send-btn { background-color: #ffffff; }
.send-btn svg { stroke: #212121; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.footer-text { position: absolute; bottom: 12px; font-size: 11px; color: #9b9b9b; text-align: center; }

/* --- КАРТА --- */
.map-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; visibility: hidden; transition: opacity 0.5s ease; z-index: 1;
}
.map-container.active { opacity: 1; visibility: visible; }
#map { width: 100%; height: 100%; background: #111; }
.map-logo { position: absolute; top: 20px; right: 20px; z-index: 1000; }
.map-logo img { width: 100px; }

/* --- НИЖНЯ ПАНЕЛЬ (LIQUID GLASS STYLE) --- */
.bottom-panel {
    position: fixed; bottom: 0; left: 0; width: 100%;
    z-index: 1000; transform: translateY(120%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none; /* Щоб кліки проходили повз пусті місця */
}
.bottom-panel.active { transform: translateY(0); }

.panel-content {
    pointer-events: auto;
    /* Ефект скла */
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    
    box-shadow: 
        0 -10px 40px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.1); /* Внутрішнє світло зверху */
    
    max-height: 65vh; overflow-y: auto;
    color: white;
}

.panel-title {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Статус - ПРИХОВАНО за запитом */
#status {
    display: none !important;
    margin-bottom: 20px;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.success-msg {
    color: #4ade80 !important;
    background: rgba(74, 222, 128, 0.1) !important;
    border-color: rgba(74, 222, 128, 0.2) !important;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.1);
}
.error-msg {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: rgba(248, 113, 113, 0.2) !important;
}

/* Блок Рекомендацій */
#recommendations {
    display: none;
    margin-top: 20px;
}

.rec-header { 
    margin-bottom: 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.rec-title { font-size: 18px; font-weight: 700; color: #fff; }

/* Стиль для нової кнопки "Детальніше" */
.details-btn {
    font-size: 13px;
    color: #9ca3af;
    background: rgba(255,255,255,0.05);
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}
.details-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Стиль "Картки" для кожного пункту */
.rec-item {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 10px;
    transition: background 0.2s, transform 0.2s;
}
.rec-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.01);
}

.rec-label { color: #9ca3af; font-size: 14px; font-weight: 500; }
.rec-value { color: white; font-weight: 600; font-size: 15px; text-shadow: 0 0 10px rgba(255,255,255,0.1); }
.rec-value small { opacity: 0.6; font-weight: 400; font-size: 0.85em; }

/* КНОПКИ */
.button-group {
    display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap;
}

.button-group button {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    
    /* Ефект скла на кнопках */
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.2); 
}

.button-group button:active { transform: scale(0.96); }
.button-group button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3); }

/* Жовта кнопка (Симуляція) */
/* --- ОБГОРТКА ДЛЯ АНІМАЦІЇ --- */
.sim-wrapper {
    display: flex; /* Щоб кнопки були в ряд */
    flex: 1;       /* Займає місце як звичайна кнопка */
    min-width: 0;  /* Запобігає виходу за межі */
    gap: 0;        /* Початковий відступ 0 */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Спочатку цей блок прихований, як і lightBtn раніше */
    display: none; 
}

/* Коли JS показує кнопку симуляції, ми ставимо display: flex */
.sim-wrapper.visible {
    display: flex;
}

/* --- СТИЛІЗАЦІЯ КНОПКИ СИМУЛЯЦІЇ В СЕРЕДИНІ ГРУПИ --- */
#lightBtn {
    display: block; /* Перебиваємо display:none, бо керуємо через wrapper */
    width: 100%;    /* Займає всю ширину обгортки */
    border-radius: 14px;
    z-index: 2;
    /* Твій існуючий градієнт */
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: #1a1a1a;
    white-space: nowrap; /* Щоб текст не ламався при звуженні */
}

/* --- СТИЛІЗАЦІЯ КНОПКИ HARMONIZE (ПРИХОВАНА) --- */
#harmonizeBtn {
    /* Початковий стан: прихована */
    width: 0;
    flex: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    border: none;
    
    /* Фіолетовий градієнт (гарно пасує до жовтого) */
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    color: white;
    
    /* Спадкуємо загальні стилі кнопок */
    border-radius: 0 14px 14px 0; 
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    
    /* Тіні як у інших кнопок */
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
    
    /* Плавна анімація появи */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#harmonizeBtn:hover {
    filter: brightness(1.1);
}

/* --- АКТИВНИЙ СТАН (ПІСЛЯ НАТИСКАННЯ) --- */

/* 1. Додаємо проміжок між кнопками */
.sim-wrapper.active {
    gap: 10px;
}

/* 2. Симуляція звужується і змінює форму правого кута */
.sim-wrapper.active #lightBtn {
    flex: 1.2; /* Займає трохи більше половини */
    width: auto;
    border-top-right-radius: 6px;    /* Робимо стик більш рівним */
    border-bottom-right-radius: 6px;
}

/* 3. Harmonize з'являється і займає решту місця */
.sim-wrapper.active #harmonizeBtn {
    flex: 1; /* Займає решту простору */
    width: auto;
    opacity: 1;
    padding: 14px; /* Відновлюємо відступи */
    border-top-left-radius: 6px;    /* Робимо стик більш рівним */
    border-bottom-left-radius: 6px;
    border-radius: 6px 14px 14px 6px;
    
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Кнопка переходів (Більш темна, золотиста) */
#crossingsBtn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: none;
}
#crossingsBtn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Червона кнопка (Скинути) - на всю ширину */
#resetBtn {
    flex: 0 0 100%;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    margin-top: 4px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
#resetBtn:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Popup Leaflet styles correction */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.info-popup-row { margin-bottom: 4px; font-size: 13px; }
.info-popup-label { color: #888; margin-right: 6px; }
.crossing-icon { font-size: 20px; text-align: center; line-height: 24px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }