/* Modern CSS Reset */
:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #3f37c9;
    --accent: #f72585;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --text: #7b80bf;
    --text-light: #8d99ae;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    min-height: 100vh;
    overflow-x: hidden;
}

.weather-app {
    position: relative;
    min-height: 100vh;
    padding: 2rem;
}

.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #533483);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    z-index: -1;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

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

.branding h1 span {
    color: var(--primary-light);
    font-weight: 800;
}

.branding p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
}

.search-box {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

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

#location-input {
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    min-width: 300px;
    outline: none;
}

#location-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#search-btn, #current-location-btn {
    padding: 0 1.2rem;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-btn:hover, #current-location-btn:hover {
    background: var(--primary-light);
}

/* Card Styles */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* Current Weather */
.current-weather {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(63, 55, 201, 0.1));
}

.location-info {
    flex: 1;
    min-width: 250px;
}

.location-main h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.location-main p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.weather-condition {
    margin-top: 1rem;
}

.weather-condition p {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 500;
}

.temp-unit-toggle {
    display: flex;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50px;
    padding: 0.2rem;
    width: fit-content;
}

.temp-unit-toggle button {
    padding: 0.3rem 0.8rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.temp-unit-toggle button.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.temperature {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.temperature img {
    width: 80px;
    height: 80px;
}

.temp-value {
    display: flex;
    align-items: flex-start;
}

.temp-value span {
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1;
}

.temp-value .unit {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

.weather-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
}

.detail i {
    font-size: 1.2rem;
    color: var(--primary);
}

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

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

.detail-info .label {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forecast Sections */
.forecast-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .forecast-container {
        grid-template-columns: 1fr;
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.2rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h3 i {
    color: var(--primary);
}

.time-range {
    font-size: 0.8rem;
    color: var(--text-light);
}

.hourly-scroll-container {
    overflow-x: auto;
    padding-bottom: 1rem;
}

.hourly-container {
    display: flex;
    gap: 1rem;
    min-width: fit-content;
}

.hourly-item {
    min-width: 80px;
    text-align: center;
    padding: 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    transition: var(--transition);
}

.hourly-item:hover {
    background: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.hourly-item img {
    width: 40px;
    height: 40px;
    margin: 0.5rem 0;
}

.daily-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.daily-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.daily-item:hover {
    background: white;
    transform: translateX(5px);
}

.daily-item img {
    width: 40px;
    height: 40px;
}

.daily-temp {
    display: flex;
    gap: 1rem;
}

.daily-temp span:first-child {
    font-weight: 600;
}

.daily-temp span:last-child {
    color: var(--text-light);
}

/* Extra Cards */
.extra-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .extra-cards-container {
        grid-template-columns: 1fr;
    }
}

.extra-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.extra-card .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.extra-card h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.extra-card h4 i {
    color: var(--primary);
}

.uv-display {
    margin-top: auto;
}

.uv-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.uv-progress {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    margin: 1rem 0;
    overflow: hidden;
}

.uv-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4cc9f0, #4361ee, #3a0ca3, #7209b7, #f72585);
    border-radius: 3px;
    width: 50%;
}

.uv-risk {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    background: #f39c12;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    width: fit-content;
}

.sun-times {
    display: flex;
    gap: 1.5rem;
    margin-top: auto;
}

.sun-time {
    text-align: center;
}

.sun-time .time {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.sun-time .label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.visibility-display {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin: 1rem 0;
}

.visibility-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.visibility-unit {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.visibility-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: auto;
}

/* Footer */
.app-footer {
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    text-align: center;
    color: white;
}

.weather-spinner {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
}

.sun {
    position: absolute;
    width: 50px;
    height: 50px;
    background: #ffeb3b;
    border-radius: 50%;
    top: 25px;
    left: 25px;
    box-shadow: 0 0 30px #ffeb3b;
    animation: pulse 2s infinite alternate;
}

.cloud {
    position: absolute;
    width: 60px;
    height: 20px;
    background: #fff;
    border-radius: 20px;
    top: 40px;
    left: 20px;
    animation: moveCloud 3s infinite alternate;
}

.cloud:before, .cloud:after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 50%;
}

.cloud:before {
    width: 25px;
    height: 25px;
    top: -15px;
    left: 10px;
}

.cloud:after {
    width: 15px;
    height: 15px;
    top: -10px;
    right: 10px;
}

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

@keyframes moveCloud {
    0% { transform: translateX(0); }
    100% { transform: translateX(20px); }
}

.loading-text {
    font-size: 1.2rem;
    letter-spacing: 1px;
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    #location-input {
        min-width: auto;
        width: 100%;
    }
    
    .weather-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    
    .forecast-container, .extra-cards-container {
        grid-template-columns: 1fr;
    }
}