/* GoFrag Comments — Стили (тёмная тема, UIkit 3) */

.gf-comments {
    margin-top: 24px;
    padding: 16px 0;
}

/* ==============================
   Форма комментария
   ============================== */

.gf-comment-form {
    margin-bottom: 24px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.gf-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}

.gf-premod-notice {
    color: #888;
    font-size: 0.8em;
}

.gf-premod-notice a {
    color: #40ed70;
}

.gf-premod-notice a:hover {
    text-decoration: underline;
}

.gf-login-btn {
    background: #4caf50;
    border: none;
    color: #fff;
    padding: 5px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s;
}

.gf-login-btn:hover {
    background: #45a049;
}

.gf-comment-form .uk-textarea {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    resize: vertical;
    min-height: 60px;
    font-size: 0.95em;
}

.gf-comment-form .uk-textarea:focus {
    border-color: #4caf50;
    outline: none;
}

.gf-comment-form .uk-textarea::placeholder {
    color: #999;
}

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

.gf-comment-form-status {
    color: #999;
    font-size: 0.85em;
}

.gf-beta-notice {
    margin-top: 8px;
    color: #666;
    font-size: 0.8em;
}

.gf-beta-notice a {
    color: #4caf50;
    text-decoration: none;
}

.gf-beta-notice a:hover {
    text-decoration: underline;
}

.gf-submit-comment {
    background: #4caf50;
    border: none;
    color: #fff;
}

.gf-submit-comment:hover {
    background: #45a049;
}

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

/* Авторизация — плашка для гостей */
.gf-comment-login {
    padding: 16px 20px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #aaa;
}

.gf-login-prompt-text {
    font-size: 0.95em;
}

.gf-login-prompt-btn {
    background: #4caf50 !important;
    border: none !important;
    color: #fff !important;
    background-image: none !important;
    white-space: nowrap;
}

.gf-login-prompt-btn:hover {
    background: #45a049 !important;
    color: #fff !important;
}

.gf-comment-login a {
    color: #4caf50;
}

/* ==============================
   UIkit Comment — тёмная тема
   ============================== */

.gf-comment {
    padding: 12px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    transition: background 0.2s;
    position: relative;
}

.gf-comment:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* UIkit comment header/body/meta — тёмная тема */
.gf-comment .uk-comment-header {
    margin-bottom: 10px;
}

.gf-comment .uk-comment-title {
    color: #e0e0e0;
    font-size: 1em;
}

.gf-comment .uk-comment-meta {
    color: #666;
    font-size: 0.75em;
    margin-top: 4px !important;
}

.gf-comment .uk-comment-meta time {
    color: #666;
}

.gf-comment .uk-comment-body {
    color: #ccc;
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-line;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 10px;
    border-radius: 4px;
}

.gf-comment .uk-comment-body a {
    color: #4caf50;
}

.gf-comment .uk-comment-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.gf-comment .uk-comment-body pre {
    background: rgba(255, 255, 255, 0.08);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
}

/* Вложенные комментарии — линия слева */
.gf-comment-nested {
    border-left: 2px solid #4caf50;
}

/* ==============================
   Аватарки — закруглённый квадрат
   ============================== */

.gf-avatar {
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.gf-avatar-root {
    width: 40px;
    height: 40px;
}

/* Дефолтная аватарка с инициалами */
.gf-avatar-default {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    user-select: none;
    border-radius: 8px;
}

/* ==============================
   Ник и роль
   ============================== */

.gf-username {
    color: #e0e0e0 !important;
    font-weight: 700;
    text-decoration: none !important;
    font-size: 1.1em;
}

.gf-username:hover {
    color: #4caf50 !important;
}

/* Бейджи рядом с ником */
.gf-badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 10px;
    line-height: 1.75;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.9px;
    vertical-align: middle;
    margin-left: 6px;
    border-radius: 4px;
}

.gf-badge-admin {
    background: #fb3f3f;
    color: #000;
}

/* Клик по дате — копирование ссылки */
.gf-comment .uk-comment-meta time {
    cursor: pointer;
}

.gf-comment .uk-comment-meta time:hover {
    color: #4caf50;
}

.gf-copy-notice {
    color: #4caf50;
    font-size: 0.75em;
    margin-left: 6px;
    animation: gf-fadein 0.3s ease-in;
}

.gf-edited {
    color: #666;
    font-size: 1em;
    font-style: italic;
}

/* "в ответ @Ник" в meta-строке */
.gf-reply-info {
    color: #999;
}
.gf-reply-to {
    color: #4caf50;
    font-weight: 600;
    text-decoration: none;
}
.gf-reply-to:hover {
    text-decoration: underline;
    color: #66bb6a;
}

/* ==============================
   Кнопка "Ответить" — hover-reveal с анимацией underline
   ============================== */

.gf-reply-hover {
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.gf-comment:hover .gf-reply-hover,
.gf-comment:focus-within .gf-reply-hover {
    opacity: 1;
    pointer-events: auto;
}

.gf-reply-btn {
    background: none;
    border: none;
    color: #4caf50;
    cursor: pointer;
    font-size: 0.85em;
    padding: 2px 0;
    position: relative;
    display: inline-block;
}

.gf-reply-btn-text {
    position: relative;
    display: inline-block;
}

/* Underline-анимация: полоска проезжает слева направо */
.gf-reply-btn-text::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 1px;
    width: 0;
    background: #4caf50;
    transition: width 0.3s ease;
}

.gf-comment:hover .gf-reply-btn-text::after {
    width: 100%;
}

.gf-reply-btn:hover {
    color: #66bb6a;
}

.gf-reply-btn:hover .gf-reply-btn-text::after {
    background: #66bb6a;
}

/* ==============================
   Футер: голосование
   ============================== */

.gf-comment-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.gf-vote-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gf-vote-score {
    color: #aaa;
    font-size: 0.85em;
    min-width: 16px;
    text-align: center;
    transition: color 0.2s;
}

.gf-vote-score.gf-score-positive {
    color: #4caf50;
}

.gf-vote-score.gf-score-negative {
    color: #f44336;
}

/* Кнопки + − */
.gf-vote {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.9em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.gf-vote:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    color: #e0e0e0;
}

/* + нажат (state=+1) */
.gf-vote.gf-voted {
    border-color: #4caf50;
    color: #4caf50;
}

/* − нажат (state=-1) */
.gf-vote.gf-voted-down {
    border-color: #f44336;
    color: #f44336;
}

/* ==============================
   Inline форма ответа
   ============================== */

.gf-reply-form {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.gf-reply-form .uk-textarea {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    resize: vertical;
    min-height: 50px;
    font-size: 0.9em;
}

.gf-reply-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.gf-reply-cancel {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

/* ==============================
   Сворачивание веток
   ============================== */

/* "Показать ещё" — линия с текстом по центру (как uk-heading-line) */
.gf-show-more-replies,
.gf-expand-branch {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: #4caf50;
    cursor: pointer;
    font-size: 0.85em;
    padding: 8px 0;
    margin: 4px 0;
}

.gf-show-more-replies::before,
.gf-show-more-replies::after,
.gf-expand-branch::before,
.gf-expand-branch::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(76, 175, 80, 0.3);
}

.gf-show-more-replies::before,
.gf-expand-branch::before {
    margin-right: 12px;
}

.gf-show-more-replies::after,
.gf-expand-branch::after {
    margin-left: 12px;
}

.gf-show-more-replies:hover,
.gf-expand-branch:hover {
    color: #66bb6a;
}

.gf-show-more-replies:hover::before,
.gf-show-more-replies:hover::after,
.gf-expand-branch:hover::before,
.gf-expand-branch:hover::after {
    background: rgba(102, 187, 106, 0.5);
}

/* ==============================
   Загрузить ещё
   ============================== */

.gf-load-more-wrap {
    padding: 12px 0;
}

.gf-load-more {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #40ed70;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 0.85em;
    transition: all 0.2s;
}

.gf-load-more:hover {
    border-color: #40ed70;
    color: #40ed70;
}

.gf-load-more:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* ==============================
   Ошибки и уведомления
   ============================== */

.gf-error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #f44336;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 8px 0;
    font-size: 0.9em;
}

.gf-pending-notice {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
    padding: 10px 14px;
    border-radius: 4px;
    margin: 12px 0;
    font-size: 0.9em;
}

.gf-loading {
    text-align: center;
    padding: 16px;
    color: #777;
}

/* ==============================
   Анимация нового комментария
   ============================== */

.gf-comment-new {
    animation: gf-fadein 0.3s ease-in;
}

@keyframes gf-fadein {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================
   Мобильные: тач-устройства — кнопка "Ответить" видна всегда
   ============================== */

@media (hover: none) {
    .gf-reply-hover {
        opacity: 1;
        pointer-events: auto;
    }

    .gf-reply-btn-text::after {
        width: 100%;
    }
}

/* ==============================
   Адаптив: мобильные (<768px)
   ============================== */

@media (max-width: 768px) {
    .gf-comments {
        padding: 8px 0;
    }

    .gf-comment {
        padding: 8px;
    }

    .gf-comment-nested {
        margin-left: 16px !important;
    }

    .gf-avatar {
        width: 28px;
        height: 28px;
    }

    .gf-avatar-root {
        width: 32px;
        height: 32px;
    }

    .gf-vote {
        width: 22px;
        height: 22px;
        font-size: 0.85em;
    }

    .gf-show-more-replies,
    .gf-expand-branch {
        padding-left: 18px;
    }

    /* На мобильных кнопка "Ответить" видна всегда */
    .gf-reply-hover {
        opacity: 1;
        pointer-events: auto;
    }

    .gf-reply-btn-text::after {
        width: 100%;
    }
}

/* ==============================
   Аттачменты (изображения)
   ============================== */

.gf-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.gf-attach-img {
    border-radius: 6px;
    max-width: 300px;
    max-height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gf-attach-img:hover {
    opacity: 0.85;
    border-color: #4caf50;
}

/* Превью загружаемых файлов */
.gf-attach-area {
    margin: 6px 0;
}

.gf-attach-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gf-attach-previews:empty {
    display: none;
}

.gf-attach-preview {
    position: relative;
    display: inline-block;
}

.gf-attach-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.gf-attach-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #f44336;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gf-attach-remove:hover {
    background: #d32f2f;
}

/* Кнопка прикрепления */
.gf-attach-btn {
    padding: 0 8px !important;
    height: 30px;
    line-height: 28px;
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    background-image: none !important;
    min-width: auto !important;
    vertical-align: middle;
}

.gf-attach-btn:hover {
    color: #4caf50;
    border-color: #4caf50;
}

.gf-attach-btn svg {
    display: block;
}

/* Drag over */
.gf-comment-form.gf-dragover,
.gf-reply-form.gf-dragover {
    border: 2px dashed #4caf50 !important;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 6px;
}

/* Спиннер загрузки изображений */
.gf-upload-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed #555;
}
.gf-spinner-circle {
    width: 28px;
    height: 28px;
    border: 3px solid #444;
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: gf-spin 0.8s linear infinite;
}
@keyframes gf-spin {
    to { transform: rotate(360deg); }
}

/* ==============================
   Бейдж «Новые комментарии» (polling)
   ============================== */

.gf-new-comments-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.35);
    border-radius: 6px;
    color: #4caf50;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
    animation: gf-fadein 0.3s ease-in;
}

.gf-new-comments-badge:hover {
    background: rgba(76, 175, 80, 0.22);
    border-color: #4caf50;
    color: #66bb6a;
}

.gf-new-comments-badge:disabled {
    opacity: 0.6;
    cursor: wait;
}

.gf-new-comments-icon {
    flex-shrink: 0;
}

.gf-new-comments-text {
    white-space: nowrap;
}

@keyframes gf-fadein {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .gf-comment-login {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .gf-attach-img {
        max-width: 150px !important;
        max-height: 120px !important;
    }

    .gf-attach-preview img {
        width: 60px !important;
        height: 60px !important;
    }
}
