/* --- CONTENEDOR PRINCIPAL --- */
.comments-container {
    max-width: 1000px; /* Ajusta según el ancho de tu lectura */
    margin: 60px auto;
    padding: 0 20px;
    font-family: var(--cm-font-family);
}

.comments-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 20px;
    color: var(--cm-text-title);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.comment-count {
    color: var(--cm-text-count);
    margin-left: 10px;
}

/* --- CAJA DE COMENTARIOS (EL FORMULARIO) --- */
.comment-box-wrapper {
    background: #f9f9f9;
    border: 2px solid var(--cm-border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--cm-transition);
    margin-bottom: 40px;
    border: solid 1px #5c5c5c;
}

.comment-box-wrapper:focus-within {
    border-color: var(--cm-send-btn-hover);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.comment-box {
    width: 100%;
    border: none;
    background: transparent;
    padding: 15px 20px;
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    outline: none;
    display: block;
    color: var(--cm-text-body);
}

/* PIE DE LA CAJA (CONTROLES) */
.comment-box-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid var(--cm-border-color);
}

.left-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* SPOILER SWITCH */
.spoiler-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spoiler-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cm-text-placeholder);
    text-transform: uppercase;
}

/* BOTONES DE MEDIOS */
.media-controls {
    display: flex;
    gap: 5px;
    border-left: 1px solid #ddd;
    padding-left: 15px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--cm-icon-color);
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: bold;
    transition: 0.2s;
}

.icon-btn:hover {
    background: #eee;
    color: var(--cm-icon-hover);
}

/* BOTÓN ENVIAR (EL AVIONCITO) */
.send-btn {
    background: transparent;
    border: none;
    color: var(--cm-send-btn-color);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.send-btn svg {
    width: 24px;
    height: 24px;
}

.send-btn:hover {
    color: var(--cm-send-btn-hover);
    transform: scale(1.1) rotate(-10deg);
}

/* --- LISTA DE COMENTARIOS --- */
.comment-list {
    list-style: none;
    padding: 0;
}

#reply-title small {
    padding-left: 10px;
}

#respond {
    animation: fadeInForm 0.4s ease-in-out;
    margin-top: 15px;
    padding-left: 15px;
}

@keyframes fadeInForm {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.comment-body {
    display: flex;
    gap: 15px;
}

.comment-author img {
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}


.media-controls { position: relative; }

.emoji-picker-panel {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 100;
}

.emoji-item {
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    transition: transform 0.2s;
}

.emoji-item:hover { transform: scale(1.3); }

/* Estilo para los botones de texto */
#btn-bold { font-weight: 900; }
#btn-italic { font-style: italic; font-family: serif; }



/* Contenedor unificado */
.comment-box-wrapper {
    border: 2px solid var(--cm-border-color);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: solid 1px #a3a3a3;
}

/* Área de escritura */
.comment-box {
    border: none !important;
    padding: 15px;
    min-height: 80px;
    font-size: 15px;
    outline: none !important;
    resize: none;
}

/* Área de Preview Avanzada */
.comment-preview-area {
    background: #fdfdfd;
    border-top: 1px dashed #eee;
    padding: 12px 15px;
    font-size: 14px;
    color: #555;
    min-height: 20px;
    position: relative;
}

.comment-preview-area::before {
    content: "PREVIEW";
    position: absolute;
    top: -10px;
    right: 15px;
    background: #eee;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    color: #888;
}

/* Footer de la caja */
.comment-box-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* Selector de Emojis Dinámico */
.media-controls { position: relative; }

.emoji-picker-panel {
    position: absolute;
    bottom: 45px;
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 10px;
    border-radius: 8px;
    z-index: 999;
}

.emoji-item {
    padding: 5px;
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.1s;
}

.emoji-item:hover { transform: scale(1.3); }





/* Estilo para que el DIV parezca un textarea */
#comment-editor {
    min-height: 100px;
    padding: 15px;
    outline: none;
    cursor: text;
    background: #fff;
    font-size: 16px;
    line-height: 1.5;
    color: var(--cm-text-body);
}

/* Manejo del Placeholder para div contenteditable */
#comment-editor:empty:before {
    content: attr(data-placeholder);
    color: #aaa;
    pointer-events: none;
    display: block;
}

/* Estilos de los botones cuando están activos (opcional) */
.icon-btn:active {
    background: rgba(0, 0, 0, 0.1);
}

/* Evitar que se rompa el diseño con imágenes pegadas */
#comment-editor img {
    max-width: 100px;
    height: auto;
}



/* 1. Negrita más intensa */
#comment-editor b, 
#comment-editor strong {
    font-weight: 900 !important; /* El máximo peso posible */
    color: #000; /* Aseguramos que sea negro puro para resaltar */
}

/* 2. Fix de Emojis y Tipografía */
#comment-editor {
    min-height: 100px;
    padding: 15px;
    outline: none;
    cursor: text;
    background: #fff;
    font-size: 16px;
    line-height: 1.5;
    color: var(--cm-text-body);
    
    /* Mantiene tu fuente, pero prioriza emojis de sistema para evitar los rombos */
    font-family: var(--cm-font-family), "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}

/* Estilo para el panel de emojis (para que los botones del selector también se vean bien) */
.emoji-item {
    padding: 5px;
    cursor: pointer;
    font-size: 24px; /* Un poco más grandes para que sea fácil clickear */
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    transition: transform 0.1s;
}

.emoji-item:hover { 
    transform: scale(1.2); 
}


/* Negrita mucho más marcada */
#comment-editor b, 
#comment-editor strong {
    font-weight: 900 !important;
    color: #000 !important; /* Negro puro para que resalte del gris */
}

/* Evitar rombos en la caja y el botón */
#comment-editor, 
#btn-emoji, 
.emoji-item {
    font-family: var(--cm-font-family), "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif !important;
}

/* El placeholder también debe verse bien */
#comment-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-weight: normal;
}



/* Forzar tipografía en el editor para evitar rombos */
#comment-editor {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif !important;
}

/* --- LISTA DE COMENTARIOS --- */
.comment-list {
    list-style: none;
    padding: 0;
}

.comment-list .comment {
    margin-bottom: 15px;
}

/* Quitamos el display: flex que rompía la estructura.
   Usamos padding-left para crearle una "columna" al avatar */
.comment-body {
    position: relative;
    padding-left: 65px; /* 50px del avatar + 15px de margen */
}

/* Posicionamiento absoluto para anclar el Avatar a la izquierda */
.comment-author img.avatar {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 50px;
    height: 50px;
}

/* Cabecera del comentario (Nombre y Fecha alineados) */
.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

/* Estilos del nombre de usuario */
.comment-author b.fn {
    font-size: 15px;
    font-weight: 700;
    color: var(--cm-text-title, #222);
}

/* Ocultar el texto "says:" por defecto de WordPress */
.comment-author .says {
    display: none; 
}

/* Estilos de la fecha */
.comment-metadata a {
    font-size: 13px;
    color: #888;
    text-decoration: none;
}

.comment-metadata a:hover {
    text-decoration: underline;
}

/* El texto del comentario */
.comment-content {
    font-size: 15px;
    color: var(--cm-text-body, #444);
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Botón de responder (Reply) */
.reply a {
    font-size: 13px;
    font-weight: 600;
    color: var(--cm-send-btn-color, #0073aa);
    text-decoration: none;
    transition: 0.2s;
}

.reply a:hover {
    color: var(--cm-send-btn-hover, #005177);
    text-decoration: underline;
}



/* --- NUEVA TARJETA DE COMENTARIO --- */
.comment-body {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.comment-author-avatar img {
    border-radius: 50%;
}

.comment-content-wrapper {
    flex: 1;
}

/* Fila del nombre y etiqueta */
.author-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}

.comment-content-wrapper .fn a {
    color: #5d48ff; /* Azul como el de la imagen */
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
}

/* Estilo de la Etiqueta Beast */
.comment-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.tag-beast {
    background: #ff4757; /* Rojo/Naranja llamativo */
    color: #fff;
}

/* Fecha y Responder en gris suave */
.comment-metadata time, 
.reply a {
    color: #999;
    font-size: 12px;
    text-decoration: none;
}

.comment-text {
    margin: 8px 0;
    color: #444;
    font-size: 14.5px;
    line-height: 1.5;
}




/* Contenedor de acciones del pie */
.comment-footer-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 5px;
}

/* Estilo para el botón de eliminar */
.delete-comment-link {
    color: #ff4757 !important; /* Rojo para indicar acción de borrado */
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
    cursor: pointer;
}

.delete-comment-link:hover {
    color: #ff6b81 !important;
    text-decoration: underline;
}

/* Separador visual opcional si quieres que aparezca entre Reply y Delete */
.reply a::after {
    content: "";
    margin-left: 0;
}



/* Estilos base para todas las etiquetas */
.comment-tag {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}

/* Color para el rol Beast (Suscriptor VIP) */
.tag-beast {
    background-color: var(--color-tercary);
    color: #fff;
}

/* Color para el Administrador/Staff */
.tag-admin {
    background-color: var(--color-primary);
    color: white;
}

/* Color para lectores registrados normales */
.tag-user {
    background-color: #f1f2f6;
    color: #57606f;
    border: 1px solid #dfe4ea;
}

/* Color para invitados */
.tag-guest {
    background-color: #ffffff;
    color: #a4b0be;
    border: 1px solid #ced4da;
    font-style: italic;
}



/* Cuando el formulario de respuesta está anidado */
.comment-list .children #respond {
    margin-top: 15px;
    margin-left: 40px; /* Identación tipo Facebook */
    border-left: 2px solid #eee;
    padding-left: 15px;
    margin-bottom: 20px;
}

/* Ajuste para móviles */
@media (max-width: 600px) {
    .comment-list .children #respond {
        margin-left: 15px; /* Menos espacio en móvil */
        padding-left: 10px;
    }
}

/* Estilo para el botón "Cancel Reply" que aparece al responder */
#cancel-comment-reply-link {
    display: inline-block;
    color: #ff4444;
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-decoration: none;
}

/* Hacer que el editor se vea más compacto cuando es una respuesta */
.children #comment-editor {
    min-height: 40px;
    font-size: 0.9rem;
}


/* Contenedor de la lista de comentarios */
.comment-list {
    list-style: none;
    padding: 0;
}

/* Respuestas: El "un poco a la derecha" */
.comment-list .children {
    margin-left: 50px; /* Espacio para el efecto anidado */
    list-style: none;
    border-left: 2px solid #e1e1e1; /* Una línea sutil para guiar la vista */
    padding-left: 15px;
}

/* Cuando el formulario se mueve a una respuesta */
.children #respond {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Ajuste para celulares (Mobile Design) */
@media (max-width: 768px) {
    .comment-list .children {
        margin-left: 20px; /* Menos margen en móviles para no perder espacio */
    }
}





/* Asegura que la lista de respuestas baje y no se quede al lado */
.comment-list li {
    display: block; /* O flex-direction: column si usas flex */
    width: 100%;
}

.children {
    margin-left: 50px; /* Esto crea el efecto de escalera */
    list-style: none;
    padding: 0;
    display: block;
    clear: both; /* Evita que elementos flotados se queden al lado */
}

/* Si tu contenedor principal es flex, forzamos el salto de línea */
.comment-body {
    display: flex;
    flex-wrap: wrap; /* Permite que los hijos bajen si no caben */
}


/* Estilo para el mensaje de éxito flotante */
.comment-success-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #4caf50; /* Verde éxito */
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    font-weight: bold;
    animation: slideInToast 0.5s ease-out;
}

@keyframes slideInToast {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}











/* ================================================================
   MODO OSCURO: COMENTARIOS FERALTIME
   ================================================================ */

body.dark-mode section.comments-area.container {
    background-color: #0a0a0a;
}

body.dark-mode .tag-admin {
    background-color: #262626;
    color: #cfcfcf;
}

body.dark-mode a.comment-reply-link {
    color: white;
}

body.dark-mode .comments-title {
    color: #e1e1e1;
    border-bottom-color: #333;
}

/* --- CAJA DE ESCRITURA (FORMULARIO) --- */
body.dark-mode .comment-box-wrapper {
    background: #252525;
    border-color: #444;
}

body.dark-mode #comment-editor {
    background: #252525;
    color: #eee;
}

body.dark-mode #comment-editor:empty:before {
    color: #666;
}

body.dark-mode .comment-box-footer {
    background: #2d2d2d;
    border-top-color: #444;
}

body.dark-mode .icon-btn {
    color: #aaa;
}

body.dark-mode .icon-btn:hover {
    background: #3d3d3d;
    color: #fff;
}

/* --- LISTA DE COMENTARIOS --- */
body.dark-mode .comment-body {
    border-bottom-color: #333;
}

body.dark-mode .comment-content-wrapper .fn a {
    color: #82aaff; /* Un azul más claro para que resalte en el fondo oscuro */
}

body.dark-mode .comment-text {
    color: #ccc;
}

body.dark-mode .comment-metadata time, 
body.dark-mode .reply a {
    color: #777;
    font-weight: 800;
}

body.dark-mode .reply a:hover {
    color: #82aaff;
}

/* --- ETIQUETAS (TAGS) EN MODO OSCURO --- */
body.dark-mode .tag-user {
    background-color: #2d2d2d;
    color: #aaa;
    border-color: #444;
}

body.dark-mode .tag-guest {
    background-color: #1a1a1a;
    color: #666;
    border-color: #333;
}

/* Nota: Las etiquetas .tag-beast y .tag-admin suelen mantener 
   su color vibrante para resaltar, pero bajamos un poco la intensidad */
body.dark-mode .tag-beast {
    background-color: #e84118; 
}

/* --- RESPUESTAS (CHILDREN) --- */
body.dark-mode .comment-list .children {
    border-left-color: #333;
}

/* --- PANEL DE EMOJIS --- */
body.dark-mode .emoji-picker-panel {
    background: #2d2d2d;
    border-color: #444;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

body.dark-mode .emoji-item:hover {
    background: #3d3d3d;
}

/* --- ÁREA DE PREVIEW --- */
body.dark-mode .comment-preview-area {
    background: #1e1e1e;
    border-top-color: #333;
    color: #999;
}

body.dark-mode .comment-preview-area::before {
    background: #333;
    color: #aaa;
}



/* ==========================================================================
   Aviso de Inicio de Sesión para Comentarios
   ========================================================================== */

.must-log-in-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background-color: #fcfcfc;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0 40px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.must-log-in-notice .notice-icon {
    width: 24px;
    height: 24px;
    color: #888;
    flex-shrink: 0;
}

.must-log-in-notice p {
    margin: 0;
    font-size: 16px;
    color: #444;
    font-family: inherit;
}

.must-log-in-notice a {
    color: #2c3e50; /* Puedes cambiar esto al color principal de tu tema */
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.must-log-in-notice a:hover {
    color: #000;
    border-bottom-color: #000;
}

/* Optimización para dispositivos móviles */
@media (max-width: 480px) {
    .must-log-in-notice {
        flex-direction: column;
        padding: 20px 16px;
        gap: 8px;
    }
}


body.dark-mode .must-log-in-notice {
    background-color: #555555;
    border: none;
}


body.dark-mode .must-log-in-notice .notice-icon,
body.dark-mode .must-log-in-notice a, 
body.dark-mode .must-log-in-notice p {
    color: #ffffff;
}