/* ===================================
   CSS Reset and Base Styles
   =================================== */

/* Reset default browser styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Set font family and base styles */
body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    transition: background 0.8s ease-in-out;
    overflow-x: hidden;
}

/* ===================================
   Theme Backgrounds
   =================================== */

/* Default/Sunny theme - warm gradient */
body.sunny {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Cloudy theme */
body.cloudy {
    background: linear-gradient(135deg, #606c88 0%, #3f4c6b 100%);
}

/* Rainy theme - dark blue gradient */
body.rainy {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
}

/* Snowy theme */
body.snowy {
    background: linear-gradient(135deg, #e6dada 0%, #274046 100%);
}

/* Clear night theme */
body.clear-night {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 100%);
}

/* Stormy theme */
body.stormy {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Default theme when no weather data */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===================================
   Container Styles
   =================================== */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
}

/* ===================================
   Header Styles
   =================================== */

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    font-weight: 300;
}

/* ===================================
   Search Box Styles
   =================================== */

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    font-family: inherit;
    outline: none;
}

.search-box input:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.search-box button {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

.search-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.search-box button:active {
    transform: translateY(0);
}

.search-box button svg {
    flex-shrink: 0;
}

/* ===================================
   Loading Spinner Styles
   =================================== */

.loading {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: white;
    font-size: 1.1rem;
    font-weight: 400;
}

/* ===================================
   Error Message Styles
   =================================== */

.error {
    background: rgba(255, 71, 87, 0.9);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    animation: shake 0.5s ease-in-out;
}

.error.hidden {
    display: none;
}

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

/* ===================================
   Weather Result Card Styles
   =================================== */

.weather-result {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px;
    color: white;
    animation: fadeIn 0.6s ease-in-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.weather-result.hidden {
    display: none;
}

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

/* ===================================
   Current Weather Styles
   =================================== */

.current-weather {
    text-align: center;
    margin-bottom: 40px;
}

.location-info h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.location-info p {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 20px;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

#weatherIcon {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.temperature-section {
    display: flex;
    align-items: flex-start;
}

.temperature-section span:first-child {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
}

.temperature-section .unit {
    font-size: 2rem;
    font-weight: 400;
    margin-top: 10px;
}

.condition {
    font-size: 1.3rem;
    font-weight: 400;
    text-transform: capitalize;
    opacity: 0.9;
}

/* ===================================
   Weather Details Grid Styles
   =================================== */

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

.detail-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.detail-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.detail-icon svg {
    color: rgba(255, 255, 255, 0.9);
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-size: 0.85rem;
    opacity: 0.7;
    font-weight: 400;
}

.detail-value {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ===================================
   Forecast Section Styles
   =================================== */

.forecast-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

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

.forecast-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.5s ease-out backwards;
}

.forecast-card:nth-child(1) {
    animation-delay: 0.1s;
}

.forecast-card:nth-child(2) {
    animation-delay: 0.2s;
}

.forecast-card:nth-child(3) {
    animation-delay: 0.3s;
}

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

.forecast-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.forecast-date {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    opacity: 0.9;
}

.forecast-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
}

.forecast-temp {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.forecast-condition {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: capitalize;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablet and smaller screens */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box input,
    .search-box button {
        width: 100%;
        justify-content: center;
    }

    .weather-result {
        padding: 25px 20px;
    }

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

    .temperature-section span:first-child {
        font-size: 4rem;
    }

    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.6rem;
    }

    header p {
        font-size: 0.95rem;
    }

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

    .temperature-section span:first-child {
        font-size: 3rem;
    }

    .temperature-section .unit {
        font-size: 1.5rem;
    }

    #weatherIcon {
        width: 80px;
        height: 80px;
    }

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

    .forecast-container {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Utility Classes
   =================================== */

.hidden {
    display: none !important;
}
