/* ============================================================
   Post Comments — comentarios y preguntas en /p/{hash}.
   Mobile-first.
   ============================================================ */

.post-comments {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.post-comments__title {
    font-size: 1.05rem;
    margin: 0 0 0.75rem;
    color: var(--c-text);
}

/* ── Formulario ──────────────────────────────────────────── */
.post-comments__form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.post-comments__input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

.post-comments__input:focus {
    outline: none;
    border-color: var(--c-primary);
}

.post-comments__question-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--c-text-muted);
    cursor: pointer;
}

.post-comments__form-actions {
    display: flex;
    justify-content: flex-end;
}

.post-comments__submit {
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--c-brand-surface);
    color: var(--c-on-brand);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.post-comments__submit:hover {
    background: var(--c-primary-hover, var(--c-brand-surface));
}

.post-comments__submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.post-comments__error {
    margin: 0;
    font-size: 0.82rem;
    color: var(--c-danger);
}

.post-comments__login-cta {
    margin: 0 0 1.25rem;
    padding: 0.75rem;
    border: 1px dashed var(--c-border);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--c-text-muted);
    text-align: center;
}

.post-comments__login-cta a {
    color: var(--c-primary-ink);
    font-weight: 600;
}

/* ── Lista ───────────────────────────────────────────────── */
.post-comments__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-comment {
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
}

.post-comment--branch {
    border-color: color-mix(in srgb, var(--c-primary) 40%, transparent);
    background: color-mix(in srgb, var(--c-brand-surface) 5%, var(--c-surface));
}

.post-comment--reply {
    margin-top: 0.5rem;
}

.post-comment__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

/* ── Avatar ─────────────────────────────────────────────── */
.post-comment__avatar {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--c-border);
}

.post-comment__avatar--placeholder {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
}

.post-comment__author {
    font-size: 0.85rem;
    color: var(--c-text);
}

.post-comment__badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
}

.post-comment__badge--branch {
    background: var(--c-brand-surface);
    border-color: var(--c-primary);
    color: var(--c-on-brand);
}

.post-comment__badge--question {
    background: color-mix(in srgb, var(--c-warning, var(--c-amber-600)) 12%, transparent);
    border-color: color-mix(in srgb, var(--c-warning, var(--c-amber-600)) 40%, transparent);
    color: var(--c-warning, var(--c-amber-600));
}

.post-comment__time {
    font-size: 0.72rem;
    color: var(--c-text-muted);
}

/* ── Fila de acciones bajo el texto: "hace 2 h · Responder" ──
   Es donde las pone cualquier red social. La hora deja de competir con el
   nombre en la cabecera, y responder pasa de flecha suelta a acción con
   nombre. El formulario inline se inserta justo detrás del botón, así que la
   fila envuelve y le deja una línea entera. */
.post-comment__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.3rem;
}

.post-comment__action {
    min-height: 0;
    padding: 0;
    border: none;
    background: none;
    color: var(--c-text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.post-comment__action:hover {
    background: none;
    color: var(--c-primary-ink);
    text-decoration: underline;
}

.post-comment__actions .post-comment__reply-form {
    flex: 1 0 100%;
}

/* ── Cita del mensaje respondido (estilo Telegram) ───────── */
.post-comment__quote {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    margin: 0 0 0.4rem;
    padding: 0.35rem 0.6rem;
    border-left: 3px solid var(--c-primary);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--c-brand-surface) 7%, transparent);
    text-decoration: none;
    cursor: pointer;
    min-width: 0;
}

.post-comment__quote:hover {
    background: color-mix(in srgb, var(--c-brand-surface) 13%, transparent);
}

.post-comment__quote-author {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--c-primary-ink);
}

.post-comment__quote-excerpt {
    font-size: 0.78rem;
    color: var(--c-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Chip "Respondiendo a…" en el form ───────────────────── */
.post-comment__quote-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem 0.35rem 0.6rem;
    border-left: 3px solid var(--c-primary);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--c-brand-surface) 8%, var(--c-surface));
}

.post-comment__quote-chip-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.post-comment__quote-chip-close {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--c-text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-comment__quote-chip-close:hover {
    background: color-mix(in srgb, var(--c-danger) 12%, transparent);
    color: var(--c-danger);
}

/* ── Flash al navegar a un mensaje citado ────────────────── */
.post-comment--flash {
    animation: pc-flash 1.6s ease-out;
}

@keyframes pc-flash {
    0%, 35% { background: color-mix(in srgb, var(--c-brand-surface) 18%, var(--c-surface)); }
    100% { background: var(--c-surface); }
}

.post-comment__body {
    margin: 0;
    font-size: 0.9rem;
    color: var(--c-text);
    overflow-wrap: break-word;
}

/* ── Form de respuesta inline ────────────────────────────── */
.post-comment__reply-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.5rem;
    padding: 0.6rem;
    border: 1px solid color-mix(in srgb, var(--c-primary) 35%, transparent);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--c-brand-surface) 4%, var(--c-bg));
}

.post-comment__reply-input {
    background: var(--c-surface);
}

.post-comment__reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.post-comment__reply-cancel {
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    color: var(--c-text-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.post-comment__reply-cancel:hover {
    border-color: var(--c-danger);
    color: var(--c-danger);
}

.post-comment__reply-send {
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
}

.post-comment__replies {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-left: 0.85rem;
    border-left: 2px solid color-mix(in srgb, var(--c-primary) 30%, var(--c-border));
}

.post-comment__replies:empty {
    display: none;
}

.post-comment__replies .post-comment--reply {
    margin-top: 0.4rem;
    padding: 0.55rem 0.7rem;
    background: var(--c-bg);
}

.post-comments__empty {
    margin: 0;
    padding: 1rem 0;
    text-align: center;
    font-size: 0.88rem;
    color: var(--c-text-muted);
}
