/*
 * Plataforma de Votaciones de Verdes EQUO
 *
 * Fichero: style.css
 * Propósito: Hoja de estilos propia que extiende/sobrescribe
 *   Bootstrap 5.3.2 con la identidad visual verde de Verdes EQUO.
 *   Clases y elementos principales:
 *     - body: layout flex-direction: column para sticky footer.
 *     - Verde marca #198754 hardcodeado en .bg-success / .btn-success
 *       (refuerzo visual por si cambia la variable Bootstrap).
 *     - .card: border-radius 12px, sin borde, sombras soft.
 *     - .navbar-brand: 1.5rem negrita.
 *     - footer: margin-top:auto para "pegar" al fondo.
 *     - .scroll-to-top: botón flotante circular verde fijo a 20px
 *       de bottom/right, opacidad 0 por defecto, se muestra con la
 *       clase .show (toggleada desde main.js), hover translateY(-3px).
 *     - .icon-ficha-collapse: animación rotate(180deg) del icono de
 *       flecha al expandir/colapsar el acordeón "Mis Datos".
 */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.bg-success {
    background-color: #198754 !important;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.card {
    border-radius: 12px;
    border: none;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

footer {
    margin-top: auto;
}

/* Botón flotante para subir */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #198754;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: #157347;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* Animar flecha del botón Mi Ficha al expandir/colapsar */
button[data-bs-toggle="collapse"][aria-expanded="true"] .icon-ficha-collapse {
    transform: rotate(180deg);
    transition: transform 0.2s ease-in-out;
}
button[data-bs-toggle="collapse"][aria-expanded="false"] .icon-ficha-collapse {
    transform: rotate(0deg);
    transition: transform 0.2s ease-in-out;
}

/* ==========================================================================
   Contenedor de HTML enriquecido (WYSIWYG: TinyMCE)
   Estilos base para H3/H4, P, listas, blockquote, strong/em, enlaces y
   spans con color/fuente definidos desde el editor.
   Se aplica a los campos renderizados con $utils->renderRichHtml().
   ========================================================================== */
.rich-text-output {
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
}

.rich-text-output > *:first-child {
    margin-top: 0;
}

.rich-text-output > *:last-child {
    margin-bottom: 0;
}

.rich-text-output p {
    margin: 0 0 0.75rem 0;
}

.rich-text-output h3,
.rich-text-output h4 {
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.rich-text-output h3 {
    font-size: 1.25rem;
}

.rich-text-output h4 {
    font-size: 1.1rem;
}

.rich-text-output ul,
.rich-text-output ol {
    padding-left: 1.75rem;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

.rich-text-output ul {
    list-style-type: disc;
}

.rich-text-output ol {
    list-style-type: decimal;
}

.rich-text-output li {
    margin-bottom: 0.25rem;
}

.rich-text-output blockquote {
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid #198754;
    background-color: rgba(25, 135, 84, 0.08);
    color: #212529;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

.rich-text-output strong,
.rich-text-output b {
    font-weight: 700;
}

.rich-text-output em,
.rich-text-output i {
    font-style: italic;
}

.rich-text-output u {
    text-decoration: underline;
}

.rich-text-output s,
.rich-text-output strike {
    text-decoration: line-through;
}

.rich-text-output a {
    color: #198754;
    text-decoration: underline;
    word-break: break-word;
}

.rich-text-output a:hover,
.rich-text-output a:focus {
    color: #146c43;
}

.rich-text-output br {
    content: "";
    display: block;
    margin: 0.25rem 0;
}

/* Reset de colores heredados en contenedores .text-muted (color heredado
   puede anular colores foreground explícitos de los spans de TinyMCE). */
.rich-text-output span[style*="color"] {
    color: inherit !important; /* fallback, el atributo style inline gana */
}

/* Evita que el CSS global de .text-muted anule los colores definidos
   por el editor WYSIWYG (color inline en span supera la especificidad
   de .text-muted, pero en cascadas profundas se asegura). */
.text-muted .rich-text-output,
.rich-text-output.text-muted {
    color: #212529;
}
.text-muted .rich-text-output * {
    color: revert;
}
.text-muted .rich-text-output span[style] {
    color: unset;
}

/* ==========================================================================
   Widget: Usuarios Conectados (solo administradores)
   Se muestra en el sidebar izquierdo debajo del menú NAVEGACIÓN.
   - Administradores: nombre en rojo
   - Indicador de "En línea": punto verde
   - Lista con scroll si supera X altura
   - Botón refrescar: animación spin durante la carga AJAX
   ========================================================================== */
.widget-usuarios-logeados-list {
    max-height: 420px;
    overflow-y: auto;
    margin-right: -0.5rem;
    padding-right: 0.5rem;
    scrollbar-width: thin;
}

.widget-usuarios-logeados-list::-webkit-scrollbar {
    width: 6px;
}

.widget-usuarios-logeados-list::-webkit-scrollbar-thumb {
    background-color: rgba(25, 135, 84, 0.35);
    border-radius: 999px;
}

.widget-usuarios-logeados-list::-webkit-scrollbar-track {
    background-color: transparent;
}

.widget-usuario-item + .widget-usuario-item {
    border-top: 1px dashed rgba(0, 0, 0, 0.08) !important;
}

.widget-usuario-status {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background-color: #198754;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.18);
    margin-top: 0.35rem;
}

.widget-usuario-admin .widget-usuario-nombre {
    color: #dc3545 !important;
}

.widget-usuario-item .widget-usuario-nombre {
    word-break: break-word;
    line-height: 1.2;
}

.spin-anim {
    animation: widget-spin 0.9s linear infinite;
    display: inline-block;
}

@keyframes widget-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

#widget-usuarios-refresh:active i {
    transform: scale(0.9);
}

#widget-usuarios-logeados.bg-light-subtle {
    background-color: rgba(248, 249, 250, 0.9) !important;
}

