/* ==========================================================================
   BIBLIOTHÈQUE DE MODÈLES — Modale d'intégration dans l'application
   --------------------------------------------------------------------------
   La bibliothèque vit dans son propre dossier (modeles/) avec son HTML, son
   CSS et son JS. Ce fichier ne stylise que la coquille (overlay + panneau +
   iframe) qui l'accueille à l'intérieur de SireneFlux.
   ========================================================================== */

.tpl-lib-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.5rem, 2vw, 1.25rem);
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease;
}

.tpl-lib-overlay.open {
    pointer-events: all;
    opacity: 1;
}

.tpl-lib-backdrop {
    position: absolute;
    inset: 0;
    background: oklch(0 0 0 / 0.6);
    backdrop-filter: blur(6px);
}

.tpl-lib-panel {
    position: relative;
    z-index: 1;
    width: min(1160px, 96vw);
    height: min(92vh, 980px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(18px) scale(0.97);
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tpl-lib-overlay.open .tpl-lib-panel {
    transform: translateY(0) scale(1);
}

.tpl-lib-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    flex-shrink: 0;
    gap: 0.75rem;
}

.tpl-lib-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.tpl-lib-title i {
    color: var(--accent);
    font-size: 0.9em;
}

.tpl-lib-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15em 0.5em;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.tpl-lib-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

#tpl-lib-iframe {
    flex: 1;
    border: none;
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 768px) {
    .tpl-lib-panel {
        width: 96vw;
        height: 94vh;
    }
}

@media (max-width: 480px) {
    .tpl-lib-overlay {
        padding: 0;
    }

    .tpl-lib-panel {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
}
