/* Météo Hérault - Infos en Direct v2.0.0 (Front & PWA) */
.mhb-wrapper {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 800px;
    margin: 24px auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-sizing: border-box;
}
.mhb-wrapper *,
.mhb-wrapper *::before,
.mhb-wrapper *::after {
    box-sizing: border-box;
}
.mhb-wrapper.mhb-context-pwa {
    margin: 15px auto;
}

.mhb-header {
    background: linear-gradient(135deg, #076799 0%, #044b70 100%);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
}
.mhb-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff !important;
}
.mhb-live-dot {
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: mhb-pulse 2s infinite;
    flex-shrink: 0;
}
@keyframes mhb-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Barre de filtres pilules */
.mhb-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mhb-filters::-webkit-scrollbar {
    display: none;
}
.mhb-filter-pill {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 6px 13px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s ease;
    flex-shrink: 0;
}
.mhb-filter-pill:hover {
    border-color: #0ea5e9;
    color: #076799;
}
.mhb-filter-pill.is-active {
    background: #076799;
    border-color: #076799;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(7, 103, 153, 0.22);
}

/* Liste & Timeline PWA */
.mhb-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 8px 24px 16px 24px;
    list-style: none;
    position: relative;
}
.mhb-context-pwa .mhb-list {
    padding: 20px 24px;
}
.mhb-context-pwa .mhb-list::before {
    content: '';
    position: absolute;
    top: 30px;
    bottom: 30px;
    left: 47px;
    width: 3px;
    background: #e2e8f0;
    border-radius: 3px;
}
.mhb-list.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.mhb-item {
    display: flex;
    gap: 18px;
    padding: 20px 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    transition: background-color 0.25s ease, opacity 0.25s ease;
}
.mhb-item:last-child {
    border-bottom: none;
}
.mhb-item.mhb-is-expired {
    opacity: 0.72;
}
.mhb-item.mhb-item-highlight .mhb-content {
    animation: mhb-highlight-flash 2.5s ease-out;
}
@keyframes mhb-highlight-flash {
    0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.65); background: #e0f2fe; border-color: #0ea5e9; }
    35% { box-shadow: 0 0 0 8px rgba(14, 165, 233, 0.2); background: #f0f9ff; border-color: #38bdf8; }
    100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01); background: #f8fafc; border-color: #f1f5f9; }
}

.mhb-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.mhb-type-info .mhb-icon { background: #e0f2fe; color: #0284c7; border: 2px solid #bae6fd; }
.mhb-type-warning .mhb-icon { background: #fef3c7; color: #d97706; border: 2px solid #fde68a; }
.mhb-type-danger .mhb-icon { background: #fee2e2; color: #dc2626; border: 2px solid #fecaca; }
.mhb-type-success .mhb-icon { background: #dcfce7; color: #16a34a; border: 2px solid #bbf7d0; }

.mhb-content {
    flex-grow: 1;
    min-width: 0;
    background: #f8fafc;
    padding: 18px 22px;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
}
.mhb-context-web .mhb-content {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: 12px;
}

.mhb-meta {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.mhb-meta-time {
    background: #e2e8f0;
    padding: 3px 8px;
    border-radius: 6px;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.mhb-badge-pinned {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.mhb-badge-active {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.mhb-badge-active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    animation: mhb-pulse 1.8s infinite;
}
.mhb-badge-expired {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.mhb-badge-sector {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mhb-item-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}
.mhb-item-text {
    margin: 0;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    word-wrap: break-word;
}
.mhb-item-text p {
    margin: 0 0 10px 0;
}
.mhb-item-text p:last-child {
    margin: 0;
}

/* Mises à jour horodatées en direct */
.mhb-updates-box {
    margin-top: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border-left: 3px solid #0ea5e9;
    border-radius: 0 10px 10px 0;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}
.mhb-updates-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #076799;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mhb-update-entry {
    font-size: 13px;
    color: #334155;
    padding: 5px 0;
    border-top: 1px dashed #e2e8f0;
    line-height: 1.45;
}
.mhb-update-entry:first-of-type {
    border-top: none;
    padding-top: 2px;
}
.mhb-update-time {
    font-weight: 800;
    color: #076799;
    margin-right: 6px;
    font-size: 12px;
}

/* Médias & Galerie */
.mhb-media-wrap {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mhb-media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.mhb-media-wrap img,
.mhb-media-wrap video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    background: #0f172a;
}
.mhb-media-grid img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.mhb-lightbox-trigger {
    cursor: zoom-in;
    transition: transform 0.2s ease, filter 0.2s ease;
}
.mhb-lightbox-trigger:hover {
    filter: brightness(0.96);
}

/* Barre d'actions */
.mhb-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.mhb-item-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
}
.mhb-type-info .mhb-item-button { background-color: #e0f2fe; color: #0284c7; border-color: #bae6fd; }
.mhb-type-info .mhb-item-button:hover { background-color: #bae6fd; }
.mhb-type-warning .mhb-item-button { background-color: #fef3c7; color: #d97706; border-color: #fde68a; }
.mhb-type-warning .mhb-item-button:hover { background-color: #fde68a; }
.mhb-type-danger .mhb-item-button { background-color: #fee2e2; color: #dc2626; border-color: #fecaca; }
.mhb-type-danger .mhb-item-button:hover { background-color: #fecaca; }
.mhb-type-success .mhb-item-button { background-color: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.mhb-type-success .mhb-item-button:hover { background-color: #bbf7d0; }

.mhb-share-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.18s ease;
    margin-left: auto;
}
.mhb-share-btn:hover {
    background: #f1f5f9;
    color: #076799;
    border-color: #94a3b8;
}

/* État vide & Charger plus */
.mhb-empty-state {
    text-align: center;
    padding: 36px 20px;
    color: #64748b;
    background: #f8fafc;
    border-radius: 16px;
    margin: 16px;
    border: 1px dashed #cbd5e1;
    font-size: 14px;
}
.mhb-empty-state i {
    font-size: 36px;
    color: #10b981;
    margin-bottom: 12px;
    display: block;
}
.mhb-load-more-wrap {
    padding: 12px 24px 22px 24px;
    text-align: center;
    border-top: 1px solid #f1f5f9;
}
.mhb-load-more-btn {
    appearance: none;
    background: #f1f5f9;
    color: #076799;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 10px 22px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.mhb-load-more-btn:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
}
.mhb-load-more-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Lightbox plein écran */
#mhb-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#mhb-lightbox.is-open {
    display: flex;
}
#mhb-lightbox img {
    max-width: 94vw;
    max-height: 84vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    user-select: none;
}
.mhb-lb-close,
.mhb-lb-nav {
    position: fixed;
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.mhb-lb-close:hover,
.mhb-lb-nav:hover {
    background: rgba(255, 255, 255, 0.28);
}
.mhb-lb-close {
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: 16px;
}
.mhb-lb-prev {
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
}
.mhb-lb-next {
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
}
.mhb-lb-counter {
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.7);
    padding: 5px 12px;
    border-radius: 999px;
}

/* Toast léger */
.mhb-toast {
    position: fixed;
    bottom: calc(85px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(15px);
    background: #0f172a;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    z-index: 2147483100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mhb-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
    .mhb-header { padding: 14px 16px; }
    .mhb-filters { padding: 10px 12px; }
    .mhb-list { padding: 8px 14px; }
    .mhb-context-pwa .mhb-list { padding: 14px 12px; }
    .mhb-context-pwa .mhb-list::before { left: 31px; }
    .mhb-item { padding: 15px 0; gap: 12px; }
    .mhb-icon { width: 40px; height: 40px; font-size: 16px; }
    .mhb-item-title { font-size: 15px; }
    .mhb-item-text { font-size: 13px; }
    .mhb-content { padding: 14px 15px; }
    .mhb-context-web .mhb-content { padding: 0; }
    .mhb-media-grid { grid-template-columns: 1fr; }
}
