:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 1rem;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--background);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: slideIn 0.5s ease-out;
}

.unit-toggle {
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.unit-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.search-container {
    width: 100%;
    max-width: 32rem;
    margin: 0 auto 2rem;
    animation: slideUp 0.5s ease-out;
}

form {
    display: flex;
    gap: 0.75rem;
}

input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

form button {
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

form button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.error-message {
    color: #dc2626;
    text-align: center;
    margin: 1rem 0;
    min-height: 1.5rem;
    font-weight: 500;
    animation: shake 0.5s ease-out;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 1s linear infinite;
}

.current-weather {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 2rem 0;
    transition: var(--transition);
    animation: slideUp 0.5s ease-out;
}

.current-weather:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.weather-info {
    margin-top: 1.5rem;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.weather-icon {
    font-size: 5rem;
    animation: bounceIn 0.5s ease-out;
}

.temperature {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.description {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f1f5f9;
}

.detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail span:first-child {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail span:last-child {
    font-size: 1.5rem;
    font-weight: 600;
}

.forecast {
    margin-top: 2rem;
    animation: slideUp 0.75s ease-out;
}

.forecast h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.forecast-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.forecast-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.forecast-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.forecast-card .date {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.forecast-card .temp-high {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
}

.forecast-card .temp-low {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-top: 0.25rem;
}

.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .weather-main {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .weather-details {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .forecast-card {
        padding: 1rem;
    }

    form {
        flex-direction: column;
    }

    form button {
        width: 100%;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --card-bg: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
    }

    input {
        color: var(--text-primary);
    }

    .unit-toggle {
        background: transparent;
    }
}
