/* Info-bulle (module « infobulle ») : bulle posée au clic sur la carte. */
.ib {
    position: relative;
    display: flex;
    width: min(340px, calc(100vw - 32px));
    max-height: min(440px, 70vh);
    flex-direction: column;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 14px 34px rgb(16 62 73 / 24%), 0 0 0 1px rgb(16 62 73 / 8%);
    color: var(--ink);
    font-size: 0.82rem;
}

.ib[hidden] {
    display: none;
}

/* Pointe vers le point cliqué. */
.ib::after {
    position: absolute;
    bottom: -7px;
    left: 50%;
    width: 14px;
    height: 14px;
    transform: translateX(-50%) rotate(45deg);
    background: var(--white);
    box-shadow: 3px 3px 4px rgb(16 62 73 / 10%);
    content: "";
}

/* En-tête de la couche (ancien bandeau vert de la bulle). */
.ib__head {
    display: flex;
    padding: 9px 8px 9px 12px;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--accent);
    color: var(--accent-ink);
}

[dir="rtl"] .ib__head {
    padding: 9px 12px 9px 8px;
}

.ib__badge {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgb(255 255 255 / 18%);
}

.ib__badge .ico {
    width: 18px;
    height: 18px;
}

.ib__titles {
    min-width: 0;
    flex: 1 1 auto;
}

.ib__kicker {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    opacity: 0.85;
    text-transform: uppercase;
}

.ib__title {
    overflow: hidden;
    margin: 1px 0 0;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ib__close {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.ib__close:hover {
    background: rgb(255 255 255 / 18%);
}

.ib__close:focus-visible,
.ib__chip:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 1px;
}

.ib__close .ico {
    width: 18px;
    height: 18px;
}

/* Couches trouvées (ancienne pagination « (1/n) » des couches). */
.ib__layers {
    display: flex;
    padding: 8px 10px;
    gap: 6px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    scrollbar-width: thin;
}

.ib__layers[hidden] {
    display: none;
}

.ib__chip {
    display: inline-flex;
    max-width: 180px;
    min-height: 28px;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 10px;
    border: 1px solid #c9d7da;
    border-radius: 999px;
    background: var(--white);
    color: var(--navy);
    font: inherit;
    font-size: 0.76rem;
    cursor: pointer;
}

[dir="rtl"] .ib__chip {
    padding: 3px 10px 3px 4px;
}

.ib__chip:hover {
    border-color: var(--accent);
}

.ib__chip[aria-selected="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

.ib__chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ib__chip-count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgb(16 62 73 / 10%);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

.ib__chip[aria-selected="true"] .ib__chip-count {
    background: rgb(255 255 255 / 25%);
}

.ib__body {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
}

.ib__status {
    margin: 0;
    padding: 18px 14px;
    color: var(--muted);
    text-align: center;
}

.ib__status[hidden] {
    display: none;
}

.ib.is-loading .ib__status::before {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto 8px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ib-spin 0.8s linear infinite;
    content: "";
}

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

@media (prefers-reduced-motion: reduce) {
    .ib.is-loading .ib__status::before {
        animation: none;
    }
}

/* Attributs (ancien tableau rayé). */
.ib__table {
    width: 100%;
    border-collapse: collapse;
}

.ib__table th,
.ib__table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.ib__table tbody tr:nth-child(even) {
    background: #f6f9f9;
}

.ib__table tbody tr:last-child th,
.ib__table tbody tr:last-child td {
    border-bottom: 0;
}

.ib__table th {
    width: 42%;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
}

.ib__table td {
    color: var(--ink);
    font-weight: 500;
}

.ib__none {
    color: var(--muted) !important;
}

.ib__table a {
    color: var(--blue);
    font-weight: 600;
}

.ib__foot {
    display: flex;
    padding: 7px 8px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--paper);
}

.ib__foot[hidden],
.ib__pager[hidden] {
    display: none;
}

.ib__zoom .ico {
    width: 16px;
    height: 16px;
}

.ib__pager {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-inline-start: auto;
}

.ib__count {
    min-width: 76px;
    color: var(--navy);
    font-size: 0.76rem;
    font-weight: 600;
    text-align: center;
}

.ib__pager .icon-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.ib .ico--back {
    transform: scaleX(-1);
}

[dir="rtl"] .ib .ico--back {
    transform: none;
}

/* Bulle ouverte : au-dessus de la légende, des messages et de la table attributaire
   (z-index 5 à 8), sous les panneaux (11) et l'en-tête (20). */
.ol-overlaycontainer-stopevent:has(> .ol-overlay-container > .ib:not([hidden])) {
    z-index: 9 !important;
}

/* Objet sous le pointeur : main, comme sur une couche vecteur. */
.is-ib-hover {
    cursor: pointer;
}

@media print {
    .ib {
        display: none !important;
    }
}
