/* Busa Meteo — Stili isolati (.bm-*) senza dipendenze esterne */

.bm-widget,
.bm-widget *,
.bm-modal-backdrop,
.bm-modal-backdrop * {
    box-sizing: border-box;
}

.bm-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    width: 100%;
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.bm-widget-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #222222;
    flex-shrink: 0;
}

.bm-widget--empty {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    padding: 16px;
    text-align: center;
    color: #555555;
    font-size: 14px;
}

.bm-empty-msg {
    margin: 0;
}

.bm-card {
    border: 4px solid #e6e6e6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    background: #ffffff;
    overflow: hidden;
    flex: 1 1 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Pannello rosso superiore */
.bm-current {
    position: relative;
    background-color: #bc1724;
    color: #ffffff;
    padding: 8px 10px 10px;
    text-align: center;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bm-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.bm-info-btn {
    appearance: none;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.bm-info-btn:hover,
.bm-info-btn:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.06);
    outline: none;
}

.bm-date-btn {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 2px 2px;
    margin: 0;
    flex: 1;
    min-width: 0;
    color: #ffffff;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-date-btn:hover,
.bm-date-btn:focus-visible {
    opacity: 0.9;
    outline: none;
}

.bm-main-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.bm-main-icon img {
    max-width: 38px;
    max-height: 38px;
    width: auto;
    height: auto;
    display: block;
}

.bm-metrics {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: auto 0;
}

.bm-metric {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    font-size: 13.5px;
    line-height: 1.2;
    color: #ffffff;
}

.bm-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.95;
}

.bm-metric-text {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.bm-label {
    font-size: 12.5px;
    font-weight: 400;
    opacity: 0.95;
}

.bm-sub {
    font-size: 12.5px;
    font-weight: 400;
    opacity: 0.95;
}

.bm-val {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Barra inferiore dei giorni */
.bm-tabs {
    display: grid;
    grid-template-columns: repeat(var(--bm-cols, 5), minmax(0, 1fr));
    background-color: #efefef;
    flex-shrink: 0;
}

.bm-widget .bm-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: #222222;
    font-family: inherit;
    padding: 5px 4px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    min-width: 0;
    box-shadow: none;
    border-radius: 0;
}

.bm-widget .bm-tab:hover,
.bm-widget .bm-tab:focus-visible {
    background-color: #d92634;
    color: #ffffff;
    outline: none;
}

.bm-widget .bm-tab.is-active {
    background-color: #bc1724;
    color: #ffffff;
}

.bm-tab-label {
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bm-tab-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
}

/* Modale dettagli */
.bm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.bm-modal-backdrop[hidden] {
    display: none;
}

.bm-modal-dialog {
    background: #ffffff;
    color: #222222;
    width: 100%;
    max-width: 920px;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bm-modal-header {
    background: #bc1724;
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.bm-modal-header .bm-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff !important;
}

.bm-modal-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
    color: #ffffff;
}

.bm-modal-close {
    appearance: none;
    background: rgba(255, 255, 255, 0.16);
    border: 0;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.bm-modal-close:hover,
.bm-modal-close:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

.bm-modal-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.bm-modal-body > * + * {
    margin-top: 18px;
}

.bm-modal-grid {
    display: grid;
    gap: 16px;
}

.bm-modal-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bm-modal-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bm-day-card,
.bm-trend-section {
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
}

.bm-day-card-head {
    background: #bc1724;
    color: #ffffff;
    padding: 10px 14px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
}

.bm-day-card-body {
    padding: 14px;
    font-size: 14px;
}

.bm-periods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eeeeee;
}

.bm-period,
.bm-period-single {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.bm-period-single {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eeeeee;
}

.bm-period-title {
    font-size: 11px;
    font-weight: 700;
    color: #666666;
    letter-spacing: 0.04em;
}

.bm-period img,
.bm-period-single img,
.bm-trend-card img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.bm-zt {
    font-size: 12px;
    color: #444444;
    line-height: 1.3;
}

.bm-day-desc {
    margin: 0 0 12px;
    color: #333333;
    font-size: 13.5px;
    line-height: 1.45;
}

.bm-detail-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: #333333;
}

.bm-trend-section .bm-modal-grid {
    padding: 14px;
}

.bm-trend-card {
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 4px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bm-trend-date {
    font-weight: 700;
    font-size: 14px;
    color: #bc1724;
}

.bm-trend-desc {
    margin: 0;
    font-size: 12.5px;
    color: #444444;
    line-height: 1.4;
}

.bm-detail-list--compact {
    text-align: left;
    width: 100%;
    font-size: 12.5px;
    border-top: 1px solid #e9e9e9;
    padding-top: 8px;
}

.bm-extra-box {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 12px 14px;
    font-size: 13px;
    color: #333333;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bm-modal-footer {
    padding: 10px 18px;
    background: #f5f5f5;
    border-top: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #666666;
    flex-shrink: 0;
}

.bm-modal-footer a {
    color: #bc1724;
    font-weight: 600;
    text-decoration: none;
}

.bm-modal-footer a:hover {
    text-decoration: underline;
}

.bm-btn-close {
    appearance: none;
    background: #bc1724;
    color: #ffffff;
    border: 0;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.bm-btn-close:hover,
.bm-btn-close:focus-visible {
    background: #9c121d;
    outline: none;
}

.bm-body-lock {
    overflow: hidden !important;
}

@media (max-width: 720px) {
    .bm-modal-grid--2,
    .bm-modal-grid--3 {
        grid-template-columns: 1fr;
    }

    .bm-date-btn {
        font-size: 14.5px;
    }

    .bm-main-icon {
        width: 34px;
        height: 34px;
    }

    .bm-main-icon img {
        max-width: 32px;
        max-height: 32px;
    }

    .bm-tab-label {
        font-size: 11px;
    }

    .bm-tab-icon {
        width: 30px;
        height: 30px;
    }
}
