/* ========================================
   Weather App - Modern Glassmorphism Design
   ======================================== */

:root {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --bg-card: rgba(255, 255, 255, 0.08);
    --bg-card-hover: rgba(255, 255, 255, 0.12);
    --accent-warm: #f39c12;
    --accent-blue: #3498db;
    --accent-purple: #9b59b6;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(243, 156, 18, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(52, 152, 219, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(155, 89, 182, 0.05) 0%, transparent 30%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

/* ========================================
   Header
   ======================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: slideDown 0.6s ease-out;
}

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

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

.logo-icon {
    font-size: 2.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Box */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    min-width: 250px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--accent-warm);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.2);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    margin-left: 0.75rem;
    flex-shrink: 0;
}

#city-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
}

#city-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: linear-gradient(135deg, var(--accent-warm), #e67e22);
    border: none;
    border-radius: var(--radius-md);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.search-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

/* Suggestions Dropdown */
.suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

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

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-item:hover {
    background: var(--bg-card-hover);
}

.suggestion-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* ========================================
   Loading State
   ======================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    animation: fadeIn 0.3s ease;
}

.loader {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.sun {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-warm), #f1c40f);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 30px rgba(243, 156, 18, 0.6);
    animation: sunPulse 1.5s infinite;
}

@keyframes sunPulse {
    0%, 100% { 
        box-shadow: 0 0 30px rgba(243, 156, 18, 0.6);
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        box-shadow: 0 0 50px rgba(243, 156, 18, 0.8);
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: rotate 8s linear infinite;
}

.ray {
    position: absolute;
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, var(--accent-warm), transparent);
    transform-origin: center bottom;
    left: 50%;
    margin-left: -1px;
    bottom: 50%;
}

.ray:nth-child(1) { transform: rotate(0deg); }
.ray:nth-child(2) { transform: rotate(45deg); }
.ray:nth-child(3) { transform: rotate(90deg); }
.ray:nth-child(4) { transform: rotate(135deg); }
.ray:nth-child(5) { transform: rotate(180deg); }
.ray:nth-child(6) { transform: rotate(225deg); }
.ray:nth-child(7) { transform: rotate(270deg); }
.ray:nth-child(8) { transform: rotate(315deg); }

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ========================================
   Weather Content
   ======================================== */
.weather-content {
    animation: fadeIn 0.5s ease;
}

/* Current Weather Section */
.current-weather {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    backdrop-filter: blur(10px);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.weather-main {
    text-align: center;
    margin-bottom: 2rem;
}

.location-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.location-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-warm);
}

#city-name {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 600;
}

.country-code {
    background: var(--accent-blue);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.temperature-display {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin: 1rem 0;
}

.temp-value {
    font-family: 'Outfit', sans-serif;
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: tempGlow 3s infinite;
}

@keyframes tempGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(243, 156, 18, 0.3)); }
    50% { filter: drop-shadow(0 0 20px rgba(243, 156, 18, 0.5)); }
}

.temp-unit {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.weather-condition {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.weather-icon-large {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

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

.condition-text {
    font-size: 1.25rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Weather Details Grid */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.detail-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease-out backwards;
}

.detail-card:nth-child(1) { animation-delay: 0.1s; }
.detail-card:nth-child(2) { animation-delay: 0.2s; }
.detail-card:nth-child(3) { animation-delay: 0.3s; }
.detail-card:nth-child(4) { animation-delay: 0.4s; }

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

.detail-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.detail-card svg {
    width: 28px;
    height: 28px;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

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

.detail-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.unit-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.unit-btn:hover {
    background: var(--bg-card-hover);
}

.unit-btn.active {
    background: linear-gradient(135deg, var(--accent-warm), #e67e22);
    border-color: transparent;
    color: white;
}

/* ========================================
   Forecast Section
   ======================================== */
.forecast-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.section-title svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

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

.forecast-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: slideUp 0.5s ease-out backwards;
}

.forecast-card:nth-child(1) { animation-delay: 0.1s; }
.forecast-card:nth-child(2) { animation-delay: 0.15s; }
.forecast-card:nth-child(3) { animation-delay: 0.2s; }
.forecast-card:nth-child(4) { animation-delay: 0.25s; }
.forecast-card:nth-child(5) { animation-delay: 0.3s; }
.forecast-card:nth-child(6) { animation-delay: 0.35s; }
.forecast-card:nth-child(7) { animation-delay: 0.4s; }

.forecast-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.forecast-day {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.forecast-icon {
    font-size: 2.5rem;
    margin: 0.5rem 0;
    animation: float 3s ease-in-out infinite;
}

.forecast-temp {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.temp-high {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--accent-warm);
}

.temp-low {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: var(--accent-blue);
}

.forecast-precip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.forecast-precip svg {
    width: 14px;
    height: 14px;
    color: var(--accent-blue);
}

/* ========================================
   Recent Searches
   ======================================== */
.recent-searches {
    margin-bottom: 1.5rem;
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.recent-item {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.recent-item svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   Error State
   ======================================== */
.error-message {
    background: var(--bg-card);
    border: 1px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    animation: shake 0.5s ease;
}

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

.error-message svg {
    width: 48px;
    height: 48px;
    color: var(--danger);
    margin-bottom: 1rem;
}

.error-message h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.error-message p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.retry-btn {
    background: linear-gradient(135deg, var(--accent-blue), #2980b9);
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--accent-warm);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .logo {
        justify-content: center;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .temp-value {
        font-size: 4.5rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .current-weather {
        padding: 1.5rem;
    }
    
    #city-name {
        font-size: 1.8rem;
    }
    
    .temp-value {
        font-size: 3.5rem;
    }
    
    .weather-details {
        grid-template-columns: 1fr 1fr;
    }
    
    .detail-card {
        padding: 1rem;
    }
    
    .forecast-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Scrollbar Styling
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Selection */
::selection {
    background: var(--accent-warm);
    color: white;
}
