/* ===================================================
   Tunisia Weather Plugin – LeManager.tn
   Design : élégant, moderne, couleurs méditerranéennes
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

.tw-wrap {
    font-family: 'Outfit', system-ui, sans-serif;
    max-width: 520px;
    margin: 0 auto;
}

/* ─── Sélecteur ──────────────────────────────────── */
.tw-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tw-selector label {
    font-weight: 600;
    color: #1a3a5c;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tw-city-select {
    flex: 1;
    min-width: 160px;
    padding: 8px 14px;
    border: 2px solid #d0e4f5;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    color: #1a3a5c;
    cursor: pointer;
    transition: border-color .2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%231a3a5c' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

.tw-city-select:focus {
    outline: none;
    border-color: #1a8fe3;
}

/* ─── Loader ─────────────────────────────────────── */
.tw-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b8fa8;
}

.tw-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid #d0e4f5;
    border-top-color: #1a8fe3;
    border-radius: 50%;
    animation: tw-spin .8s linear infinite;
    margin: 0 auto 12px;
}

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

/* ─── Carte principale ───────────────────────────── */
.tw-card {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 6px 32px rgba(26, 58, 92, .13);
    background: linear-gradient(160deg, #e8f4ff 0%, #ffffff 100%);
    border: 1px solid #d0e4f5;
    animation: tw-fade-in .4s ease;
}

@keyframes tw-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Variantes météo */
.tw-card.tw-clear    { background: linear-gradient(160deg, #fff9e6 0%, #fff3c4 40%, #ffffff 100%); }
.tw-card.tw-rain,
.tw-card.tw-drizzle  { background: linear-gradient(160deg, #e8efff 0%, #d6e8ff 40%, #ffffff 100%); }
.tw-card.tw-storm    { background: linear-gradient(160deg, #e8e0ff 0%, #ddd5f5 40%, #ffffff 100%); }
.tw-card.tw-snow     { background: linear-gradient(160deg, #f0fbff 0%, #e0f5ff 40%, #ffffff 100%); }
.tw-card.tw-cloudy   { background: linear-gradient(160deg, #f0f4f8 0%, #e8edf2 40%, #ffffff 100%); }
.tw-card.tw-foggy    { background: linear-gradient(160deg, #f5f5f0 0%, #edeae0 40%, #ffffff 100%); }

/* ─── Header ─────────────────────────────────────── */
.tw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(0,0,0,.07);
}

.tw-city-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a3a5c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tw-flag { font-size: 1.3em; }

.tw-updated {
    font-size: 0.75rem;
    color: #8aadcb;
}

/* ─── Jours ──────────────────────────────────────── */
.tw-day {
    padding: 18px 20px;
}

.tw-today {
    border-bottom: 1px solid rgba(0,0,0,.07);
}

.tw-day-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5a8ab0;
    margin-bottom: 10px;
}

.tw-main-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tw-icon-big {
    font-size: 3rem;
    line-height: 1;
    flex-shrink: 0;
}

.tw-temps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tw-temp-current {
    font-size: 2.4rem;
    font-weight: 700;
    color: #1a3a5c;
    line-height: 1;
}

.tw-temp-range {
    display: flex;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
}

.tw-temp-range.tw-standalone {
    font-size: 1.5rem;
    font-weight: 700;
    gap: 14px;
}

.tw-max { color: #e05a2b; }
.tw-min { color: #1a8fe3; }

.tw-desc {
    font-size: 1rem;
    font-weight: 500;
    color: #3a6a8c;
    margin-left: auto;
    text-align: right;
}

/* ─── Détails ────────────────────────────────────── */
.tw-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tw-detail-item {
    background: rgba(255,255,255,.65);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
    font-size: 0.8rem;
    color: #3a6a8c;
    display: flex;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(4px);
}

.tw-detail-icon {
    font-size: 1.1rem;
}

/* ─── Footer ─────────────────────────────────────── */
.tw-footer {
    text-align: center;
    padding: 8px 20px 12px;
    font-size: 0.7rem;
    color: #a0bdd4;
}

/* ─── Erreur ─────────────────────────────────────── */
.tw-error {
    background: #fff3f3;
    border: 1px solid #ffc5c5;
    border-radius: 12px;
    padding: 16px 20px;
    color: #b03030;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 420px) {
    .tw-details {
        grid-template-columns: repeat(2, 1fr);
    }
    .tw-main-row {
        gap: 10px;
    }
    .tw-icon-big {
        font-size: 2.3rem;
    }
    .tw-temp-current {
        font-size: 1.9rem;
    }
}
