/* Reset and base styles */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

:root {
    --primary-color: #4361ee;
    --primary-light: #5a7bff;
    --primary-dark: #3a56d4;
    --secondary-color: #ff7e33;
    --background-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-color: #2d3436;
    --text-muted: #636e72;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --glass-effect: backdrop-filter: blur(10px) saturate(180%);
    --glass-bg: rgba(255, 255, 255, 0.7);
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 10;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 2.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-container {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    border-radius: 50px;
    overflow: hidden;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.search-container:focus-within {
    box-shadow: 0 5px 20px rgba(67, 97, 238, 0.2);
    transform: translateY(-2px);
}

#location-input {
    flex: 1;
    padding: 15px 25px;
    border: none;
    background: transparent;
    font-size: 1.05rem;
    color: var(--text-color);
    outline: none;
    transition: var(--transition);
}

#location-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 25px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

button:hover {
    background: var(--primary-dark);
    transform: none;
}

#search-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

#location-btn {
    background: var(--secondary-color);
    padding: 0 20px;
}

#location-btn:hover {
    background: #ff6a1a;
}

/* Current weather styles */
.current-weather {
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    margin: 0 auto 40px;
    max-width: 900px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.current-weather::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
    z-index: 0;
}

.weather-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.weather-icon {
    font-size: 8rem;
    color: var(--secondary-color);
    text-align: center;
    min-width: 180px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: var(--transition);
}

.current-temp {
    font-size: 4.5rem;
    font-weight: 700;
    margin: 5px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.weather-condition {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.9;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.weather-details > div {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.6);
    padding: 12px 16px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.weather-details > div:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.weather-details i {
    color: var(--primary-color);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 8px;
    padding: 5px;
}

/* Forecast styles */
.forecast {
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin: 0 auto 40px;
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.forecast::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
    z-index: 0;
}

.forecast h3 {
    margin: 0 0 25px 0;
    color: var(--primary-color);
    font-size: 1.7rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.forecast h3::before {
    content: '\f073';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.2em;
    opacity: 0.8;
}

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

.forecast-item {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
    transition: var(--transition);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.forecast-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    opacity: 0.8;
}

.forecast-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.forecast-day {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.forecast-icon {
    font-size: 2.5rem;
    margin: 10px 0;
    color: var(--secondary-color);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forecast-condition {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forecast-temp {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    font-size: 1.1rem;
}

.temp-max {
    font-weight: 600;
    color: var(--primary-color);
}

.temp-min {
    color: var(--text-muted);
    opacity: 0.8;
}

/* Unit toggle */
.unit-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 8px;
    background: var(--glass-bg);
    border-radius: 50px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.unit-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.unit-toggle button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-muted);
    background: transparent;
    border: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.unit-toggle button:hover {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
}

.unit-toggle button.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

/* Loading spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.loading.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(67, 97, 238, 0.1);
    border-top-color: var(--primary-color);
    border-right-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 20px;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    border: 2px dashed rgba(67, 97, 238, 0.2);
    border-radius: 50%;
    animation: spinReverse 3s linear infinite;
}

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

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

.loading p {
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive styles */
@media (max-width: 768px) {
    .current-weather {
        flex-direction: column;
        text-align: center;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .forecast-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .current-temp {
        font-size: 3rem;
    }
    
    .weather-icon {
        font-size: 6rem;
    }
}

/* Error message */
.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}
