:root {
    /* Darker glass for better contrast */
    --glass: rgba(0, 0, 0, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --accent: #00d4ff;
}

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

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Keeps the vibrant animated background */
    background: linear-gradient(45deg, #FF3CAC, #784BA0, #2B86C5);
    background-size: 400% 400%;
    animation: gradientBG 10s ease infinite;
    color: var(--text);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* THE CARD - Now darker and more solid */
.card {
    background: var(--glass);
    /* High blur to hide the background details behind text */
    backdrop-filter: blur(25px); 
    -webkit-backdrop-filter: blur(25px);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    width: 90%;
    max-width: 420px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    /* Lighter background to pop against the dark card */
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 12px 20px;
    margin-bottom: 30px;
    transition: background 0.3s;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
}

input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

button {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: transform 0.2s, color 0.2s;
}

button:hover {
    transform: scale(1.1);
    color: var(--accent);
}

/* Weather Info */
.weather-data {
    opacity: 1;
    transition: opacity 0.4s ease;
}

.weather-data.hidden {
    display: none;
    opacity: 0;
}

.city-name {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.temp-box {
    margin: 25px 0;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.temperature {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    background: -webkit-linear-gradient(#fff, #bbb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.unit {
    font-size: 2rem;
    vertical-align: top;
    color: var(--accent);
    font-weight: 400;
}

.condition {
    font-size: 1.3rem;
    margin-bottom: 35px;
    font-weight: 400;
    text-transform: capitalize;
    color: #eee;
    background: rgba(255,255,255,0.1);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
}

.details {
    display: flex;
    justify-content: space-around; /* Better spacing */
    padding: 0 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.val {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
}

/* Loader & Error */
.loader {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 30px auto;
    display: none;
}

.error-msg {
    color: #ff6b6b;
    background: rgba(255, 0, 0, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    font-size: 0.95rem;
    animation: shake 0.5s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}