/**
 * Forum Reply Styles
 * Reply list, reply items, voting system, reply form
 */

/* ============================================
   REPLIES SECTION HEADER
   ============================================ */

.replies-section {
    margin-top: clamp(1.5rem, 3vw, 2rem);
}

.replies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    margin-bottom: clamp(1.25rem, 2.5vw, 1.5rem);
    padding-bottom: clamp(0.75rem, 1.5vw, 1rem);
    border-bottom: 2px solid var(--border);
}

.replies-header h2 {
    margin: 0;
    font-size: clamp(1.125rem, 2vw + 0.25rem, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   REPLIES SORT SELECT
   ============================================ */

.replies-sort {
    display: flex;
    align-items: center;
    gap: clamp(0.375rem, 0.75vw, 0.5rem);
}

.replies-sort label {
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.sort-select,
.replies-sort select {
    padding: clamp(0.375rem, 0.75vw, 0.5rem) clamp(1.75rem, 2.5vw, 2rem) clamp(0.375rem, 0.75vw, 0.5rem) clamp(0.625rem, 1vw, 0.75rem);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    transition: all 0.15s ease;
    min-height: 36px;
}

.sort-select:hover,
.replies-sort select:hover {
    border-color: var(--border-light);
    background-color: var(--bg-hover);
}

.sort-select:focus,
.replies-sort select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ============================================
   REPLIES EMPTY STATE
   ============================================ */

.replies-empty {
    text-align: center;
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin: clamp(1.5rem, 3vw, 2rem) 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .replies-empty {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.replies-empty svg {
    width: clamp(48px, 8vw, 64px);
    height: clamp(48px, 8vw, 64px);
    color: var(--text-muted);
    margin-bottom: clamp(0.75rem, 1.5vw, 1rem);
}

.replies-empty h3 {
    margin: 0 0 clamp(0.375rem, 0.75vw, 0.5rem) 0;
    font-size: clamp(1rem, 1.5vw + 0.25rem, 1.125rem);
    font-weight: 600;
    color: var(--text-primary);
}

.replies-empty p {
    margin: 0;
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 1.25vw + 0.15rem, 0.9375rem);
}

/* ============================================
   REPLY LIST
   ============================================ */

.reply-list {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 1.5vw, 1rem);
}

/* ============================================
   REPLY ITEM - Card with depth
   ============================================ */

.reply-item {
    display: flex;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    padding: clamp(1rem, 2vw, 1.5rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.reply-item:hover {
    border-color: var(--border-light);
}

html.dark .reply-item {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Best Answer - Success highlight with glow */
.reply-item--best-answer {
    border: 2px solid var(--success);
    background: var(--success-bg);
    box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.1);
}

.reply-item--best-answer:hover {
    border-color: var(--success);
}

/* Nested Reply - Indented */
.reply-item--nested {
    margin-left: clamp(1.5rem, 3vw, 3rem);
    background: var(--bg-tertiary);
}

/* Own Reply - User's own replies highlighted */
.reply-item--own {
    border-left: 4px solid var(--accent);
    padding-left: calc(clamp(1rem, 2vw, 1.5rem) - 4px);
    background: var(--accent-light);
}

.reply-item--own:hover {
    background: rgba(var(--accent-rgb), 0.12);
}

/* ============================================
   VOTING SYSTEM
   ============================================ */

.vote-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.125rem, 0.25vw, 0.25rem);
    flex-shrink: 0;
}

.vote-button {
    width: clamp(32px, 4vw, 36px);
    height: clamp(32px, 4vw, 36px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.vote-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
    transform: scale(1.05);
}

.vote-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Upvote active state */
.vote-button--up.vote-button--active {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.vote-button--up.vote-button--active:hover {
    background: rgba(var(--success-rgb), 0.2);
}

/* Downvote active state */
.vote-button--down.vote-button--active {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error);
}

.vote-button--down.vote-button--active:hover {
    background: rgba(var(--error-rgb), 0.2);
}

.vote-button svg {
    width: 16px;
    height: 16px;
}

/* Vote Score */
.vote-score {
    font-weight: 700;
    font-size: clamp(0.875rem, 1.25vw + 0.1rem, 1rem);
    color: var(--text-primary);
    min-width: 24px;
    text-align: center;
}

.vote-score--positive {
    color: var(--success);
}

.vote-score--negative {
    color: var(--error);
}

/* Disabled vote buttons (own replies) */
.vote-buttons--disabled {
    opacity: 0.5;
}

.vote-buttons--disabled .vote-button {
    cursor: not-allowed;
}

.vote-buttons--disabled .vote-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border);
    transform: none;
}

/* ============================================
   REPLY CONTENT
   ============================================ */

.reply-content {
    flex: 1;
    min-width: 0;
}

.reply-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.375rem, 0.75vw, 0.5rem);
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
}

/* Reply Avatar */
.reply-avatar {
    width: clamp(28px, 4vw, 36px);
    height: clamp(28px, 4vw, 36px);
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.reply-author {
    font-weight: 600;
    color: var(--text-primary);
}

.reply-author a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.reply-author a:hover {
    color: var(--accent);
}

.reply-date,
.reply-time {
    color: var(--text-muted);
}

.reply-meta-separator {
    color: var(--text-muted);
}

/* Reply-to indicator for nested replies */
.reply-to-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: clamp(0.75rem, 1.1vw + 0.1rem, 0.8125rem);
    margin-left: 0.25rem;
}

.reply-to-indicator svg {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.reply-to-name {
    color: var(--accent);
    font-weight: 500;
}

/* Reply Body Content */
.reply-body {
    line-height: 1.7;
    color: var(--text-primary);
    font-size: clamp(0.9375rem, 1.25vw + 0.2rem, 1rem);
}

.reply-body p {
    margin: 0 0 clamp(0.75rem, 1.25vw, 1rem) 0;
}

.reply-body p:last-child {
    margin-bottom: 0;
}

.reply-body a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
}

.reply-body a:hover {
    text-decoration: underline;
}

/* Code in replies */
.reply-body code {
    padding: 0.125rem 0.375rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

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

.reply-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.625rem, 1.25vw, 1rem);
    margin-top: clamp(0.75rem, 1.5vw, 1rem);
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
}

.reply-actions button,
.reply-actions a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0;
    font-size: inherit;
    transition: color 0.2s ease;
    min-height: 32px;
}

.reply-actions button:hover,
.reply-actions a:hover {
    color: var(--accent);
}

.reply-actions button:focus-visible,
.reply-actions a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.reply-actions svg {
    width: 14px;
    height: 14px;
}

/* Reply Action Button (styled version) */
.reply-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0;
    font-size: inherit;
    transition: color 0.2s ease;
    min-height: 32px;
}

.reply-action-btn:hover {
    color: var(--accent);
}

.reply-action-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.reply-action-btn svg {
    width: 14px;
    height: 14px;
}

/* Danger variant for action buttons */
.reply-action-btn--danger:hover {
    color: var(--error);
}

/* Danger action (report, delete) */
.reply-actions .action--danger:hover {
    color: var(--error);
}

/* Success action (mark as best) */
.reply-actions .action--success:hover {
    color: var(--success);
}

/* ============================================
   REPLY FORM
   ============================================ */

.reply-form {
    padding: clamp(1.25rem, 2.5vw, 1.5rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: clamp(1.5rem, 3vw, 2rem);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .reply-form {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.reply-form h3 {
    margin: 0 0 clamp(0.75rem, 1.5vw, 1rem) 0;
    font-size: clamp(1rem, 1.5vw + 0.25rem, 1.125rem);
    font-weight: 600;
    color: var(--text-primary);
}

.reply-form textarea {
    width: 100%;
    min-height: clamp(100px, 15vw, 120px);
    padding: clamp(0.75rem, 1.5vw, 1rem);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: clamp(0.9375rem, 1.25vw + 0.2rem, 1rem);
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s ease;
}

.reply-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.reply-form textarea::placeholder {
    color: var(--text-muted);
}

.reply-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    margin-top: clamp(0.75rem, 1.5vw, 1rem);
}

/* ============================================
   REPLY LOGIN PROMPT
   ============================================ */

.reply-login-prompt {
    text-align: center;
    padding: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin: clamp(1.5rem, 3vw, 2rem) 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .reply-login-prompt {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.reply-login-prompt svg {
    width: clamp(44px, 7vw, 56px);
    height: clamp(44px, 7vw, 56px);
    color: var(--accent);
    margin-bottom: clamp(0.75rem, 1.5vw, 1rem);
}

.reply-login-prompt h3 {
    margin: 0 0 clamp(0.5rem, 1vw, 0.75rem) 0;
    font-size: clamp(1.125rem, 1.75vw + 0.25rem, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
}

.reply-login-prompt p {
    margin: 0 0 clamp(1.25rem, 2.5vw, 1.5rem) 0;
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 1.25vw + 0.15rem, 0.9375rem);
    line-height: 1.6;
}

.reply-login-prompt .btn {
    min-width: 140px;
    min-height: 44px;
}

/* ============================================
   BEST ANSWER BADGE
   ============================================ */

.best-answer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--success-bg);
    color: var(--success);
    font-size: clamp(0.75rem, 1.1vw + 0.1rem, 0.8125rem);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
}

.best-answer-badge svg {
    width: 14px;
    height: 14px;
}
