/* 1. Сброс и базовые настройки */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Небесный градиент */
    background: linear-gradient(to bottom, #89f7fe, #66a6ff);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Скрываем полосы прокрутки */
    position: relative;
}

/*КОНТЕЙНЕР С ОБЛАКАМИ (ЗАДНИЙ ФОН)
 */
#background-wrap {
    position: absolute; /* Абсолютное позиционирование */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1; /* !ВАЖНО! Уводим облака на самый задний план */
    overflow: hidden;
}

/* Анимация движения */
@keyframes animateCloud {
    0% { margin-left: -1000px; }
    100% { margin-left: 100%; }
}

/* Рисуем облака */
.cloud {
    background: #fff;
    background: linear-gradient(to bottom,  #fff 5%, #f1f1f1 100%);
    border-radius: 100px;
    box-shadow: 0 8px 5px rgba(0, 0, 0, 0.1);
    height: 120px;
    position: relative;
    width: 350px;
}

.cloud:after, .cloud:before {
    background: #fff;
    content: '';
    position: absolute;
    z-index: -1;
}

.cloud:after {
    border-radius: 100px;
    height: 100px;
    left: 50px;
    top: -50px;
    width: 100px;
}

.cloud:before {
    border-radius: 200px;
    height: 180px;
    left: 110px;
    top: -90px;
    width: 180px;
}

/* Размеры и скорость разных облаков */
.x1 { animation: animateCloud 35s linear infinite; transform: scale(0.65); }
.x2 { animation: animateCloud 20s linear infinite; transform: scale(0.3); }
.x3 { animation: animateCloud 30s linear infinite; transform: scale(0.5); }
.x4 { animation: animateCloud 18s linear infinite; transform: scale(0.4); }
.x5 { animation: animateCloud 25s linear infinite; transform: scale(0.55); }

/*КАРТОЧКА (ПЕРЕДНИЙ ПЛАН)
 */
.container {
    background: rgba(255, 255, 255, 0.3); /* Прозрачный белый */
    backdrop-filter: blur(15px);          /* Размытие фона */
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    text-align: center;
    width: 90%;
    max-width: 450px;

    position: relative;
    z-index: 10;
}

h1 {
    color: #1e3a8a; /* Тёмно-синий цвет  */
    text-shadow: 0 1px 2px rgba(255,255,255, 0.5);
    margin-bottom: 20px;
    font-size: 32px;
    font-weight: 800;
}

/*ЭЛЕМЕНТЫ УПРАВЛЕНИЯ*/
form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    position: relative;
    z-index: 20; /* Дополнительная страховка для кнопки */
}

input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button {
    padding: 12px 25px;
    background-color: #3b82f6; /* Синий цвет */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: transform 0.2s, background 0.3s;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

button:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

/*ВЫВОД ПОГОДЫ*/
.weather-info img {
    width: 100px;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
}

.temp {
    font-size: 64px;
    font-weight: 700;
    margin: 0;
    color: #fff;
    text-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.desc {
    font-size: 20px;
    text-transform: capitalize;
    color: #f0f9ff;
    margin-bottom: 20px;
}

.details {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    padding-top: 20px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
}

.error-message {
    background: rgba(255, 82, 82, 0.9);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: bold;
}
/* 1. Темное небо */
body.night {
    /* Темно-синий градиент (Космос) */
    background: linear-gradient(to bottom, #020111 10%, #3a3a52 100%);
    color: white; /* Весь текст белый */
}

/* --- ЗВЕЗДЫ (Рисуем кодом, без картинок) --- */

.stars {
    position: fixed; /* Фиксируем, чтобы не уезжали */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Чтобы сквозь них можно было кликать */
    z-index: -5; /* На самом заднем плане */
    display: none; /* Днем скрыты */
}

/* Включаем только ночью */
body.night .stars {
    display: block;
    /* Рисуем звезды градиентами (белые точки на прозрачном фоне) */
    background-image:
        radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));

    background-repeat: repeat;
    background-size: 200px 200px; /* Повторяем этот узор каждые 200px */

    /* Анимация мерцания */
    animation: twinkle 4s infinite ease-in-out;
}

/* Эффект мерцания (то ярче, то тусклее) */
@keyframes twinkle {
    0% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0.5; transform: scale(1); }
}

/* Фон космоса (градиент) */
body.night {
    background: linear-gradient(to bottom, #090a2e 0%, #2b32b2 100%);
}

/* 3. Меняем цвет облаков ночью (чтобы не были слишком яркими) */
body.night .cloud {
    background: linear-gradient(to bottom, #cfcfff 5%, #8989a8 100%);
}
body.night .cloud:after, body.night .cloud:before {
    background: #cfcfff;
}

/* 4. Меняем цвет заголовка ночью */
body.night h1 {
    color: #ffd700; /* Золотой цвет луны */
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Анимация мерцания звезд */
@keyframes move-twink-back {
    from {background-position:0 0;}
    to {background-position:-10000px 5000px;}
}
/* --- КРУПНАЯ ПОГОДА --- */

/* Контейнер для иконки и цифры */
.main-weather {
    display: flex;
    flex-direction: column; /* Элементы друг под другом */
    align-items: center;
    margin: 10px 0;
}

/* Сама иконка погоды побольше */
.weather-icon {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.5)); /* Подсветка иконки */
}

/* ОГРОМНАЯ ТЕМПЕРАТУРА */
.temp-big {
    font-size: 90px; /* Очень крупно */
    font-weight: 800; /* Очень жирно */
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3); /* Тень для объема */
    margin-top: -10px; /* Чуть подтянем к иконке */
}

/* Описание (Облачно и т.д.) */
.desc {
    font-size: 24px;
    text-transform: capitalize; /* Первая буква заглавная */
    margin-bottom: 25px;
    opacity: 0.9;
    color: #f0f9ff;
}

/* НОЧНОЙ РЕЖИМ для текста */
body.night .temp-big {
    color: #ffd700; /* Золотой цвет цифр ночью */
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6); /* Сильное золотое свечение */
}

body.night .desc {
    color: #ddd;
}