/* ===== WEATHER WIDGET STYLES ===== */

.weather-card {
    /* Position handled by container now */
    /* position: fixed; bottom: 2rem; left: 2rem; */
    width: 350px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 2rem;
    color: white;
    font-family: 'Inter', sans-serif;
    /* z-index: 40; */
    transform-origin: bottom left;
    transform: scale(0.65);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: 350px; /* Fixed height to prevent jumping */
    display: none; /* Hidden by default */
    /* opacity et visibility gérés par GSAP */
    opacity: 0;
    visibility: hidden;
}

.weather-card.active {
    display: block;
    visibility: visible;
    /* opacity animée par GSAP, pas de valeur CSS ici */
}

/* Header: City only */
.weather-header {
    margin-bottom: 1rem;
}

.weather-location h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    background: linear-gradient(to right, #fff, rgba(255,255,255,0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.2s ease;
}

.weather-location {
    position: relative;
    cursor: pointer;
}

.weather-location:hover h2 {
    opacity: 0.8;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.weather-location-input {
    font-size: 1.8rem;
    font-weight: 700;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    color: white;
    width: 100%;
    text-align: left;
    font-family: inherit;
    outline: none;
    display: none;
    padding: 0;
    margin: 0;
    letter-spacing: 0.5px;
}

.weather-location.editing h2 {
    display: none;
}

.weather-location.editing .weather-location-input {
    display: block;
}

.weather-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 250px;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-top: 8px;
    padding: 5px 0;
    list-style: none;
    z-index: 100;
    display: none;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.weather-suggestions.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.weather-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.9);
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.weather-suggestion-item:last-child {
    border-bottom: none;
}

.weather-suggestion-item:hover {
    background: rgba(255,255,255,0.1);
}

.weather-suggestion-item .country {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Main Content: Temp & Big Icon */
.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
    height: 140px; /* Fixed height for animation space */
    overflow: hidden; /* Prevent rain/snow from overflowing into details */
}

.weather-temp {
    font-size: 5.5rem; /* Much larger */
    font-weight: 200;
    line-height: 1;
    position: relative;
    text-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 2;
}

.weather-temp span {
    font-size: 2.5rem;
    position: absolute;
    top: 0.5rem;
    right: -1.5rem;
    font-weight: 300;
    opacity: 0.8;
}

/* Animated Icon Container - Takes more space */
.weather-icon-container {
    width: 160px;
    height: 140px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

/* Details Grid */
.weather-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.detail-icon {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 0.2rem;
    color: var(--accent-color);
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
}

.detail-label {
    font-size: 0.75rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== WEATHER ANIMATIONS (CSS ONLY) ===== */

/* COMMON ELEMENTS */
.weather-clouds-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 2;
}

.weather-cloud {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 40px;
    background: linear-gradient(to bottom, #fff, #e0e0e0);
    border-radius: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    animation: cloud-float 4s ease-in-out infinite alternate;
    animation-delay: var(--d, 0s);
}

.weather-cloud::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
}

.weather-cloud::after {
    content: '';
    position: absolute;
    top: -15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: #fff;
    border-radius: 50%;
}

.weather-cloud.small {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.9;
}

.weather-cloud.large {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 3;
}

.weather-cloud.dark {
    background: linear-gradient(to bottom, #90a4ae, #546e7a);
}
.weather-cloud.dark::before, .weather-cloud.dark::after {
    background: #90a4ae;
}

@keyframes cloud-float {
    0% { margin-top: 0; }
    100% { margin-top: -8px; }
}

/* SUN */
.weather-sun-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.weather-sun-container.weak {
    opacity: 0.5;
}

.weather-sun {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #ffeb3b, #fdd835);
    border-radius: 50%;
    box-shadow: 0 0 40px rgba(255, 235, 59, 0.6), 0 0 80px rgba(255, 152, 0, 0.4);
    animation: sun-pulse 4s infinite alternate;
}

.sun-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 235, 59, 0.2) 0%, rgba(255, 235, 59, 0) 70%);
    border-radius: 50%;
    animation: sun-rotate 20s linear infinite;
}

@keyframes sun-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.9; }
}

@keyframes sun-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* MOON */
.weather-moon-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.weather-moon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: radial-gradient(circle at 30% 30%, #f5f5f5, #e0e0e0);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: moon-float 5s ease-in-out infinite alternate;
    overflow: hidden;
}

.crater {
    position: absolute;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1);
}

.crater.c1 { width: 15px; height: 15px; top: 20%; left: 25%; }
.crater.c2 { width: 10px; height: 10px; top: 60%; left: 60%; }
.crater.c3 { width: 8px; height: 8px; top: 40%; left: 75%; }

.moon-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    animation: moon-glow-pulse 3s infinite alternate;
}

@keyframes moon-float {
    0% { transform: translate(-50%, -50%) rotate(-5deg); }
    100% { transform: translate(-50%, -50%) rotate(5deg); }
}

@keyframes moon-glow-pulse {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* STARS */
.weather-stars {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: twinkle var(--duration) ease-in-out infinite;
    opacity: 0;
    box-shadow: 0 0 2px rgba(255,255,255,0.8);
}

.star.large {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 4px rgba(255,255,255,1);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* RAIN */
.weather-rain {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* overflow: hidden; Removed to allow drops to start above container */
}

.rain-drop {
    position: absolute;
    background: linear-gradient(to bottom, rgba(130, 180, 255, 0), rgba(130, 180, 255, 0.8));
    width: 2px;
    height: 20px;
    border-radius: 2px;
    opacity: 0;
    animation: rain-fall 0.8s linear infinite;
    top: -20px;
}

.rain-drop.heavy {
    width: 3px;
    height: 30px;
    background: linear-gradient(to bottom, rgba(150, 200, 255, 0), rgba(150, 200, 255, 1));
}

@keyframes rain-fall {
    0% { transform: translateY(0) skewX(-10deg); opacity: 0; }
    20% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(160px) skewX(-10deg); opacity: 0; }
}

/* SNOW */
.weather-snow {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* overflow: hidden; Removed */
}

.snow-flake {
    position: absolute;
    background: radial-gradient(circle, #fff 40%, rgba(255,255,255,0) 100%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
    animation: snow-fall 3s linear infinite;
    top: -10px;
}

@keyframes snow-fall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    20% { opacity: 0.9; }
    100% { transform: translateY(160px) translateX(20px) rotate(360deg); opacity: 0; }
}

/* HAIL */
.weather-hail {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* overflow: hidden; Removed */
}

.hail-stone {
    position: absolute;
    background: #e0e0e0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0;
    box-shadow: inset -2px -2px 2px rgba(0,0,0,0.1);
    animation: hail-fall 0.5s linear infinite;
    top: -10px;
}

@keyframes hail-fall {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(160px); opacity: 0; }
}

/* STORM */
.weather-lightning-container {
    position: absolute;
    width: 100%;
    height: 200%; /* Extended to show lightning beyond clouds */
    top: 0;
    left: 0;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.lightning {
    position: absolute;
    opacity: 0;
}

/* Flash effect - proper radial gradient */
.lightning.l1 {
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(200, 220, 255, 0.4) 0%, rgba(255, 255, 255, 0.15) 20%, transparent 50%);
    animation: lightning-flash 2s infinite; /* Faster flash */
}

/* Lightning bolt 1 - Standard */
.lightning.l2 {
    top: 5%; 
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(200, 230, 255, 1) 10%, rgba(255, 255, 255, 1) 50%, rgba(200, 230, 255, 0.8) 100%);
    box-shadow: 0 0 8px rgba(150, 200, 255, 1), 0 0 15px rgba(200, 230, 255, 0.8);
    animation: lightning-bolt 3s infinite;
    animation-delay: 0.5s;
}

.lightning.l2::before {
    content: ''; position: absolute; width: 2px; background: inherit; box-shadow: inherit;
    top: 30%; left: -8px; height: 20px; transform: rotate(-25deg);
}
.lightning.l2::after {
    content: ''; position: absolute; width: 2px; background: inherit; box-shadow: inherit;
    top: 55%; right: -10px; height: 15px; transform: rotate(30deg);
}

/* Lightning bolt 2 - Forked left */
.lightning.l3 {
    top: 10%;
    left: 40%;
    width: 2px;
    height: 80px;
    background: #fff;
    box-shadow: 0 0 10px rgba(200, 220, 255, 0.9);
    animation: lightning-bolt 4s infinite;
    animation-delay: 2s;
}
.lightning.l3::before {
    content: ''; position: absolute; width: 2px; height: 30px; background: inherit;
    top: 40%; left: 10px; transform: rotate(45deg);
}

/* Lightning bolt 3 - Small & Quick */
.lightning.l4 {
    top: 15%;
    left: 65%;
    width: 2px;
    height: 60px;
    background: #fff;
    box-shadow: 0 0 8px rgba(200, 220, 255, 0.9);
    animation: lightning-bolt 2.5s infinite;
    animation-delay: 1.2s;
}
.lightning.l4::before {
    content: ''; position: absolute; width: 2px; height: 15px; background: inherit;
    top: 20%; left: -5px; transform: rotate(-30deg);
}

@keyframes lightning-flash {
    0%, 90%, 100% { opacity: 0; }
    92% { opacity: 0.8; }
    94% { opacity: 0; }
    96% { opacity: 0.5; }
    98% { opacity: 0; }
}

@keyframes lightning-bolt {
    0%, 92%, 100% { opacity: 0; transform: translateX(-50%) scaleY(0.5); }
    93% { opacity: 1; transform: translateX(-50%) scaleY(1); }
    94% { opacity: 0; }
    95% { opacity: 1; transform: translateX(-52%) scaleY(1); }
    96% { opacity: 0; }
}

/* FOG */
.weather-fog {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}

.fog-layer {
    position: absolute;
    width: 200%;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    filter: blur(10px);
    border-radius: 20px;
    animation: fog-move 10s linear infinite alternate;
    left: -50%;
}

@keyframes fog-move {
    0% { transform: translateX(-10%); }
    100% { transform: translateX(10%); }
}

/* Loading State */
.weather-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    font-size: 0.9rem;
    opacity: 0.7;
    letter-spacing: 1px;
}