/* ============================================================
   FORO DE LA COMUNIDAD (INST17)
   ============================================================
   Estilos de foro.php. Reutiliza la paleta del contenido del
   dashboard (tarjetas blancas, bordes #e2e8f0, acento #6366f1,
   textos #1a202c / #475569 / #64748b) y Font Awesome.
   Todas las clases van prefijadas con "foro-" para no afectar a
   otras secciones.
   ============================================================ */

.foro-app, .foro-dialog, .foro-toast {
    --foro-accent: #6366f1;
    --foro-accent-soft: #eef2ff;
    --foro-text: #1a202c;
    --foro-text-2: #475569;
    --foro-muted: #64748b;
    --foro-border: #e2e8f0;
    --foro-bg: #ffffff;
    --foro-bg-2: #f8fafc;
    --foro-ok: #15803d;
    --foro-warn: #b45309;
    --foro-danger: #dc2626;
}
.foro-app {
    color: var(--foro-text);
    font-size: 0.9rem;
    min-width: 0;
}

.foro-app a { color: inherit; text-decoration: none; }
.foro-app a:hover { color: var(--foro-accent); }
.foro-app button { font: inherit; }

/* ---------- estado y vacío ---------- */
.foro-loading, .foro-empty {
    background: var(--foro-bg, #fff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    color: #64748b;
}
.foro-empty i { font-size: 1.6rem; color: #6366f1; display: block; margin-bottom: 0.5rem; }
.foro-empty .foro-btn { margin-top: 0.75rem; }

/* ---------- migas internas ---------- */
.foro-trail {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
    font-size: 0.8rem; color: var(--foro-muted); margin-bottom: 0.9rem;
}
.foro-trail a { color: var(--foro-accent); font-weight: 500; }
.foro-trail .foro-trail-sep { color: #cbd5e1; }
.foro-trail .foro-trail-current { color: var(--foro-text); font-weight: 600; overflow-wrap: anywhere; }

/* ---------- barra de herramientas ---------- */
.foro-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.6rem; margin-bottom: 1rem;
}
.foro-toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.foro-select, .foro-input, .foro-textarea {
    border: 1px solid #cbd5e1; border-radius: 6px; background: #fff;
    color: var(--foro-text); font-size: 0.85rem; padding: 0.45rem 0.6rem;
}
.foro-select { padding-right: 1.6rem; }
.foro-input, .foro-textarea { width: 100%; }
.foro-textarea { min-height: 140px; resize: vertical; line-height: 1.5; font-family: inherit; }
.foro-input:focus, .foro-textarea:focus, .foro-select:focus {
    outline: 2px solid rgba(99, 102, 241, 0.35); outline-offset: 0; border-color: var(--foro-accent);
}
.foro-check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--foro-text-2); }

/* ---------- botones ---------- */
.foro-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    border: 1px solid transparent; border-radius: 6px;
    padding: 0.5rem 0.95rem; font-size: 0.82rem; font-weight: 600;
    cursor: pointer; background: #1e293b; color: #fff; line-height: 1.2;
}
.foro-btn:hover { background: #334155; color: #fff; }
.foro-btn-primary { background: var(--foro-accent, #6366f1); }
.foro-btn-primary:hover { background: #4f46e5; }
.foro-btn-light { background: #fff; color: var(--foro-text-2); border-color: #cbd5e1; }
.foro-btn-light:hover { background: var(--foro-bg-2); color: var(--foro-text); }
.foro-btn-danger { background: #fff; color: var(--foro-danger); border-color: #fecaca; }
.foro-btn-danger:hover { background: #fef2f2; color: var(--foro-danger); }
.foro-btn[disabled] { opacity: 0.6; cursor: wait; }
.foro-btn:focus-visible, .foro-link-btn:focus-visible, .foro-react:focus-visible, .foro-icon-btn:focus-visible {
    outline: 2px solid var(--foro-accent, #6366f1); outline-offset: 2px;
}
.foro-btn.is-on { background: var(--foro-accent-soft); color: var(--foro-accent); border-color: #c7d2fe; }

.foro-link-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    background: none; border: none; padding: 0.25rem 0.4rem; border-radius: 4px;
    color: var(--foro-muted); font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.foro-link-btn:hover { color: var(--foro-accent); background: var(--foro-accent-soft); }
.foro-link-btn.is-danger:hover { color: var(--foro-danger); background: #fef2f2; }
.foro-link-btn[disabled] { opacity: 0.5; cursor: wait; }
.foro-icon-btn { background: none; border: none; color: #64748b; padding: 0.3rem 0.5rem; cursor: pointer; border-radius: 4px; }
.foro-icon-btn:hover { background: #f1f5f9; }

/* ---------- etiquetas ---------- */
.foro-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.1rem 0.45rem; border-radius: 999px;
    font-size: 0.68rem; font-weight: 600; line-height: 1.5;
    background: #f1f5f9; color: var(--foro-text-2); white-space: nowrap;
}
.foro-chip-accent { background: var(--foro-accent-soft); color: var(--foro-accent); }
.foro-chip-warn { background: #fef3c7; color: var(--foro-warn); }
.foro-chip-danger { background: #fee2e2; color: var(--foro-danger); }
.foro-chip-ok { background: #dcfce7; color: var(--foro-ok); }
.foro-unread-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--foro-accent); flex-shrink: 0;
}
.foro-count-badge {
    display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--foro-accent); color: #fff; font-size: 0.68rem; font-weight: 700;
    line-height: 18px; text-align: center;
}

/* ---------- portada: categorías y foros ---------- */
.foro-layout-home { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.foro-card {
    background: var(--foro-bg); border: 1px solid var(--foro-border); border-radius: 8px;
    overflow: hidden;
}
.foro-card-head {
    padding: 0.85rem 1rem; border-bottom: 1px solid var(--foro-border); background: var(--foro-bg-2);
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem 1rem;
}
.foro-card-title { font-size: 0.95rem; font-weight: 700; margin: 0; }
.foro-card-desc { font-size: 0.78rem; color: var(--foro-muted); margin: 0.2rem 0 0; flex-basis: 100%; }
.foro-forum-row {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) 120px 220px; gap: 0.85rem;
    align-items: center; padding: 0.85rem 1rem; border-top: 1px solid #f1f5f9;
}
.foro-forum-row:first-child { border-top: none; }
.foro-forum-icon {
    width: 40px; height: 40px; border-radius: 8px; background: var(--foro-accent-soft); color: var(--foro-accent);
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.foro-forum-row.is-locked-out .foro-forum-icon { background: #f1f5f9; color: #94a3b8; }
.foro-forum-row.has-unread .foro-forum-icon { background: var(--foro-accent); color: #fff; }
.foro-forum-name { font-weight: 700; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.foro-forum-desc { font-size: 0.78rem; color: var(--foro-text-2); margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.foro-forum-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.foro-subforums { font-size: 0.75rem; color: var(--foro-muted); margin-top: 0.35rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; }
.foro-subforums a { color: var(--foro-accent); font-weight: 500; }
.foro-stats { font-size: 0.75rem; color: var(--foro-muted); text-align: right; line-height: 1.5; }
.foro-stats strong { color: var(--foro-text); font-weight: 700; }
.foro-last { font-size: 0.75rem; color: var(--foro-muted); min-width: 0; line-height: 1.45; }
.foro-last a.foro-last-title { color: var(--foro-text); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foro-last a.foro-last-title:hover { color: var(--foro-accent); }

.foro-recent { list-style: none; margin: 0; padding: 0; }
.foro-recent li { padding: 0.65rem 1rem; border-top: 1px solid #f1f5f9; font-size: 0.8rem; }
.foro-recent li:first-child { border-top: none; }
.foro-recent a.foro-recent-title { font-weight: 600; display: block; overflow-wrap: anywhere; }
.foro-recent .foro-recent-meta { color: var(--foro-muted); font-size: 0.72rem; }

/* ---------- foro: cabecera y lista de temas ---------- */
.foro-head {
    background: var(--foro-bg); border: 1px solid var(--foro-border); border-left: 3px solid var(--foro-accent);
    border-radius: 8px; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.foro-head-title { font-size: 1.15rem; font-weight: 700; margin: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.foro-head-desc { color: var(--foro-text-2); font-size: 0.82rem; margin: 0.3rem 0 0; overflow-wrap: anywhere; }
.foro-head-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font-size: 0.76rem; color: var(--foro-muted); margin-top: 0.55rem; align-items: center; }
.foro-head-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.85rem; }
.foro-notice {
    border-radius: 6px; padding: 0.6rem 0.8rem; font-size: 0.8rem; margin-bottom: 1rem;
    background: #f1f5f9; color: var(--foro-text-2); display: flex; gap: 0.5rem; align-items: flex-start;
}
.foro-notice.is-warn { background: #fffbeb; color: var(--foro-warn); }
.foro-notice.is-danger { background: #fef2f2; color: var(--foro-danger); }

.foro-topic-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 110px 190px; gap: 0.85rem; align-items: center;
    padding: 0.8rem 1rem; border-top: 1px solid #f1f5f9;
}
.foro-topic-row:first-child { border-top: none; }
.foro-topic-row.is-pinned { background: #fafaff; }
.foro-topic-row.is-inactive { background: #fff7f7; }
.foro-topic-title { font-weight: 600; font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; overflow-wrap: anywhere; }
.foro-topic-row.is-unread .foro-topic-title a { font-weight: 800; }
.foro-topic-sub { font-size: 0.74rem; color: var(--foro-muted); margin-top: 0.2rem; }

/* ---------- paginación ---------- */
.foro-pager { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin: 1rem 0; }
.foro-pager a, .foro-pager span {
    min-width: 34px; padding: 0.35rem 0.6rem; border-radius: 6px; border: 1px solid var(--foro-border);
    background: #fff; font-size: 0.8rem; text-align: center; color: var(--foro-text-2);
}
.foro-pager a:hover { border-color: var(--foro-accent); color: var(--foro-accent); }
.foro-pager .is-current { background: var(--foro-accent); border-color: var(--foro-accent); color: #fff; font-weight: 700; }
.foro-pager .is-gap { border: none; background: none; min-width: 0; }

/* ---------- formularios ---------- */
.foro-form { background: var(--foro-bg); border: 1px solid var(--foro-border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.foro-form-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.75rem; }
.foro-field { margin-bottom: 0.75rem; }
.foro-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--foro-text-2); margin-bottom: 0.3rem; }
.foro-field-foot { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.72rem; color: var(--foro-muted); margin-top: 0.25rem; }
.foro-field-error { color: var(--foro-danger); }
.foro-counter.is-over { color: var(--foro-danger); font-weight: 700; }
.foro-form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.foro-form-status { font-size: 0.8rem; min-height: 1.1rem; margin-top: 0.5rem; }
.foro-form-status.is-error { color: var(--foro-danger); }
.foro-form-status.is-ok { color: var(--foro-ok); }
.foro-form-hint { font-size: 0.72rem; color: var(--foro-muted); }
.foro-reply-context {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    background: var(--foro-accent-soft); color: #3730a3; border-radius: 6px; padding: 0.4rem 0.6rem;
    font-size: 0.78rem; margin-bottom: 0.6rem;
}
.foro-pending-quotes { display: grid; gap: 0.5rem; margin-bottom: 0.6rem; }

/* ---------- conversación ---------- */
.foro-thread { display: grid; gap: 0.85rem; }
.foro-post {
    background: var(--foro-bg); border: 1px solid var(--foro-border); border-radius: 8px;
    display: grid; grid-template-columns: 150px minmax(0, 1fr); scroll-margin-top: 140px;
}
.foro-post.is-first { border-color: #c7d2fe; box-shadow: 0 1px 0 #c7d2fe; }
.foro-post.is-first .foro-post-side { background: var(--foro-accent-soft); }
.foro-post.is-inactive { background: #fffafa; border-style: dashed; }
.foro-post.is-highlight { animation: foro-flash 2s ease-out 1; }
@keyframes foro-flash { from { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.45); } to { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); } }
.foro-post-side {
    padding: 0.9rem 0.75rem; border-right: 1px solid #f1f5f9; background: var(--foro-bg-2);
    text-align: center; border-radius: 8px 0 0 8px; min-width: 0;
}
.foro-avatar {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #e0e7ff;
    color: var(--foro-accent); display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.05rem; text-transform: uppercase; flex-shrink: 0;
}
.foro-avatar-sm { width: 26px; height: 26px; font-size: 0.7rem; }
.foro-user-name { display: block; font-weight: 700; font-size: 0.82rem; margin-top: 0.35rem; overflow-wrap: anywhere; }
.foro-user-role { margin-top: 0.25rem; }
.foro-post-main { padding: 0.85rem 1rem; min-width: 0; display: flex; flex-direction: column; }
.foro-post-head { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: center; font-size: 0.74rem; color: var(--foro-muted); margin-bottom: 0.55rem; }
.foro-post-head .foro-post-kind { font-weight: 700; color: var(--foro-accent); text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.68rem; }
.foro-post-body {
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
    line-height: 1.6; font-size: 0.9rem; color: var(--foro-text);
}
.foro-post-body.is-placeholder { color: var(--foro-muted); font-style: italic; }
.foro-post-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px solid #f1f5f9; }
.foro-post-actions { display: flex; flex-wrap: wrap; gap: 0.1rem; }
.foro-mod-note { font-size: 0.72rem; color: var(--foro-warn); margin-top: 0.5rem; overflow-wrap: anywhere; }

.foro-quote {
    border-left: 3px solid #a5b4fc; background: #f8fafc; border-radius: 0 6px 6px 0;
    padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; font-size: 0.82rem; color: var(--foro-text-2);
}
.foro-quote-head { font-size: 0.72rem; font-weight: 700; color: #4338ca; margin-bottom: 0.2rem; display: flex; justify-content: space-between; gap: 0.5rem; }
.foro-quote-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.foro-quote.is-unavailable { border-left-color: #cbd5e1; font-style: italic; color: var(--foro-muted); }

.foro-children { margin-left: 2.2rem; display: grid; gap: 0.6rem; }
.foro-children .foro-post { grid-template-columns: 110px minmax(0, 1fr); }
.foro-children .foro-avatar { width: 36px; height: 36px; font-size: 0.85rem; }
.foro-more-children { justify-self: start; }

/* ---------- reacciones ---------- */
.foro-reactions { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.foro-react {
    display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--foro-border);
    background: #fff; border-radius: 999px; padding: 0.2rem 0.55rem; font-size: 0.74rem;
    color: var(--foro-text-2); cursor: pointer; line-height: 1.4;
}
.foro-react:hover { border-color: #a5b4fc; color: var(--foro-accent); }
.foro-react.is-mine { background: var(--foro-accent-soft); border-color: #a5b4fc; color: #4338ca; font-weight: 700; }
.foro-react[disabled] { cursor: default; opacity: 0.75; }
.foro-react.is-busy { opacity: 0.5; cursor: wait; }
.foro-react-count { font-weight: 700; }

/* ---------- diálogo y aviso ---------- */
.foro-dialog {
    border: none; border-radius: 10px; padding: 0; width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 64px); box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); color: #1a202c;
}
.foro-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.foro-dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 64px); margin: 0; }
.foro-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; border-bottom: 1px solid #e2e8f0; }
.foro-dialog-title { font-size: 1rem; font-weight: 700; margin: 0; }
.foro-dialog-body { padding: 1rem; overflow-y: auto; font-size: 0.85rem; }
.foro-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid #e2e8f0; }
.foro-dialog-actions:empty { display: none; }
.foro-rev { border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.65rem 0.75rem; margin-bottom: 0.6rem; }
.foro-rev-head { display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; font-size: 0.74rem; color: #64748b; margin-bottom: 0.4rem; align-items: center; }
.foro-rev-title { font-weight: 700; font-size: 0.82rem; margin-bottom: 0.3rem; overflow-wrap: anywhere; }
.foro-rev-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.84rem; background: #f8fafc; border-radius: 4px; padding: 0.5rem; }
.foro-user-list { list-style: none; margin: 0; padding: 0; }
.foro-user-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-top: 1px solid #f1f5f9; }
.foro-user-list li:first-child { border-top: none; }

.foro-toast {
    position: fixed; right: 16px; bottom: 16px; z-index: 2000; max-width: min(420px, calc(100vw - 32px));
    background: #1e293b; color: #fff; padding: 0.7rem 1rem; border-radius: 8px; font-size: 0.85rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
}
.foro-toast.is-error { background: #b91c1c; }
.foro-toast.is-ok { background: #15803d; }
.foro-toast[hidden] { display: none; }

/* ---------- imágenes adjuntas (INST23) ---------- */
/* Galería del mensaje: nunca desborda; la imagen conserva su proporción
   (object-fit: contain, sin recortes ni deformación). */
.foro-gallery { display: grid; gap: 0.4rem; margin-top: 0.7rem; max-width: 640px; }
.foro-gallery.is-n1 { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
.foro-gallery.is-n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.foro-gallery.is-n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.foro-gallery-item {
    display: flex; align-items: center; justify-content: center; min-width: 0; height: 180px;
    background: var(--foro-bg-2); border: 1px solid var(--foro-border); border-radius: 6px; overflow: hidden;
}
.foro-gallery.is-n1 .foro-gallery-item { height: auto; max-height: 360px; }
.foro-gallery-item img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.foro-gallery.is-n1 .foro-gallery-item img { max-height: 360px; }
a.foro-gallery-item { cursor: zoom-in; }
a.foro-gallery-item:hover { border-color: #a5b4fc; }
a.foro-gallery-item:focus-visible { outline: 2px solid var(--foro-accent); outline-offset: 2px; }
.foro-gallery-item.is-missing { height: 90px; }
.foro-img-missing { display: inline-flex; flex-direction: column; align-items: center; gap: 0.25rem; color: var(--foro-muted); font-size: 0.7rem; text-align: center; padding: 0.3rem; }
.foro-img-missing .fas { font-size: 1.1rem; opacity: 0.6; }

/* Selector en formularios: miniaturas pequeñas y una barra compacta. */
.foro-imgpick { display: grid; gap: 0.35rem; }
.foro-imgpick-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.foro-imgpick-list[hidden] { display: none; }
.foro-imgpick-item {
    position: relative; width: 76px; height: 76px; border: 1px solid var(--foro-border); border-radius: 6px;
    background: var(--foro-bg-2); overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.foro-imgpick-item.is-new { border-style: dashed; border-color: #a5b4fc; }
.foro-imgpick-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foro-imgpick-item .foro-img-missing { font-size: 0.62rem; }
.foro-imgpick-remove {
    position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: none;
    background: rgba(15, 23, 42, 0.72); color: #fff; font-size: 0.7rem; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.foro-imgpick-remove:hover { background: var(--foro-danger); }
.foro-imgpick-remove:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.foro-imgpick-remove[disabled] { opacity: 0.4; cursor: default; }
.foro-imgpick-tag {
    position: absolute; left: 3px; bottom: 3px; background: rgba(255, 255, 255, 0.9); color: #4338ca;
    font-size: 0.6rem; font-weight: 700; border-radius: 3px; padding: 0 0.25rem; line-height: 1.4;
}
.foro-imgpick-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; }
.foro-imgpick-add[disabled] { opacity: 0.5; cursor: default; }
.foro-imgpick-count { font-size: 0.72rem; color: var(--foro-muted); }
.foro-imgpick-note { font-size: 0.72rem; color: var(--foro-warn); }
.foro-imgpick-note:empty, .foro-imgpick .foro-field-error:empty { display: none; }

/* Historial: cambios de imágenes */
.foro-rev-section { font-size: 0.85rem; font-weight: 700; margin: 0.9rem 0 0.5rem; }
.foro-rev-img { display: flex; align-items: center; gap: 0.6rem; }
.foro-rev-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #f1f5f9; display: inline-flex; align-items: center; justify-content: center; color: #94a3b8; }

/* Visor ampliado (fuera de .foro-app: colores explícitos) */
.foro-viewer {
    border: none; padding: 0; margin: auto; background: transparent; color: #fff;
    width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; overflow: hidden;
}
.foro-viewer::backdrop { background: rgba(2, 6, 23, 0.9); }
.foro-viewer[open] { display: flex; flex-direction: column; }
.foro-viewer-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 3rem 3.5rem 0.5rem; }
.foro-viewer-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; border-radius: 4px; background: #0f172a; }
.foro-viewer-close, .foro-viewer-nav {
    position: absolute; border: none; border-radius: 50%; width: 40px; height: 40px; cursor: pointer;
    background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 1rem;
    display: inline-flex; align-items: center; justify-content: center; z-index: 1;
}
.foro-viewer-close:hover, .foro-viewer-nav:hover { background: rgba(255, 255, 255, 0.28); }
.foro-viewer-close:focus-visible, .foro-viewer-nav:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }
.foro-viewer-close { top: 10px; right: 10px; }
.foro-viewer-nav { top: 50%; transform: translateY(-50%); }
.foro-viewer-nav.is-prev { left: 8px; }
.foro-viewer-nav.is-next { right: 8px; }
.foro-viewer-nav[hidden] { display: none; }
.foro-viewer-bar { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 0.5rem 1rem 0.9rem; font-size: 0.8rem; }
.foro-viewer-count { color: #cbd5e1; font-variant-numeric: tabular-nums; }
.foro-viewer-count:empty { display: none; }
.foro-viewer-open { color: #c7d2fe; text-decoration: none; display: inline-flex; gap: 0.35rem; align-items: center; }
.foro-viewer-open:hover { color: #fff; text-decoration: underline; }

/* ---------- INST31: vídeos de YouTube ---------- */
/* Reproductor diferido: un botón hasta que el usuario pulsa; entonces un
   único iframe de youtube-nocookie.com. Contenedor 16:9 (relleno porcentual,
   sin depender de aspect-ratio). */
.foro-video-wrap { margin-top: 0.7rem; max-width: 640px; }
.foro-video-wrap.is-compact { max-width: 420px; margin-top: 0.45rem; }
.foro-video-wrap[hidden] { display: none; }
.foro-video {
    position: relative; width: 100%; height: 0; padding-top: 56.25%;
    background: #0f172a; border-radius: 8px; overflow: hidden;
}
.foro-video > iframe, .foro-video > .foro-video-play, .foro-video > .foro-video-msg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}
.foro-video-play {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.75rem; margin: 0; cursor: pointer; color: #fff; text-align: center; font: inherit;
    background: radial-gradient(circle at 50% 45%, #334155 0%, #0f172a 75%);
}
.foro-video-play-icon {
    width: 58px; height: 58px; border-radius: 50%; background: #dc2626; color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); transition: transform 0.12s ease, background 0.12s ease;
}
.foro-video-play-icon .fas { margin-left: 3px; }
.foro-video-play:hover .foro-video-play-icon { transform: scale(1.06); background: #b91c1c; }
.foro-video-play:focus-visible { outline: 3px solid #a5b4fc; outline-offset: -3px; }
.foro-video-play-text { font-weight: 700; font-size: 0.9rem; }
.foro-video-play-note { font-size: 0.7rem; color: #cbd5e1; }
.foro-video-wrap.is-compact .foro-video-play-icon { width: 44px; height: 44px; font-size: 1rem; }
.foro-video-wrap.is-compact .foro-video-play-note { display: none; }
.foro-video-msg {
    display: flex; align-items: center; justify-content: center; gap: 0.45rem;
    color: #cbd5e1; font-size: 0.82rem; background: #1e293b;
}
.foro-video-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem;
    margin-top: 0.35rem; font-size: 0.72rem; color: var(--foro-muted);
}
.foro-video-src { font-weight: 600; }
.foro-video-hint { flex: 1 1 220px; min-width: 0; }
.foro-video-hint[hidden] { display: none; }
.foro-app .foro-video-open { margin-left: auto; color: var(--foro-accent); font-weight: 600; display: inline-flex; gap: 0.3rem; align-items: center; }
.foro-app .foro-video-open:hover { text-decoration: underline; }

/* Campo de vídeo en los formularios */
.foro-videofield { display: grid; gap: 0.3rem; min-width: 0; }
.foro-videofield-row { display: flex; gap: 0.4rem; align-items: center; min-width: 0; }
.foro-videofield-row .foro-input { flex: 1 1 auto; min-width: 0; }
.foro-videofield-row .foro-input[readonly] { background: var(--foro-bg-2); color: var(--foro-text-2); }
.foro-videofield-remove { flex-shrink: 0; }
.foro-videofield-remove[hidden] { display: none; }
.foro-videofield-state { font-size: 0.72rem; color: var(--foro-muted); }
.foro-videofield-state.is-ok { color: var(--foro-ok); }
.foro-videofield-state.is-warn { color: var(--foro-warn); }
.foro-videofield-state:empty, .foro-videofield .foro-field-error:empty { display: none; }
.foro-videofield-preview:empty { display: none; }

/* Historial: vídeo de cada versión */
.foro-rev-video { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; font-size: 0.78rem; color: var(--foro-text-2); margin-bottom: 0.35rem; }
.foro-rev-video a { color: var(--foro-accent); font-weight: 600; overflow-wrap: anywhere; }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
    .foro-forum-row { grid-template-columns: 40px minmax(0, 1fr) 150px; }
    .foro-forum-row .foro-stats { display: none; }
}
@media (max-width: 767.98px) {
    .foro-forum-row { grid-template-columns: 36px minmax(0, 1fr); gap: 0.65rem; }
    .foro-forum-row .foro-last { grid-column: 2; }
    .foro-forum-icon { width: 36px; height: 36px; }
    .foro-topic-row { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
    .foro-topic-row .foro-stats { text-align: left; }
    .foro-post, .foro-children .foro-post { grid-template-columns: minmax(0, 1fr); }
    .foro-post-side {
        border-right: none; border-bottom: 1px solid #f1f5f9; border-radius: 8px 8px 0 0;
        display: flex; align-items: center; gap: 0.6rem; text-align: left; padding: 0.6rem 0.85rem;
    }
    .foro-avatar { width: 34px; height: 34px; font-size: 0.85rem; }
    .foro-user-name { margin-top: 0; }
    .foro-user-role { margin-top: 0; }
    .foro-children { margin-left: 0.9rem; }
    /* INST23: imágenes en móvil */
    .foro-gallery-item { height: 120px; }
    .foro-gallery.is-n1 .foro-gallery-item, .foro-gallery.is-n1 .foro-gallery-item img { max-height: 260px; }
    .foro-gallery.is-n3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .foro-gallery.is-n3 .foro-gallery-item:first-child { grid-column: 1 / -1; }
    .foro-imgpick-item { width: 64px; height: 64px; }
    .foro-viewer-stage { padding: 3.2rem 0.5rem 0.5rem; }
    .foro-viewer-nav { top: auto; bottom: 0.4rem; transform: none; }
    /* INST31: vídeos en móvil (ancho completo de la columna) */
    .foro-video-wrap, .foro-video-wrap.is-compact { max-width: 100%; }
    .foro-video-play-icon { width: 48px; height: 48px; font-size: 1.1rem; }
    .foro-app .foro-video-open { margin-left: 0; }
    .foro-videofield-row { flex-wrap: wrap; }
    .foro-videofield-row .foro-input { flex-basis: 100%; }
}

/* texto solo para lectores de pantalla (no depende de Tailwind/Bootstrap) */
.foro-app .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
