:root{
    --bg--color1: #003d7a;
    --bg--color2: #001746;
    --aqi-1: #63e157;
    --aqi-2: #698a35;
    --aqi-3: #ffca28;
    --aqi-4: #ff7043;
    --aqi-5: #ef5350;
    font-family: "Iceland","Source Code Pro", Arial;
    font-weight: 400;
    font-style: normal;
}
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    min-height: 100vh;
    background-color: var(--bg--color1);
    color: #fff;
    padding: 0 15px;
}
hr{
    margin-bottom: 10px;
}
p{
    white-space: nowrap; /* Prevent text from wrapping */
    overflow: hidden; /* Hide overflowing text */
    text-overflow: ellipsis; /* Show ellipsis for clipped text */
}
.grid-item {
    white-space: nowrap; /* Prevent text from wrapping */
    overflow: hidden; /* Hide overflowing text */
    text-overflow: ellipsis; /* Show ellipsis for clipped text */
}
.header{
    position: sticky;
    top: 0;
    background-color: var(--bg--color1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 15px 0;
    & #city_input{
        background-color: var(--bg-color2);
        border: none;
        padding: 12px;
        font-size: 20px;
        border-radius: 25px;
        color: #fff;
        font-family: "Iceland","Source Code Pro", Arial;
        font-weight: 400;
        font-style: normal;
        &:focus{
            outline: none;
        }
    }
    & #searchBtn{
        border: none;
        font-size: 18px;
        font-family: "Iceland","Source Code Pro", Arial;
        font-weight: 400;
        font-style: normal;
        padding: 12px;
        border-radius: 25px;
        background-color: #fff;
        cursor: pointer;
    }
    & #locationBtn{
        border: none;
        font-size: 20px;
        font-family: "Iceland","Source Code Pro", Arial;
        font-weight: 400;
        font-style: normal;
        padding: 12px;
        border-radius: 25px;
        background-color: #5eea4b;
        cursor: pointer;
    }
}
.card{
    background-color: var(--bg--color2);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    & p{
        font-size: 20px;
        color: #999;
    }
    & h2{
        font-size: 32px;
        font-weight: 400;
    }
}
.weather-data{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    & .weather-left{
        grid-column:  span 1;
        & .current-weather{
            display: flex;
            justify-content: space-between;
            align-items: center;
            & h2{
                margin: 7px 0;
            }
            & p{
                color: #fff;
            }
        }
        & .card-footer p{
            font-size: 20px;
            margin-bottom: 12px;
        }
        & .forecast-item{
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            place-items: center;
            margin-bottom: 15px;
            & .icon-wrapper{
                display: flex;
                align-items: center;
            }
        }
    }
    & .weather-right{
        grid-column: span 3;
        & h2{
            margin-bottom: 10px;
        }
        & .highlights{
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            column-gap: 15px;
            & .card-head{
                display: flex;
                justify-content: space-between;
                margin-bottom: 10px;
                & .air-index{
                    color: #000;
                    padding: 5px 10px;
                    border-radius: 15px;
                    &.aqi-1{
                        background-color: var(--aqi-1);
                    }
                    &.aqi-2{
                        background-color: var(--aqi-2);
                    }
                    &.aqi-3{
                        background-color: var(--aqi-3);
                    }
                    &.aqi-4{
                        background-color: var(--aqi-4);
                    }
                    &.aqi-5{
                        background-color: var(--aqi-5);
                    }
                }
            }
            & .air-indices{
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                place-items: center;
                & p{
                    text-align: center;
                }
                & h2{
                    text-align: center;
                }
            }
            & .sunrise-sunset{
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                & .item{
                    display: flex;
                    align-items: center;
                    gap: 10px;
                    & h2{
                        margin-top: 15px;
                    }
                }
            }
            & .card-item{
                display: flex;
                justify-content: space-between;
            }
        }
        & .hourly-forecast{
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            column-gap: 10px;
            & .card{
                text-align: center;
            }
        }
    }
}
@media(max-width: 1550px){
    .weather-data{
        grid-template-columns: repeat(3, 1fr);
        & .weather-left{
            & .forecast-item{
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                place-items: center;
                margin-bottom: 15px;
                & .icon-wrapper{
                    display: flex;
                    align-items: center;
                }
            }
        }
        & .weather-right{
            grid-column: span 2;
            & .highlights{
                grid-template-columns: repeat(3, 1fr);
                & .card:nth-of-type(1){
                    grid-column: span 3;
                }
            }
            & .hourly-forecast{
                grid-template-columns: repeat(6, 1fr);
            }
        }
    }
}
@media(max-width: 1250px){
    .weather-data{
        grid-template-columns: 1fr;
        & .weather-left{
            & .forecast-item{
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                place-items: center;
                margin-bottom: 15px;
                & .icon-wrapper{
                    display: flex;
                    align-items: center;
                }
            }
        }
        & .weather-right{
            grid-column: span 2;
            & .highlights{
                grid-template-columns: repeat(1, 1fr);
                & .card:nth-of-type(2){
                    grid-column: span 2;
                }
            }
            & .air-indices{
                grid-template-columns: repeat(3, 1fr);
            }
            & .hourly-forecast{
                grid-template-columns: repeat(4, 1fr);
            }
        }
    }
}
@media(max-width: 1160px){
    .weather-data{
        grid-template-columns: 1fr;
        & .weather-right .highlights{
            & .card:nth-of-type(3),
            & .card:nth-of-type(4),
            & .card:nth-of-type(5),
            & .card:nth-of-type(6),
            & .card:nth-of-type(7){
                grid-column: span 1;
            }
            & .air-indices{
                grid-template-columns: repeat(5, 1fr);
            }
        }
    }
}
@media(max-width: 660px){
    .header{
        flex-direction: column;
        & h2{
            margin-bottom: 8px;
        }
        & #city_input, #searchBtn, #locationBtn{
            width: 100%;
            margin-bottom: 10px;
        }
    }
}
@media(max-width: 580px){
    .weather-data .weather-right .highlights .air-indices{
        grid-template-columns: repeat(4, 1fr);
    }
}
@media(max-width: 520px){
    .weather-data .weather-right .highlights{
        & .card:nth-of-type(3),
        & .card:nth-of-type(4),
        & .card:nth-of-type(5),
        & .card:nth-of-type(6),
        & .card:nth-of-type(7){
            grid-column: span 2;
        }
        & .air-indices{
            grid-template-columns: repeat(3, 1fr);
        }
    }
}
@media(max-width: 480px){
    .weather-data .weather-right.highlights .sunrise-sunset{
        grid-template-columns: 1fr;
    }
}
@media(max-width: 450px){
    .weather-data .weather-right .hourly-forecast{
        grid-template-columns: repeat(3, 1fr);
    }
}
@media(max-width: 380px){
    .weather-data .weather-right .highlights .air-indices{
        grid-template-columns: repeat(2, 1fr);
    }
}