*,*::before,*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --colorDark1: #112D4E;
    --colorDark2: #3F72AF;
    --colorLight1: #DBE2EF;
    --colorLight2: #F9F7F7;
    
    --bg-color-1: #112D4E;
    --bg-color-2: #3F72AF;
    --text-color: #F9F7F7;
    --btn-color: var(--colorDark2);
    --card-bg: rgba(219, 226, 239, 0.5);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

body.dark-mode {
    --bg-color-1: #121212;
    --bg-color-2: #2d2d2d;
    --text-color: #ffffff;
    --btn-color: #444444;
    --card-bg: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(0, 0, 0, 0.25);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

body {
    max-width: 100vw;
    min-height: 100vh;
    color: var(--text-color);
    background-color: var(--bg-color-1);
    background-image: linear-gradient(160deg, var(--bg-color-1) 0%, var(--bg-color-2) 100%);
}

/* header and Tab styles */

h1 {
    text-align: center;
    margin-block: 2rem;
    text-transform: uppercase;
    word-spacing: 2px;
    letter-spacing: 1.75px;
}

.tab-container {
    width: 90%;
    margin: 0 auto;
    margin-top: 4rem;
    max-width: 550px;
    display: flex;
    justify-content: space-between;
}

.tab {
    cursor: pointer;
    font-size: 0.875rem;
    letter-spacing: 1.75px;
    padding: 5px 8px;
}

.tab.current-tab {
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
}

.weather-container {
    margin-block: 4rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }

    .tab-container {
        margin-top: 2rem;
        width: 80%;
    }

    .tab {
        font-size: 0.75rem;
    }
}

/* button */
.btn {
    all: unset;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 12px 35px;
    border-radius: 25px;
    cursor: pointer;
    background-color: var(--btn-color);
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    background-color: #2b5486;
}

.sub-container {
    width: 90%;
    margin: 0 auto;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* user weather styles */
.grant-location-container {
    display: none;
}

.grant-location-container.active{
    display: flex;
}

.grant-location-container img {
    margin-bottom: 2rem;
}

.grant-location-container p:first-of-type {
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
}

.grant-location-container p:last-of-type {
    font-size: 0.85rem;
    font-weight: 300;
    margin-top: 0.75rem;
    margin-bottom: 1.75rem;
    letter-spacing: 0.75px;
    text-align: center;
}

.loading-container {
    display: none;
}

.loading-container.active {
    display: flex;
}

.loading-container p {
    text-transform: uppercase;
}

.api-error-container {
    display: none;
}

.api-error-container.active {
    display: flex;
    gap: 1rem 0;
}

.api-error-container p {
    text-align: center;
}

.api-error-container img {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.user-info-container {
    display: none;
}

.user-info-container p {
    font-size: 1.5rem;
    font-weight: 200;
}

.user-info-container img {
    width: 90px;
    height: 90px;
}

.name {
    display: flex;
    align-items: center;
    gap: 0 0.5rem;
    margin-bottom: 1rem;
}

.name p {
    font-size: 2rem;
}

.name img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.user-info-container p[data-temp] {
    font-size: 2.75rem;
    font-weight: 700;
}

.user-info-container.active {
    display: flex;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.parameter-container {
    width: 90%;
    margin: 0 auto;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.parameter {
    width: 30%;
    max-width: 200px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 10px 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.parameter:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
}

.parameter img {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.parameter-title {
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
}

.parameter-value {
    font-size: 1rem;
    font-weight: 200;
}

@media (max-width: 768px) {
    .parameter-container {
        flex-direction: column;
        align-items: center;
    }

    .parameter {
        width: 100%;
    }
}

/* search weather styles */
.form-container{
    width: 90%;
    max-width: 550px;
    margin: 0 auto;
    margin-bottom: 3rem;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0 10px;
}

.form-container.active {
    display: flex;
}

.form-container input {
    all: unset;
    width: calc(100% - 80px);
    height: 40px;
    padding: 0 20px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    transition: outline 0.3s ease;
}

.form-container input:focus {
    outline: 3px solid rgba(255, 255, 255, 0.7);
}

.form-container input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.form-container .btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: unset;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.form-container .btn:hover {
    transform: scale(1.1);
}

.form-container .btn img {
    object-fit: contain;
}

/* Theme Toggle Slider */
.theme-toggle-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem 2rem 0;
    gap: 10px;
    width: 100%;
}

.theme-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.4);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Recent Searches */
.recent-searches-container {
    width: 90%;
    max-width: 550px;
    margin: 0 auto 2rem;
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.recent-searches-container.active {
    display: flex;
}

.recent-search-chip {
    padding: 5px 15px;
    font-size: 0.8rem;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recent-search-chip:hover {
    background-color: var(--btn-color);
    transform: translateY(-2px);
}

/* Local Time & Emoji */
.local-time {
    font-size: 0.9rem;
    font-weight: 300;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.parameter-emoji {
    font-size: 2rem;
    margin-bottom: 5px;
}

/* Forecast Styles */
.forecast-container {
    width: 90%;
    margin: 2rem auto 0;
    max-width: 800px;
}

.forecast-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.forecast-cards {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
}

.forecast-cards::-webkit-scrollbar {
    height: 6px;
}
.forecast-cards::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.forecast-card {
    min-width: 120px;
    flex: 1;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px 0;
    transition: transform 0.3s ease;
}

.forecast-card:hover {
    transform: translateY(-5px);
}

.forecast-card p.day {
    font-weight: 600;
    font-size: 1.1rem;
}

.forecast-card img {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.forecast-card p.temp {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Footer Styles */
.app-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 2rem;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .theme-toggle-container {
        padding: 1rem 1rem 0;
        justify-content: center;
    }

    .theme-label {
        font-size: 0.8rem;
    }

    .switch {
        width: 44px;
        height: 22px;
    }

    .slider:before {
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
    }

    input:checked + .slider:before {
        transform: translateX(22px);
    }
}