/* ============================================================
   WIDGET MÉTÉO JIJEL — Inspiré de la page "Météo Détails"
   ============================================================ */

.weather-widget-cawjijel {
    --ww-bg: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); /* Fond */
    --ww-card-bg: rgba(255, 255, 255, 0.85);                     /* Cartes */
    --ww-text: #1a4d3a;                                          /* Texte */
    --ww-accent: #4caf50;                                        /* Vert accent */
    --ww-text-muted: #5a7263;
    --ww-border: rgba(76, 175, 80, 0.2);
    background: var(--ww-bg);
    border-radius: 12px;
    padding: 5px;
    font-family: 'Tajawal', 'Inter', -apple-system, sans-serif;
    box-shadow: 0 4px 20px rgba(26, 77, 58, 0.08);
    color: var(--ww-text);
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* Effet décoratif subtil */
.weather-widget-cawjijel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
    pointer-events: none;
}

/* --- État de chargement --- */
.weather-widget__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    font-size: 0.95rem;
    color: var(--ww-text-muted);
}

.weather-widget__spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(76, 175, 80, 0.2);
    border-top-color: var(--ww-accent);
    border-radius: 50%;
    animation: ww-spin 0.8s linear infinite;
}

@keyframes ww-spin {
    to { transform: rotate(360deg); }
}

/* --- Erreur --- */
.weather-widget__error {
    text-align: center;
    padding: 30px 20px;
    color: #d32f2f;
    font-weight: 500;
}

/* --- En-tête --- */
.weather-widget__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    z-index: 1;
	justify-content: center;
}

.weather-widget__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ww-text);
    margin: 0;
	display: none;
}

.weather-widget__title::before {
    content: '\26C5';
    font-size: 1.2rem;
}

.weather-widget__updated {
    /* font-size: 0.78rem; */
    color: var(--ww-text-muted);
    font-weight: 400;
}

/* --- Météo actuelle --- */
.weather-widget__current {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 5px;
    background: var(--ww-card-bg);
    border-radius: 10px;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 1;
    flex-wrap: nowrap;
    justify-content: center;
	flex-direction: row-reverse;
}

.weather-widget__current-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weather-widget__icon {
    font-size: 3.2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.weather-widget__temp {
    font-size: 2.8rem;
    font-weight: 300;
    color: var(--ww-text);
    line-height: 1;
    margin: 0;
}

.weather-widget__temp sup {
    font-size: 1.2rem;
    font-weight: 400;
    vertical-align: top;
    margin-left: 2px;
}

.weather-widget__condition {
    font-size: 0.75rem;
    color: var(--ww-text-muted);
    margin-top: 4px;
    font-weight: 500;
    text-align: center;
}

.weather-widget__feels {
    font-size: 0.9rem;
    color: var(--ww-text-muted);
    margin-top: 2px;
    opacity: 1;
    text-align: center;
}

/* --- Métriques secondaires --- */
.weather-widget__metrics {
    display: flex;
    /* gap: 8px 16px; */
    /* font-size: 0.8rem; */
    color: var(--ww-text-muted);
    flex-direction: column;
    align-items: flex-start;
}

.weather-widget__metric {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(255,255,255,0.5);
    border-radius: 6px;
    white-space: nowrap;
}

.weather-widget__metric-icon {
    font-size: 1rem;
}

/* --- Prévisions 5 jours --- */
.weather-widget__forecast {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0px, 1fr));
    gap: 8px;
    position: relative;
    z-index: 1;
}

.weather-widget__day {
    background: var(--ww-card-bg);
    border-radius: 10px;
    padding: 12px 6px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
}

.weather-widget__day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}

.weather-widget__day.is-today {
    background: linear-gradient(135deg, #ffffff 0%, #e8f5e9 100%);
    border: 1px solid var(--ww-accent);
}

.weather-widget__day-name {
    /* font-size: 0.75rem; */
    font-weight: 700;
    color: var(--ww-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-widget__day-date {
    /* font-size: 0.7rem; */
    color: var(--ww-text-muted);
    font-weight: 400;
}

.weather-widget__day-icon {
    font-size: 2rem;
    line-height: 1;
    margin: 2px 0;
}

.weather-widget__day-temps {
    display: flex;
    flex-direction: row;
    gap: 5px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ww-text);
}

.weather-widget__day-temp-max {
    color: #d32f2f;
}

.weather-widget__day-temp-min {
    color: #1976d2;
    font-weight: 500;
}

/* --- Footer du widget --- */
.weather-widget__footer {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--ww-border);
    text-align: center;
    font-size: 0.72rem;
    color: var(--ww-text-muted);
    position: relative;
    z-index: 1;
}

.weather-widget__footer a {
    color: var(--ww-accent);
    text-decoration: none;
    font-weight: 600;
}

.weather-widget__footer a:hover {
    text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .weather-widget-cawjijel {
        padding: 16px;
        border-radius: 10px;
    }
    
    .weather-widget__current {
        padding: 14px 16px;
        gap: 12px;
    }
    
    .weather-widget__temp {
        font-size: 2.4rem;
    }
    
    .weather-widget__icon {
        font-size: 2.6rem;
    }
    
    .weather-widget__metrics {
        font-size: 0.75rem;
        gap: 6px 10px;
    }
    
    .weather-widget__forecast {
        gap: 6px;
    }
    
    .weather-widget__day {
        padding: 10px 4px;
    }
    
    .weather-widget__day-icon {
        font-size: 1.3rem;
    }
    
    .weather-widget__day-name {
        font-size: 0.7rem;
    }
    
    .weather-widget__day-temps {
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .weather-widget__title {
        font-size: 1rem;
    }
    
    .weather-widget__temp {
        font-size: 2rem;
    }
    
    .weather-widget__icon {
        font-size: 2.2rem;
    }
    
    .weather-widget__forecast {
        grid-template-columns: repeat(auto-fit, minmax(0px, 1fr));
        gap: 4px;
    }
    
    .weather-widget__day {
        padding: 8px 2px;
        border-radius: 8px;
    }
    
    .weather-widget__day-name {
        font-size: 0.65rem;
    }
    
    .weather-widget__day-icon {
        font-size: 1.1rem;
    }
    
    .weather-widget__day-temps {
        font-size: 0.68rem;
    }
    
    .weather-widget__metric {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

.weather-widget__temp {
    font-size: 2.8rem;
    font-weight: 300;
    color: var(--ww-text);
    line-height: 1;
    margin: 0;
    display: inline-flex;      /* ✅ Aligne le nombre et °C sur la même ligne */
    align-items: flex-start;   /* ✅ Aligne en haut */
    gap: 4px;
}

.weather-widget__temp sup {
    font-size: 1rem;           /* ✅ Plus petit */
    font-weight: 500;
    vertical-align: baseline;  /* ✅ Annule le décalage par défaut */
    position: relative;
    top: 0.4em;                /* ✅ Remonte légèrement le °C */
    line-height: 1;
    margin: 0;
}

/* ============================================================
   WIDGET MÉTÉO — Version RTL (Arabe)
   ============================================================ */
[dir="rtl"] .weather-widget-cawjijel {
    direction: rtl;
}

[dir="rtl"] .weather-widget__header {
    flex-direction: row-reverse;
}

[dir="rtl"] .weather-widget__current {
    flex-direction: row-reverse;
}

[dir="rtl"] .weather-widget__metrics {
    justify-content: flex-end;
}

[dir="rtl"] .weather-widget__metric {
    flex-direction: row-reverse;
}

[dir="rtl"] .weather-widget__day-temps {
    flex-direction: column;
}

/* Le footer du widget reste centré */
[dir="rtl"] .weather-widget__footer {
    text-align: center;
}

/* ============================================================
   ÉTAT D'ERREUR MÉTÉO — Remplit élégamment l'espace
   ============================================================ */

.weather-widget__error {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 380px;
    height: 100%;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fdf9 0%, #ecf6ee 100%);
    border-radius: 12px;
    border: 1px solid rgba(26, 77, 58, 0.08);
    text-align: center;
    animation: fadeInUp 0.4s ease;
}

.weather-widget__error-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.weather-widget__error-icon {
    font-size: 3.5rem;
    line-height: 1;
    animation: pulseSoft 2.5s ease-in-out infinite;
}

.weather-widget__error-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--agri-green-dark, #1a4d3a);
    margin: 0;
}

.weather-widget__error-message {
    font-size: 0.9rem;
    color: #6a7f6a;
    max-width: 280px;
    line-height: 1.5;
    margin: 0;
}

.weather-widget__error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.weather-widget__error-retry,
.weather-widget__error-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 9999px;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.weather-widget__error-retry {
    background: linear-gradient(135deg, var(--agri-gold, #2c7b2f), var(--agri-green, #40916c));
    color: #fff;
    box-shadow: 0 3px 10px rgba(44, 123, 47, 0.25);
}

.weather-widget__error-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(44, 123, 47, 0.35);
}

.weather-widget__error-link {
    background: transparent;
    color: var(--agri-green, #40916c);
    border: 1px solid var(--agri-green, #40916c);
}

.weather-widget__error-link:hover {
    background: var(--agri-green, #40916c);
    color: #fff;
    transform: translateY(-2px);
}

.weather-widget__error-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(26, 77, 58, 0.15);
    font-size: 0.8rem;
    color: #6a7f6a;
    line-height: 1.6;
    text-align: left;
}

[dir="rtl"] .weather-widget__error-info {
    text-align: right;
}

.weather-widget__error-info strong {
    color: var(--agri-green-dark, #1a4d3a);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

/* Loading (pendant le retry) */
.weather-widget__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    color: #6a7f6a;
    font-size: 0.95rem;
}

/* Animations */
@keyframes pulseSoft {
    0%, 100% { transform: scale(1);    opacity: 1;    }
    50%      { transform: scale(1.08); opacity: 0.85; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* Mobile */
@media (max-width: 480px) {
    .weather-widget__error,
    .weather-widget__loading {
        min-height: 320px;
        padding: 1rem;
    }
    .weather-widget__error-icon { font-size: 2.75rem; }
    .weather-widget__error-title { font-size: 1rem; }
}