/* ============================================================
   Comments Section (DLE-like style)
   ============================================================ */

:root {
    --bg-comment: #1a1a1d;
    --input-bg: #25252b;
    --accent-comment: #eb4f34;
    --text-main: #e0e0e0;
    --text-muted: #888;
    --border: #3a3a42;
}

/* Main container */
.comments-section {
    color: var(--text-main);
}

.bg-accent {
    display: inline-block;
    background: var(--accent-comment);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
}

/* ===== Comment Form Container ===== */
.comment-form-wrapper {
    background: var(--bg-comment);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.comment-form-container {
    width: 100%;
}

/* Поле имени */
.ac-inputs {
    margin-bottom: 15px;
}

.ac-inputs input {
    background: var(--input-bg);
    border: 1px solid var(--border);
    padding: 12px 15px;
    border-radius: 8px;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.3s;
    font-size: 14px;
    font-family: inherit;
}

.ac-inputs input:focus {
    border-color: var(--accent-comment);
}

/* Уведомление */
.ac-moderation-notice {
    background: rgba(235, 79, 52, 0.07);
    border-left: 3px solid var(--accent-comment);
    padding: 12px 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #bbb;
    border-radius: 0 6px 6px 0;
}

.ac-moderation-notice__icon {
    fill: var(--accent-comment);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Контейнер редактора */
.ac-textarea-wrapper {
    position: relative;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.ac-editor {
    min-height: 120px;
    padding: 15px;
    outline: none;
    line-height: 1.6;
    color: #efefef;
    max-height: 400px;
    overflow-y: auto;
    font-family: inherit;
    font-size: 14px;
}

.ac-editor.is-empty:before {
    content: attr(data-placeholder);
    color: #555;
    pointer-events: none;
    position: absolute;
}

.ac-editor b, .ac-editor strong { font-weight: 700; }
.ac-editor i, .ac-editor em { font-style: italic; }
.ac-editor u { text-decoration: underline; }

/* Панель управления */
.ac-textarea_controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
}

.ac-controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ac-format-btns {
    display: flex;
    gap: 2px;
}

.ac-fmt-btn, .smileicon {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    font-size: 14px;
}

.ac-fmt-btn:hover, .smileicon:hover { 
    background: var(--border); 
    color: #fff; 
}

.ac-fmt-btn.active {
    background: rgba(235, 79, 52, 0.15);
    color: var(--accent-comment);
}

.ac-fmt-btn b, .ac-fmt-btn i, .ac-fmt-btn u {
    pointer-events: none;
}

.smileicon { font-size: 18px; }

.ac-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#counter {
    font-size: 12px;
    color: var(--text-muted);
}

.ac-submit {
    background: var(--accent-comment);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.2s;
    font-family: inherit;
}

.ac-submit:hover {
    opacity: 0.9;
}

.ac-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Окно смайлов */
.emoji-popover {
    display: none;
    position: absolute;
    bottom: 55px;
    left: 10px;
    background: #2d2d33;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    z-index: 100;
    width: 250px;
}

.emoji-popover.open {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

.emoji-btn:hover { background: var(--border); }

/* ===== Captcha slider ===== */
#captcha-wrapper {
    margin-top: 12px;
}

.captcha-slider-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    width: 150px;
    height: 36px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    user-select: none;
}

.captcha-slider-modern.completed {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.captcha-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.captcha-thumb {
    position: absolute;
    left: 2px;
    top: 2px;
    width: 30px;
    height: 30px;
    background: #eb4f34;
    border-radius: 6px;
    cursor: grab;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(235, 79, 52, 0.3);
}

.captcha-thumb:active {
    cursor: grabbing;
    box-shadow: 0 2px 12px rgba(235, 79, 52, 0.5);
}

.captcha-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.3s;
    z-index: 1;
}

.captcha-slider-modern.completed .captcha-label {
    opacity: 0;
}

.captcha-check {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 3;
}

.captcha-slider-modern.completed .captcha-check {
    opacity: 1;
}

.captcha-slider-modern.completed .captcha-thumb {
    background: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ===== Comment Items ===== */
.comments-list {
    margin-top: 16px;
}

.comments-empty {
    text-align: center;
    padding: 48px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.comments-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.comment-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    animation: commentFadeIn 0.3s ease forwards;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-item.comment-reply {
    margin-left: 20px;
    padding: 12px 0 12px 16px;
    border-left: 2px solid rgba(255,255,255,0.06);
    border-bottom: none;
}

.comment-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-top: 2px;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: #f1f5f9;
}

.comment-badge-editor {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.comment-date {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
}

.comment-content {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255,255,255,0.85);
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.comment-content b, .comment-content strong { font-weight: 700; }
.comment-content i, .comment-content em { font-style: italic; }
.comment-content u { text-decoration: underline; }

.comment-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comment-reply-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comment-reply-btn:hover {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

/* Вложенные ответы */
.comment-replies {
    margin-top: 8px;
    padding-left: 4px;
}

/* Load more button */
.load-more-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    font-family: inherit;
}

.load-more-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* Animations */
@keyframes commentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile adaptive */
@media (max-width: 768px) {
    .comment-form-wrapper {
        padding: 16px;
    }
    .ac-textarea_controls {
        flex-direction: column;
        gap: 8px;
    }
    .ac-controls-right {
        width: 100%;
        justify-content: flex-end;
    }
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 576px) {
    .ac-submit {
        padding: 8px 14px;
        font-size: 12px;
    }
    .comment-item.comment-reply {
        margin-left: 8px;
        padding-left: 8px;
    }
}