/**
 * Forum Replies
 *
 * Reply cards within a single topic. Each reply has an optional solution
 * badge, a body with 2-column grid (vote-col + content-col), author info,
 * rich text content, and action buttons.
 *
 * Template: templates/parts/reply-card.php
 *
 * Reply structure:
 *   .forum-reply (.forum-reply--depth-N, .forum-reply--solution)
 *     .forum-reply__solution-badge (optional)
 *     .forum-reply__body (2-col grid: vote-col + content-col)
 *       .forum-reply__vote-col (vote buttons)
 *       .forum-reply__content-col
 *         .forum-reply__author
 *           img.forum-reply__avatar
 *           .forum-reply__author-name
 *           time.forum-reply__time
 *           a.forum-reply__permalink
 *         .forum-reply__text (rich text / markdown)
 *         .forum-reply__actions
 *           .forum-reply__action-btn
 *           .forum-reply__action-btn--solution
 *
 * @package PC_Kompas_Forum
 */

/* ============================================================================
   INDIVIDUAL REPLY CARD — wrapper
   ============================================================================ */

.forum-reply {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
    overflow: hidden;
}

/* Solution highlight */
.forum-reply--solution {
    border-color: var(--success);
    background:
        linear-gradient(var(--success-bg), var(--success-bg)),
        var(--bg-secondary);
}

/* Nested replies via progressive left margin */
.forum-reply--depth-1 {
    margin-left: clamp(1rem, 3vw, 2rem);
}

.forum-reply--depth-2 {
    margin-left: clamp(2rem, 6vw, 4rem);
}

.forum-reply--depth-3 {
    margin-left: clamp(2.5rem, 7vw, 5rem);
}

/* ============================================================================
   SOLUTION BADGE — green banner at top of reply
   ============================================================================ */

.forum-reply__solution-badge {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(1rem, 2.5vw, 1.5rem);
    background: var(--success-bg);
    color: var(--success);
    font-size: clamp(0.8125rem, 0.9vw + 0.2rem, 0.875rem);
    font-weight: 600;
    border-bottom: 1px solid var(--success);
}

.forum-reply__solution-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ============================================================================
   REPLY BODY — 2-column grid (vote-col + content-col)
   ============================================================================ */

.forum-reply__body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(0.75rem, 1.5vw, 1.25rem);
    padding: clamp(1rem, 2.5vw, 1.5rem);
}

/* ============================================================================
   VOTE COLUMN
   ============================================================================ */

.forum-reply__vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0.25rem;
}

/* ============================================================================
   CONTENT COLUMN
   ============================================================================ */

.forum-reply__content-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ============================================================================
   AUTHOR BAR — avatar + name + time + permalink
   ============================================================================ */

.forum-reply__author {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-sm);
    font-size: clamp(0.8125rem, 0.9vw + 0.2rem, 0.875rem);
}

.forum-reply__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
}

.forum-reply__author-name {
    font-weight: 600;
    color: var(--text-primary);
}

.forum-reply__time {
    color: var(--text-muted);
}

.forum-reply__permalink {
    color: var(--text-muted);
    text-decoration: none;
    font-size: clamp(0.75rem, 0.8vw + 0.15rem, 0.8125rem);
    transition: color 0.15s ease;
}

.forum-reply__permalink:hover {
    color: var(--accent);
}

/* ============================================================================
   REPLY TEXT — Rich text / markdown rendered content
   ============================================================================ */

.forum-reply__text {
    line-height: 1.7;
    color: var(--text-primary);
    font-size: clamp(0.9375rem, 1vw + 0.25rem, 1rem);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.forum-reply__text p {
    margin: 0.75em 0;
}

.forum-reply__text > :first-child {
    margin-top: 0;
}

.forum-reply__text > :last-child {
    margin-bottom: 0;
}

.forum-reply__text h2,
.forum-reply__text h3,
.forum-reply__text h4 {
    margin: 1.5em 0 0.5em;
    color: var(--text-primary);
    line-height: 1.3;
}

.forum-reply__text h2 {
    font-size: 1.25rem;
}

.forum-reply__text h3 {
    font-size: 1.125rem;
}

.forum-reply__text h4 {
    font-size: 1rem;
}

.forum-reply__text ul,
.forum-reply__text ol {
    padding-left: 1.5em;
    margin: 0.75em 0;
}

.forum-reply__text li {
    margin: 0.25em 0;
}

.forum-reply__text blockquote {
    border-left: 3px solid var(--accent);
    margin: 1em 0;
    padding: 0.5em 1em;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Inline code */
.forum-reply__text :not(pre) > code {
    padding: 0.15em 0.4em;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--text-primary);
}

/* Code blocks */
.forum-reply__text pre {
    margin: 1em 0;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: clamp(0.8125rem, 0.9vw + 0.2rem, 0.875rem);
    line-height: 1.6;
}

.forum-reply__text pre code {
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-size: inherit;
}

/* Links */
.forum-reply__text a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.forum-reply__text a:hover {
    color: var(--accent-hover);
}

/* Images */
.forum-reply__text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* ============================================================================
   REPLY ACTIONS
   ============================================================================ */

.forum-reply__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
    margin-top: var(--space-xs);
}

/* Base action button */
.forum-reply__action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.3em 0.6em;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
}

.forum-reply__action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.forum-reply__action-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.forum-reply__action-btn svg {
    width: 14px;
    height: 14px;
}

/* Mark as solution button — green accent */
.forum-reply__action-btn--solution {
    color: var(--success);
}

.forum-reply__action-btn--solution:hover {
    background: var(--success-bg);
    color: var(--success);
}

/* Report button inherits from .forum-reply__action-btn via template */
.forum-reply__actions .forum-report-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.3em 0.6em;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
}

.forum-reply__actions .forum-report-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
