@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');

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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0; /* Màu nền mặc định cho body (Light mode) */
    transition: background-color 0.3s ease; /* Chuyển đổi mượt */
    padding: 20px; /* Thêm padding xung quanh để container không dính sát cạnh màn hình lớn */
    font-family: 'Roboto', sans-serif; /* Đặt font mặc định cho body */
}

/* --- Container Chính --- */
.container {
    position: relative;
    width: 100%; /* Chiếm toàn bộ chiều rộng của body padding */
    max-width: 800px; /* <<----- GIỚI HẠN CHIỀU RỘNG TỐI ĐA LÀ 600PX */
    min-height: 520px; /* Đặt chiều cao tối thiểu */
    background: radial-gradient(rgb(0, 132, 239) 0%, rgb(0, 85, 154) 100%); /* Background mặc định (Light mode) */
    padding: 15px 20px; /* Tăng nhẹ padding bên trong container */
    /* QUAN TRỌNG: Transition cho cả background và box-shadow */
    transition: background 0.3s ease, box-shadow 0.5s ease;
    color: #fff; /* Màu chữ mặc định cho light */
    overflow: hidden; /* Đảm bảo nội dung không tràn ra ngoài */
    border-radius: 15px; /* Thêm bo góc cho mềm mại */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); /* Đổ bóng nhẹ mặc định */
}

/* --- Header --- */
.header__weather {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px; /* Thêm khoảng cách dưới header */
}

/* Icon Menu */
.header__weather > i:first-child {
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

/* Icon Toggle Theme */
#theme-toggle {
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    margin-left: 15px;
    margin-right: 15px;
    transition: color 0.3s ease;
}

/* Tên Thành phố */
.city {
    font-size: 20px;
    font-weight: bold; /* Làm đậm tên thành phố */
    margin-left: auto; /* Đẩy sang phải */
    margin-right: 10px;
    color: #fff;
    transition: color 0.3s ease, opacity 0.3s ease; /* Thêm transition cho opacity */
    opacity: 1;
    visibility: visible;
}

/* Ô tìm kiếm */
.header__weather .search {
    position: relative; /* Bỏ absolute để không bị chồng lấn */
    background: #fff;
    width: 35px; /* Chiều rộng ban đầu */
    height: 35px; /* Đặt chiều cao bằng chiều rộng */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Đẩy icon kính lúp sang phải */
    border-radius: 20px;
    padding: 0 8px; /* Chỉ padding phải cho icon */
    transition: all .5s ease;
    cursor: pointer; /* Thêm cursor pointer khi chưa active */
}

.search i.fa-magnifying-glass {
    cursor: pointer;
    color: #333;
    transition: color 0.3s ease;
    font-size: 14px; /* Chỉnh kích thước icon search */
}

.search input {
    width: 0px;
    background: none;
    border: none;
    outline: none;
    color: #333;
    transition: width 0.5s ease, padding 0.5s ease;
    padding: 0;
    position: absolute; /* Đặt input absolute để không ảnh hưởng width của div.search */
    left: 10px; /* Cách lề trái */
    top: 50%;
    transform: translateY(-50%);
    height: 100%;
}

.search input::placeholder {
    color: #888;
    transition: color 0.3s ease;
}

/* Trạng thái Active của Tìm kiếm */
.city.active {
    opacity: 0;
    visibility: hidden;
}

.search.active {
    width: calc(100% - 100px); /* Chiều rộng khi active, trừ đi khoảng trống cho các icon và city */
    max-width: 200px; /* Giới hạn chiều rộng tối đa của ô search */
    cursor: default; /* Bỏ cursor pointer khi active */
    padding: 0 30px 0 10px; /* Padding để icon không đè input */
}

.search.active i.fa-magnifying-glass {
     position: absolute; /* Đặt lại absolute cho icon khi search active */
     right: 8px;
     top: 50%;
     transform: translateY(-50%);
}


.search.active input {
    width: calc(100% - 15px); /* Chiều rộng input khi search active */
}

/* --- Tabs --- */
.content__header {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* Thêm đường viền dưới cho khu vực tab */
    margin-bottom: 10px; /* Khoảng cách dưới tab */
}

.content__header h3 {
    width: 33.3333%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7); /* Màu chữ tab không active hơi mờ */
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
    padding: 10px 5px; /* Tăng padding cho tab */
    cursor: pointer;
    border-bottom: 3px solid transparent; /* Border dày hơn */
    transition: color 0.3s ease, border-color 0.3s ease;
    margin-bottom: -1px; /* Để border trùng với border của content__header */
}

h3.active {
    color: #fff; /* Màu chữ tab active */
    border-bottom: 3px solid #fff; /* Border active màu trắng */
}

/* --- Nội dung Tab --- */
.body-content {
    display: none;
    position: relative; /* Để box__hourly định vị theo */
    padding-bottom: 80px; /* Thêm padding dưới để box_hourly không che nội dung */
}

.body-content.active {
    display: block;
}

/* Ngày tháng hiện tại/Ngày mai */
.date {
    padding: 5px 0 15px 0; /* Điều chỉnh padding */
    color: rgba(255, 255, 255, 0.8); /* Màu sáng hơn chút */
    font-size: 14px;
    text-align: center;
    transition: color 0.3s ease;
}

/* --- Box Nhiệt độ (Hôm nay & Ngày mai) --- */
.box-temperature,
.box-temperature__tomorrow {
    display: flex;
    flex-wrap: wrap; /* Cho phép xuống dòng nếu cần */
    color: #fff;
    transition: color 0.3s ease;
    margin-bottom: 15px; /* Khoảng cách dưới box nhiệt độ */
}

.box-temperature .item,
.box-temperature__tomorrow .item__tomorrow {
    width: 50%; /* Giữ nguyên 50% */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0; /* Giảm padding dọc */
}

/* Item nhiệt độ chính */
.box-temperature .item:first-child,
.box-temperature__tomorrow .item__tomorrow:first-child {
     align-items: center; /* Căn giữa nhiệt độ và icon chính */
     padding-right: 10px; /* Khoảng cách giữa 2 cột */
}

/* Item thông tin phụ (gió, mây,...) */
.box-temperature .item:last-child,
.box-temperature__tomorrow .item__tomorrow:last-child {
    align-items: flex-start; /* Căn trái thông tin phụ */
    padding-left: 10px; /* Khoảng cách giữa 2 cột */
    justify-content: center; /* Căn giữa theo chiều dọc */
}

/* Nhiệt độ chính */
.item .temperature,
.item__tomorrow .temperature {
    font-size: 60px; /* Tăng kích thước nhiệt độ */
    font-weight: 300; /* Font mỏng hơn */
    line-height: 1;
    margin-bottom: 5px; /* Giảm khoảng cách dưới nhiệt độ */
    display: flex; /* Để sắp xếp sup */
    align-items: flex-start; /* Căn sup lên trên */
}

.temperature sup {
    font-size: 18px; /* Tăng kích thước độ C */
    font-weight: normal;
    margin-left: 2px;
}

.temperature sup .fa-circle {
    font-size: 8px; /* Kích thước icon tròn */
    vertical-align: top;
    margin-right: 1px;
}

/* Icon thời tiết chính (Hôm nay) */
.box-temperature .item:first-child .icon img {
     width: 60px; /* Kích thước icon nhỏ hơn nhiệt độ */
     height: 60px;
     object-fit: contain;
}

/* Mô tả thời tiết (Hôm nay) */
.item:last-child .textWeather {
     font-size: 16px;
     font-weight: bold;
     margin-bottom: 10px; /* Khoảng cách dưới mô tả */
     text-align: left; /* Đảm bảo căn trái */
     width: 100%; /* Chiếm đủ rộng */
}

/* Icon (Ngày mai) */
.item__tomorrow .icon img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px; /* Khoảng cách dưới icon ngày mai */
}

/* Mô tả thời tiết (Ngày mai) */
.textWeatherTomorrow {
    font-size: 16px;
    font-weight: bold;
    text-align: left; /* Căn trái */
    width: 100%;
    margin-bottom: 10px;
}

/* Chi tiết thời tiết (gió, mây,...) */
.weather__data {
    font-size: 13px;
    line-height: 1.8; /* Tăng khoảng cách dòng */
    text-align: left;
    width: 100%; /* Đảm bảo chiếm đủ rộng */
}
.weather__data div, .item:last-child p {
     display: flex; /* Sắp xếp icon và text */
     align-items: center;
}

.weather__data i,
.item:last-child p i {
    margin-right: 8px; /* Tăng khoảng cách icon */
    width: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8); /* Màu icon hơi mờ */
}
/* Màu icon mặt trời/mặt trăng */
.item:last-child .sunrise i { color: #FFEB3B; }
.item:last-child .sunset i { color: #FF9800; }


/* --- Box Hourly --- */
.box__hourly {
    position: absolute; /* Giữ absolute để nằm dưới cùng */
    width: 100%;
    left: 0;
    bottom: 0; /* Nằm sát đáy container */
    display: flex;
    justify-content: space-around; /* Phân bố đều các item */
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    padding: 5px 0; /* Giảm padding */
}

.box__hourly .item__hourly {
    flex: 1; /* Các item tự chia đều không gian */
    max-width: 60px; /* Giới hạn chiều rộng tối đa mỗi item */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 5px 0;
}

.item__hourly img {
    width: 35px; /* Kích thước icon hourly */
    height: 35px;
    object-fit: contain;
    margin-bottom: 5px;
}

.item__hourly span.temp_hourly {
    font-size: 14px;
    font-weight: bold;
}

.time__hourly {
    padding: 0 0 5px 0;
    font-size: 11px;
    opacity: 0.8; /* Thời gian hơi mờ */
}

/* --- Box Date (Theo ngày) --- */
.boxDate {
    width: 100%;
    color: #fff;
    overflow-y: auto; /* Vẫn giữ scroll nếu cần */
    max-height: calc(100% - 50px); /* Tính toán lại max-height nếu cần */
    transition: color 0.3s ease;
    padding-bottom: 0 !important; /* Ghi đè padding-bottom của body-content */
}

.item_date {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 0px; /* Tăng padding cho dễ nhìn */
    transition: border-color 0.3s ease;
}

.item_date:last-child {
    border-bottom: none;
}

.textItem-date {
    line-height: 1.5;
    margin-right: 10px;
    flex-grow: 1; /* Cho phép phần text chiếm không gian thừa */
}
.textItem-date .title-textItem {
     font-size: 14px; /* Tăng kích thước ngày */
     font-weight: bold;
     margin-bottom: 2px;
}

.textItem-date .desciption {
    font-size: 13px;
    opacity: 0.8;
}

.temperatureItem-date {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Không cho phép co lại */
}

.icon-date {
    width: 40px;
    height: 40px;
    margin-right: 10px; /* Tăng khoảng cách icon và nhiệt độ */
}

.icon-date img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.temp_max {
    font-size: 18px;
    font-weight: bold;
    min-width: 35px; /* Đảm bảo có khoảng trống cho nhiệt độ */
    text-align: right;
}

/* --- Class Hide --- */
.hide {
    display: none !important; /* Dùng !important để đảm bảo ẩn */
}


/* ---- DARK MODE STYLES ---- */
body.dark-mode-active {
    background-color: #121212; /* Màu nền tối cho body */
}

.container.dark-mode {
    background: radial-gradient(rgb(28, 34, 48) 0%, rgb(17, 20, 27) 100%); /* Màu nền dark mode */
    color: #e0e0e0; /* Màu chữ chính trong dark mode */

    /* ---- HIỆU ỨNG NEON GLOW ĐỘNG ---- */
    /* Áp dụng animation thay vì box-shadow tĩnh */
    animation: neon-glow-animation 3s ease-in-out infinite;
    /* Xóa box-shadow tĩnh cũ nếu có */
    box-shadow: none;
}

/* Header Dark Mode */
.container.dark-mode .header__weather > i:first-child,
.container.dark-mode .city,
.container.dark-mode #theme-toggle {
    color: #e0e0e0;
}
.container.dark-mode .header__weather .search {
    background: #333;
}
.container.dark-mode .search input {
    color: #e0e0e0;
}
.container.dark-mode .search input::placeholder {
    color: #888;
}
.container.dark-mode .search i.fa-magnifying-glass {
    color: #bbb;
}

/* Tabs Dark Mode */
.container.dark-mode .content__header {
     border-bottom-color: rgba(255, 255, 255, 0.15);
}
.container.dark-mode .content__header h3 {
    color: rgba(224, 224, 224, 0.6);
}
.container.dark-mode h3.active {
    color: #fff;
    border-bottom-color: #fff;
}

/* Date text Dark Mode */
.container.dark-mode .date {
    color: rgba(224, 224, 224, 0.7);
}

/* Box Temperature Dark Mode */
.container.dark-mode .box-temperature,
.container.dark-mode .box-temperature__tomorrow {
    color: #e0e0e0;
}
.container.dark-mode .weather__data,
.container.dark-mode .item:last-child p {
     color: #ccc;
}
.container.dark-mode .weather__data i,
.container.dark-mode .item:last-child p i {
    color: rgba(224, 224, 224, 0.7);
}
.container.dark-mode .item:last-child .sunrise i { color: #FFEB3B; }
.container.dark-mode .item:last-child .sunset i { color: #FF9800; }


/* Box Hourly Dark Mode */
.container.dark-mode .box__hourly {
    color: #e0e0e0;
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Box Date Dark Mode */
.container.dark-mode .boxDate {
    color: #e0e0e0;
}
.container.dark-mode .item_date {
    border-bottom-color: rgba(255, 255, 255, 0.15);
}
.container.dark-mode .textItem-date .desciption {
    opacity: 0.7;
}

/* ---- KEYFRAMES CHO HIỆU ỨNG NEON ---- */
/* (Đặt ở cuối file) */
@keyframes neon-glow-animation {
    0% {
        box-shadow:
            0 0 5px rgba(0, 255, 255, 0.7),
            0 0 10px rgba(0, 255, 255, 0.5),
            0 0 18px rgba(0, 255, 255, 0.3),
            0 0 30px rgba(0, 255, 255, 0.15);
    }
    50% {
        box-shadow:
            0 0 7px rgba(0, 255, 255, 0.9),
            0 0 15px rgba(0, 255, 255, 0.7),
            0 0 25px rgba(0, 255, 255, 0.5),
            0 0 40px rgba(0, 255, 255, 0.25);
    }
    100% {
         box-shadow:
            0 0 5px rgba(0, 255, 255, 0.7),
            0 0 10px rgba(0, 255, 255, 0.5),
            0 0 18px rgba(0, 255, 255, 0.3),
            0 0 30px rgba(0, 255, 255, 0.15);
    }
}