/* Componente colapsable "FORMATOS APLICABLES" — skin Ejecutivo Navy.
   Progressive enhancement de un <WRAP center round download> existente;
   ver bez/scripts/formatos-colapsable.js */

.nicc-formatos-colapsable {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin: 1.2em 0;
    background: #fff;
    font-size: 0.95em;
}

.nicc-formatos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0f172a;
    color: #fff;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}
.nicc-formatos-header:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: -2px;
}

.nicc-formatos-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.9em;
    min-width: 0;
}

.nicc-formatos-titulo {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nicc-formatos-badge {
    background: #0369a1;
    color: #fff;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.82em;
    font-weight: 700;
    flex: none;
}

.nicc-formatos-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

.nicc-formatos-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    flex: none;
}
.nicc-formatos-colapsable.is-open > .nicc-formatos-header .nicc-formatos-chevron {
    transform: rotate(180deg);
}
@media (prefers-reduced-motion: reduce) {
    .nicc-formatos-chevron,
    .nicc-formatos-body { transition: none !important; }
}

.nicc-formatos-editbtn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.45);
    color: #fff;
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 0.82em;
    font-weight: 700;
    cursor: pointer;
}
.nicc-formatos-editbtn:hover { background: rgba(255,255,255,0.12); }
.nicc-formatos-editbtn:focus-visible { outline: 2px solid #38bdf8; }

.nicc-formatos-body {
    max-height: 0;
    overflow: hidden;
    background: #f8fafc;
    transition: max-height 0.25s ease;
}
.nicc-formatos-colapsable.is-open .nicc-formatos-body {
    max-height: 4000px;
}

.nicc-formatos-body ul {
    list-style: none;
    margin: 0;
    padding: 4px 16px;
}
.nicc-formatos-body li {
    padding: 7px 0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nicc-formatos-body li:last-child { border-bottom: none; }

.nicc-formatos-body a {
    color: #1e3a5f;
    font-weight: 700;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}
.nicc-formatos-body a:hover { text-decoration: underline; }
.nicc-formatos-body a:focus-visible { outline: 2px solid #0369a1; }

.nicc-formatos-vacio {
    margin: 0;
    padding: 14px 16px;
    color: #64748b;
    font-style: italic;
    font-size: 0.9em;
}

/* Nota preservada (solo lectura): párrafo + sub-ítems de bloques que traían
   texto explicativo además del enlace. Colores fijos: la página DokuWiki
   destino siempre es blanca, esto no depende de ningún tema del navegador. */
.nicc-formatos-nota {
    margin: 4px 12px 12px;
    padding: 10px 12px;
    border-left: 3px solid #0369a1;
    background: #eaf4fb;
    border-radius: 0 6px 6px 0;
    color: #1c1a16;
}
/* Colores en el elemento CONCRETO (p / li), no solo heredados del contenedor.
   !important es necesario: el tema DokuWiki fija el color de los <li> del
   contenido con un selector de mayor especificidad (usa ID), y sin esto el
   texto queda gris claro sobre fondo claro — ilegible (verificado en XAMPP). */
.nicc-formatos-nota p,
.nicc-formatos-nota li,
.nicc-formatos-nota ul li {
    color: #1c2431 !important;
    font-size: 0.88em;
}
.nicc-formatos-nota p {
    margin: 0 0 6px;
    font-weight: 600;
}
.nicc-formatos-nota p:last-child { margin-bottom: 0; }
.nicc-formatos-nota ul {
    margin: 0;
    padding-left: 20px;
    list-style: disc outside;
}
.nicc-formatos-nota ul li { margin: 3px 0; }
.nicc-formatos-nota strong { color: #0f172a; font-weight: 700; }

/* Aviso cuando el bloque tiene texto intercalado (no editable en línea). */
.nicc-formatos-nointerc {
    font-size: 0.76em;
    font-weight: 700;
    color: #cbd5e1;
    border: 1px dashed rgba(255,255,255,.35);
    border-radius: 6px;
    padding: 4px 9px;
    cursor: help;
}

/* ---- Modo edición (solo manager/director) ---- */

.nicc-formatos-nota-preview {
    margin: 4px 16px 0;
    padding: 8px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #1c1a16;
}
.nicc-formatos-nota-preview-label {
    display: block;
    font-size: 0.72em;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
}
.nicc-formatos-nota-preview .nicc-formatos-nota {
    margin: 0;
    border-left: 3px solid #94a3b8;
    background: transparent;
    padding: 0 0 0 10px;
}
.nicc-formatos-editrow {
    display: flex;
    gap: 8px;
    padding: 6px 16px;
    align-items: center;
    flex-wrap: wrap;
}
.nicc-formatos-editrow input {
    flex: 1;
    min-width: 140px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
}
.nicc-formatos-editrow input:focus-visible { outline: 2px solid #0369a1; }
.nicc-formatos-urlinput {
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 0.85em;
    flex: 0 1 230px;
}

/* Botón que abre el media manager de DokuWiki para elegir el archivo
   sin tener que escribir la ruta a mano. */
.nicc-formatos-pickbtn {
    background: #e0edf7;
    border: 1px solid #9dc3de;
    border-radius: 6px;
    width: 32px;
    height: 30px;
    flex: none;
    cursor: pointer;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.nicc-formatos-pickbtn svg { width: 17px; height: 17px; }
.nicc-formatos-pickbtn:hover { background: #c9e0f2; border-color: #0369a1; }
.nicc-formatos-pickbtn:focus-visible { outline: 2px solid #0369a1; }

.nicc-formatos-iconbtn {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    flex: none;
    cursor: pointer;
    color: #334155;
    font-size: 0.85em;
    line-height: 1;
}
.nicc-formatos-iconbtn:hover { background: #e2e8f0; }
.nicc-formatos-iconbtn.danger { color: #dc2626; border-color: #fecaca; }
.nicc-formatos-iconbtn.danger:hover { background: #fee2e2; }
.nicc-formatos-iconbtn:disabled { opacity: 0.35; cursor: not-allowed; }

.nicc-formatos-addrow {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px dashed #cbd5e1;
    flex-wrap: wrap;
}
.nicc-formatos-addbtn {
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-weight: 700;
    font-size: 0.85em;
    cursor: pointer;
    flex: none;
}
.nicc-formatos-addbtn:hover { background: #1e293b; }

.nicc-formatos-savebar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #eef2f7;
    border-top: 1px solid #dbe3ee;
}
.nicc-formatos-status {
    font-size: 0.82em;
    color: #475569;
    margin-right: auto;
}
.nicc-formatos-status.is-error { color: #dc2626; font-weight: 700; }

.nicc-formatos-cancelbtn {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 0.85em;
    cursor: pointer;
    color: #334155;
}
.nicc-formatos-cancelbtn:hover { background: #e2e8f0; }

.nicc-formatos-savebtn {
    background: #0369a1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-weight: 700;
    font-size: 0.85em;
    cursor: pointer;
}
.nicc-formatos-savebtn:hover { background: #075985; }
.nicc-formatos-savebtn:disabled { opacity: 0.6; cursor: wait; }
