:root {
    --bg-primary: #7a8b99;
    --bg-secondary: #b8c4ce;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: white;
    transition: background 0.8s ease;
}

#app-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
}

#image-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#city-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#city-image.loaded {
    opacity: 1;
}

#image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 5;
}

#image-loader.visible {
    opacity: 1;
}

.loader-ring {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#image-loader p {
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#weather-overlay {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    pointer-events: none;
}

#city-name {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 10vw, 4.5rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    margin-bottom: 15px;
    line-height: 1;
}

#weather-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    filter: drop-shadow(0 2px 15px rgba(0, 0, 0, 0.3));
    animation: float 3s ease-in-out infinite;
}

#weather-icon svg {
    width: 100%;
    height: 100%;
    stroke: white;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

#date-display {
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    font-weight: 400;
    opacity: 0.9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}

#temperature {
    font-size: clamp(1.8rem, 6vw, 3rem);
    font-weight: 500;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.02em;
}

#controls-panel {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 92%;
    max-width: 420px;
}

#search-container {
    display: flex;
    gap: 10px;
    width: 100%;
}

#city-input {
    flex: 1;
    padding: 14px 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    transition: all 0.3s ease;
}

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

#city-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
}

#search-btn {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#search-btn svg {
    width: 22px;
    height: 22px;
}

#search-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

#search-btn:active {
    transform: scale(0.95);
}

#quick-cities {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.city-btn {
    padding: 9px 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.city-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.city-btn:active {
    transform: translateY(0);
}

#settings {
    display: flex;
    gap: 10px;
}

#temp-toggle,
#regenerate-btn,
#download-btn {
    padding: 11px 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#regenerate-btn,
#download-btn {
    width: 48px;
    padding: 11px;
}

#regenerate-btn svg,
#download-btn svg {
    width: 20px;
    height: 20px;
}

#temp-toggle:hover,
#regenerate-btn:hover,
#download-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

#regenerate-btn:active,
#download-btn:active {
    transform: translateY(0);
}

footer {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

footer a {
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    transition: color 0.3s ease;
}

footer a:hover {
    color: rgba(255, 255, 255, 0.75);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    #weather-overlay {
        top: 30px;
    }
    
    #controls-panel {
        bottom: 40px;
        gap: 12px;
    }
    
    #quick-cities {
        gap: 6px;
    }
    
    .city-btn {
        padding: 7px 14px;
        font-size: 0.78rem;
    }
    
    #city-input {
        padding: 12px 18px;
        font-size: 0.95rem;
    }
    
    #search-btn {
        width: 48px;
        height: 48px;
    }
    
    #settings {
        gap: 8px;
    }
    
    #temp-toggle {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
    
    #regenerate-btn,
    #download-btn {
        width: 44px;
        padding: 10px;
    }
}

/* Landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
    #weather-overlay {
        top: 15px;
    }
    
    #city-name {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    #weather-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
    }
    
    #temperature {
        font-size: 1.5rem;
    }
    
    #controls-panel {
        bottom: 20px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 90%;
    }
    
    #search-container {
        width: auto;
        flex: 0 0 auto;
    }
    
    #city-input {
        width: 200px;
    }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #controls-panel {
        bottom: calc(50px + env(safe-area-inset-bottom));
    }
    
    footer {
        bottom: calc(14px + env(safe-area-inset-bottom));
    }
}