/* ── Componente reutilizable: Panel de Comentarios ── */

/* ── Overlay ── */
.com-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
}

.com-overlay.hidden {
    display: none;
}

/* ── Panel (drawer derecho) ── */
.com-panel {
    background: #fff;
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.14);
}

/* ── Encabezado ── */
.com-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.com-header-info {
    min-width: 0;
}

.com-titulo {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 2px;
}

.com-subtitulo {
    font-size: 0.78rem;
    color: #6b7280;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

.com-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 0 0 12px;
    line-height: 1;
    flex-shrink: 0;
}

.com-close:hover {
    color: #374151;
}

/* ── Lista de comentarios ── */
.com-lista {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.com-item {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 12px 14px;
}

.com-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.com-autor {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
}

.com-fecha {
    font-size: 0.72rem;
    color: #9ca3af;
    white-space: nowrap;
}

.com-texto {
    font-size: 0.88rem;
    color: #1f2937;
    margin: 0;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Estados de la lista ── */
.com-loading,
.com-empty {
    font-size: 0.85rem;
    color: #9ca3af;
    text-align: center;
    margin: 0;
    padding: 24px 0;
}

.com-error-load {
    font-size: 0.85rem;
    color: #dc2626;
    text-align: center;
    margin: 0;
    padding: 24px 0;
}

/* ── Formulario ── */
.com-form {
    border-top: 1px solid #f3f4f6;
    padding: 16px 24px;
    flex-shrink: 0;
    background: #fafafa;
}

.com-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    min-height: 72px;
    box-sizing: border-box;
    color: #1f2937;
    background: #fff;
}

.com-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.com-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.com-error {
    font-size: 0.8rem;
    color: #dc2626;
}

.com-error.hidden {
    display: none;
}

/* ── Botón comentarios en tablas ── */
.btn-row-comentarios {
    background-color: #f9fafb;
    color: #6b7280;
    border-color: #e5e7eb;
}

.btn-row-comentarios:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* ── Botón comentarios en tarjetas de preguntas ── */
.btn-comentarios-pregunta {
    background: none;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.5;
}

.btn-comentarios-pregunta:hover {
    background-color: #f9fafb;
    color: #6b7280;
    border-color: #d1d5db;
}

/* Responsive */
@media (max-width: 540px) {
    .com-panel {
        max-width: 100%;
    }

    .com-header {
        padding: 16px 16px 12px;
    }

    .com-lista {
        padding: 12px 16px;
    }

    .com-form {
        padding: 12px 16px;
    }
}
