/* Global & Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg-1: #0f1724;
    --bg-2: #0b1220;
    --accent-1: #00feba;
    --accent-2: #6b5bff;
    --glass: rgba(255, 255, 255, 0.08);
    --muted: rgba(255, 255, 255, 0.85);
    --card-pad: 36px;
    --radius: 18px;
    --transition: 250ms cubic-bezier(.2, .9, .2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

body {
    min-height: 100vh;
    /* Use a single gradient to avoid the 'different color' band at the bottom */
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
    color: var(--muted);
}

/* Card */
.card {
    width: 95%;
    max-width: 520px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border-radius: calc(var(--radius) + 6px);
    padding: var(--card-pad);
    margin: 0px auto 0;
    color: #fff;
    text-align: center;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: visible;
    transition: all var(--transition);
}

.card::before {
    content: '';
    position: absolute;
    /* inset: auto -40% -60% auto; */
  
    width: 180px;
    height: 260px;
    background: linear-gradient(45deg, rgba(0, 254, 186, 0.08), rgba(107, 91, 255, 0.07));
    filter: blur(40px);
    transform: translateY(-20px) rotate(12deg);
    z-index: 0;
}

.card>* {
    position: relative;
    z-index: 1;
}

/* Search */
.search {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
}

.search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 56px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    color: #eafaf6;
    font-size: 16px;
    outline: none;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.35);
}

.search input::placeholder {
    color: rgba(234, 250, 246, 0.6);
    font-weight: 400;
}

.search input:focus {
    box-shadow: 0 8px 30px rgba(0, 246, 174, 0.08);
    transform: translateY(-2px);
    border-color: rgba(0, 254, 186, 0.35);
}

.search button {
    flex: 0 0 56px;
    /* Fixed width for button */
    height: 56px;
    border-radius: 50%;
    border: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
    box-shadow: 0 8px 18px rgba(107, 91, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.search button:hover {
    transform: translateY(-3px);
}

.search button:active {
    transform: translateY(-1px) scale(.99);
}

.search button img {
    width: 18px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

/* Weather */
.weather-icon {
    width: 150px;
    margin-top: 22px;
    transition: transform var(--transition);
    animation: floaty 6s ease-in-out infinite;
}

.weather-icon:hover {
    transform: translateY(-6px);
}

.weather h1 {
    font-size: clamp(36px, 6vw, 72px);
    font-weight: 600;
    margin-top: 6px;
}

.weather h2 {
    font-size: clamp(18px, 3vw, 28px);
    font-weight: 500;
    margin-top: 4px;
    color: rgba(235, 255, 252, 0.9);
}

/* Details */
.details {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-top: 34px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.col {
    display: flex;
    align-items: center;
    text-align: left;
}

.col img {
    width: 38px;
    margin-right: 12px;
    opacity: 0.95;
}

.humidity,
.wind {
    font-size: 22px;
    margin-top: -4px;
    font-weight: 600;
}

/* Error */
.error {
    text-align: left;
    margin-left: 10px;
    margin-top: 15px;
    font-size: 18px;
    display: none;
    color: #ffb4b4;
    font-weight: 600;
}

/* History */
.history {
    margin-top: 26px;
    text-align: left;
}

.history h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
}

.history-list {
    list-style: none;
    padding-left: 0;
    color: rgba(235, 255, 252, 0.9);
}

.history-list li {
    cursor: pointer;
    margin-bottom: 6px;
    font-size: 15px;
    transition: color var(--transition);
}

.history-list li:hover {
    color: var(--accent-1);
}

.clear-btn {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
}

/* Animations */
@keyframes floaty {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .card {
        padding: 28px;
    }

    .weather-icon {
        width: 130px;
    }

    .search input {
        font-size: 14px;
    }

    /* center vertically on smaller screens */
    body {
        align-items: center;
        padding: 40px 12px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px;
        /* margin: 20px auto; */
       
    }

    .weather-icon {
        width: 120px;
    }

    .weather h1 {
        font-size: 48px;
    }

    .weather h2 {
        font-size: 20px;
    }

    .details {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Ensure the card is vertically centered on very small screens */
@media (max-width: 420px) {
    body {
        align-items: center;
    }
}

/* Extra small screens: reduce top/bottom padding to keep the card centered */
@media (max-width: 360px) {
    body {
        padding: 18px 10px;
    }

    .card {
        width: 96%;
    }
}