:root {
    --primary: #ffffff;
    --secondary: rgba(255, 255, 255, 0.7);
    --accent: #38bdf8;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --font-main: 'Outfit', sans-serif;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background: var(--bg-dark);
}

/* Dynamic Background Layers */
.bg-dynamic {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    background-attachment: fixed;
    transition: background 1s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 150vw;
    height: 150vh;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.05) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: pulse 15s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

/* Header & Search */
header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header-animate {
    animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-icon {
    color: var(--accent);
    width: 32px;
    height: 32px;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    flex-grow: 1;
    max-width: 500px;
}

.input-wrapper {
    position: relative;
    flex-grow: 1;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

#locationInput {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#locationInput:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

.btn-primary, .btn-secondary {
    padding: 0.85rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 50px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 50px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Display Area */
.display-area {
    position: relative;
    flex-grow: 1;
}

.weather-card {
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.location-info h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.location-info p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.temp-display {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    position: relative;
}

.temp-display .unit {
    font-size: 2rem;
    vertical-align: top;
    margin-top: 1rem;
    display: inline-block;
    color: var(--accent);
}

.condition-info {
    text-align: right;
}

.condition-img {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

#conditionDesc {
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: capitalize;
}

.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.detail-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s ease;
}

.detail-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.detail-item i {
    color: var(--accent);
    width: 24px;
    height: 24px;
}

.label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-text p:last-child {
    font-size: 1.1rem;
    font-weight: 600;
}

/* States */
.state-overlay {
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-icon {
    color: #ef4444;
    width: 60px;
    height: 60px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box {
        width: 100%;
        max-width: none;
    }

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

    .condition-info {
        text-align: center;
    }

    .temp-display {
        font-size: 5rem;
    }

    .location-info h2 {
        font-size: 2rem;
    }
}

.footer {
    margin-top: auto;
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
