/* =============================================
   ARTICLE PAGE — LAYOUT & FRAME
   ============================================= */

.article-page {
    max-width: 60vw;
    margin: 40px auto;
    padding: 40px 48px;
    background-color: #20232aea;
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    backdrop-filter: blur(14px) saturate(1.15);
    color: #c8c8c8;
    border-radius: 12px;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.45);
    visibility: hidden;
}

.article-page.loaded {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease forwards, visibility 0.5s ease;
}

/* =============================================
   ARTICLE TITLE
   ============================================= */

.article-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

/* Decorative accent line under the title */
.article-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #dc3545;
    border-radius: 2px;
    margin: 14px auto 0;
}

/* =============================================
   ARTICLE META
   ============================================= */

.article-meta {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #2e3240;
    font-size: 0.875rem;
    color: #888;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.article-meta p {
    margin: 0;
}

.article-meta strong {
    color: #c8c8c8;
}

/* =============================================
   ARTICLE CONTENT — BASE
   ============================================= */

.article-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #c8c8c8;
    margin-top: 32px;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* =============================================
   TYPOGRAPHY — HEADINGS
   ============================================= */

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: #ffffff;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2em;
    margin-bottom: 0.6em;
    letter-spacing: -0.015em;
}

.article-content h1 { font-size: 2em; }
.article-content h2 { font-size: 1.6em; border-bottom: 1px solid #2e3240; padding-bottom: 0.25em; }
.article-content h3 { font-size: 1.3em; }
.article-content h4 { font-size: 1.1em; color: #ddd; }
.article-content h5 { font-size: 1em; color: #ccc; }
.article-content h6 { font-size: 0.9em; color: #aaa; }

/* =============================================
   TYPOGRAPHY — PARAGRAPHS & INLINE
   ============================================= */

.article-content p {
    margin-bottom: 1.25em;
}

.article-content p:last-child {
    margin-bottom: 0;
}

.article-content strong,
.article-content b {
    font-weight: 700;
    color: #e8e8e8;
}

.article-content em,
.article-content i {
    font-style: italic;
    color: #bbb;
}

.article-content u {
    text-decoration-color: rgba(220, 53, 69, 0.6);
}

.article-content s {
    color: #888;
}

.article-content sub { font-size: 0.75em; }
.article-content sup { font-size: 0.75em; }

/* =============================================
   LINKS
   ============================================= */

.article-content a {
    color: #dc3545;
    text-decoration: none;
    border-bottom: 1px solid rgba(220, 53, 69, 0.35);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.article-content a:hover {
    color: #e96373;
    border-bottom-color: rgba(220, 53, 69, 0.8);
}

/* =============================================
   BLOCKQUOTE
   ============================================= */

.article-content blockquote {
    margin: 1.5em 0;
    padding: 14px 20px 14px 20px;
    border-left: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.06);
    border-radius: 0 6px 6px 0;
    color: #aaa;
    font-style: italic;
    line-height: 1.7;
}

.article-content blockquote p {
    margin: 0;
}

/* =============================================
   CODE — INLINE
   ============================================= */

.article-content code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.875em;
    background-color: #1a1d26;
    color: #e06c75;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #2e3240;
}

/* =============================================
   CODE — BLOCKS (Quill syntax highlight)
   ============================================= */

.article-content pre,
.article-content pre.ql-syntax {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.9em;
    background-color: #13151e;
    color: #abb2bf;
    padding: 20px 24px;
    border-radius: 8px;
    border: 1px solid #2a2d3a;
    overflow-x: auto;
    line-height: 1.65;
    margin: 1.5em 0;
    white-space: pre;
    tab-size: 4;
}

.article-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    border-radius: 0;
}

/* =============================================
   LISTS
   ============================================= */

.article-content ul,
.article-content ol {
    margin: 0.75em 0 1.25em 0;
    padding-left: 1.75em;
}

.article-content li {
    margin-bottom: 0.4em;
    line-height: 1.75;
}

.article-content ul li {
    list-style-type: disc;
}

.article-content ul li::marker {
    color: #dc3545;
}

.article-content ol li {
    list-style-type: decimal;
}

.article-content ol li::marker {
    color: #dc3545;
    font-weight: 600;
}

/* Nested lists */
.article-content ul ul,
.article-content ol ul { list-style-type: circle; }
.article-content ul ul ul,
.article-content ol ul ul { list-style-type: square; }

/* Quill checklist */
.article-content ul[data-checked] li,
.article-content li[data-list="checked"],
.article-content li[data-list="unchecked"] {
    list-style-type: none;
    padding-left: 1.5em;
    position: relative;
}

/* =============================================
   QUILL ALIGNMENT CLASSES
   ============================================= */

.article-content .ql-align-center { text-align: center; }
.article-content .ql-align-right  { text-align: right; }
.article-content .ql-align-justify { text-align: justify; }

/* =============================================
   QUILL FONT SIZE CLASSES
   ============================================= */

.article-content .ql-size-small  { font-size: 0.8em; }
.article-content .ql-size-large  { font-size: 1.3em; }
.article-content .ql-size-huge   { font-size: 1.65em; }

/* =============================================
   QUILL INDENT CLASSES (lists / paragraphs)
   ============================================= */

.article-content .ql-indent-1 { padding-left: 3em; }
.article-content .ql-indent-2 { padding-left: 6em; }
.article-content .ql-indent-3 { padding-left: 9em; }
.article-content .ql-indent-4 { padding-left: 12em; }
.article-content .ql-indent-5 { padding-left: 15em; }
.article-content .ql-indent-6 { padding-left: 18em; }
.article-content .ql-indent-7 { padding-left: 21em; }
.article-content .ql-indent-8 { padding-left: 24em; }

/* =============================================
   IMAGES
   ============================================= */

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    margin: 24px auto;
    cursor: zoom-in;
}

/* =============================================
   VIDEO & IFRAMES (YouTube, Vimeo embeds)
   ============================================= */

.article-content iframe,
.article-content video {
    max-width: 100%;
    display: block;
    margin: 24px auto;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

/* Responsive 16:9 wrapper Quill wraps video iframes in */
.article-content .ql-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    border: none;
    margin: 24px auto;
}

/* =============================================
   HORIZONTAL RULE
   ============================================= */

.article-content hr {
    border: none;
    border-top: 1px solid #2e3240;
    margin: 2em 0;
}

/* =============================================
   TABLES
   ============================================= */

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95em;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.article-content th,
.article-content td {
    padding: 10px 16px;
    border: 1px solid #2e3240;
    text-align: left;
    vertical-align: top;
}

.article-content th {
    background-color: #1a1d26;
    color: #fff;
    font-weight: 600;
    border-color: #3d4252;
}

.article-content tr:nth-child(even) td {
    background-color: #1e2130;
}

.article-content tr:hover td {
    background-color: #252836;
}

/* =============================================
   SCROLLBAR — WEBKIT
   ============================================= */

.article-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.article-content::-webkit-scrollbar-track {
    background: #2c303a;
    border-radius: 4px;
}

.article-content::-webkit-scrollbar-thumb {
    background: #dc3545;
    border-radius: 4px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 992px) {
    .article-page {
        max-width: 80vw;
        padding: 30px 28px;
    }
}

@media (max-width: 768px) {
    .article-page {
        max-width: 95vw;
        margin: 20px auto;
        padding: 24px 18px;
    }

    .article-title {
        font-size: 1.7rem;
    }

    .article-content {
        font-size: 1rem;
    }

    .article-content h1 { font-size: 1.6em; }
    .article-content h2 { font-size: 1.35em; }
    .article-content h3 { font-size: 1.15em; }

    .article-meta {
        flex-direction: column;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .article-page {
        max-width: 100vw;
        margin: 0;
        padding: 20px 14px;
        border-radius: 0;
        box-shadow: none;
    }

    .article-title {
        font-size: 1.4rem;
    }

    .article-content {
        font-size: 0.95rem;
        line-height: 1.75;
    }

    .article-content pre,
    .article-content pre.ql-syntax {
        padding: 14px;
        font-size: 0.82em;
    }

    .article-content .ql-indent-1 { padding-left: 1.5em; }
    .article-content .ql-indent-2 { padding-left: 3em; }
    .article-content .ql-indent-3 { padding-left: 4.5em; }
    .article-content .ql-indent-4 { padding-left: 6em; }
    .article-content .ql-indent-5,
    .article-content .ql-indent-6,
    .article-content .ql-indent-7,
    .article-content .ql-indent-8 { padding-left: 6em; }
}

/* =============================================
   UPLOAD DRAG-AND-DROP (used on article edit)
   ============================================= */

.upload-area.highlight {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.preview-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-remove:hover {
    background: rgba(220, 53, 69, 1);
}

@media (hover: none) and (pointer: coarse) {
    .preview-remove {
        min-height: 44px;
        min-width: 44px;
    }

    .preview-remove:hover {
        background: rgba(220, 53, 69, 0.8);
        transform: none;
    }
}

/* ─── Просмотр изображений в теле статьи / новости (лайтбокс, см. article.js) ─ */

.article-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem 1.5rem;
    box-sizing: border-box;
    background: rgba(6, 8, 12, 0.9);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.article-image-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.article-image-lightbox__img {
    max-width: min(96vw, 100%);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.article-image-lightbox__close {
    position: absolute;
    top: 0.65rem;
    right: 0.85rem;
    z-index: 1;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: none;
    border-radius: 10px;
    font-size: 1.75rem;
    line-height: 1;
    color: #fff;
    background: rgba(220, 53, 69, 0.35);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.article-image-lightbox__close:hover {
    background: rgba(220, 53, 69, 0.55);
}

.article-image-lightbox__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* =============================================
   ARTICLE LIKES
   ============================================= */

.article-likes {
    margin-top: 24px;
    display: flex;
    align-items: center;
}

.article-likes__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 18px 7px 14px;
    background: transparent;
    border: 1px solid #3a3f52;
    border-radius: 20px;
    color: #888;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
    line-height: 1;
}

.article-likes__btn:hover:not(:disabled) {
    border-color: #dc3545;
    color: #dc3545;
}

.article-likes__btn--active {
    border-color: #dc3545;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.article-likes__btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.article-likes__btn:focus-visible {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

.article-likes__readonly {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 18px 7px 14px;
    border: 1px solid #3a3f52;
    border-radius: 20px;
    color: #666;
    font-size: 0.95rem;
    cursor: default;
}

.article-likes__icon {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-block;
}

.article-likes__count {
    font-weight: 600;
    min-width: 1ch;
}

/* =============================================
   ARTICLE COMMENTS — SECTION
   ============================================= */

.article-comments {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #2e3240;
}

.article-comments__heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.article-comments__total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 12px;
    background: #2e3240;
    color: #888;
    font-size: 0.8rem;
    font-weight: 600;
}

.article-comments__empty {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 24px;
}

.article-comments__login-hint {
    margin-top: 24px;
    color: #888;
    font-size: 0.9rem;
}

.article-comments__login-hint a {
    color: #dc3545;
    text-decoration: none;
}

.article-comments__login-hint a:hover {
    text-decoration: underline;
}

.article-comments__list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* =============================================
   COMMENT BLOCK
   ============================================= */

.comment {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #252830;
}

.comment:last-child {
    border-bottom: none;
}

/* ── Avatar ── */
.comment__avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #2e3240;
    border: 1px solid #3a3f52;
    display: block;
    margin-top: 1px;
}

/* ── Body wrapper ── */
.comment__body-wrap {
    flex: 1;
    min-width: 0;
}

.comment__header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment__header-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.comment__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.comment__badges .badge {
    font-size: 0.65em;
    padding: 2px 8px;
    letter-spacing: 0.35px;
}

.comment__author {
    font-weight: 600;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.comment__date {
    color: #555;
    font-size: 0.78rem;
    margin-left: auto;
    flex-shrink: 0;
}

.comment__text {
    color: #c8c8c8;
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment__actions {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Comment like button ── */
.comment__like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #555;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
    line-height: 1;
}

.comment__like-btn:hover:not(:disabled) {
    color: #dc3545;
}

.comment__like-btn--active {
    color: #dc3545;
}

.comment__like-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.comment__like-btn:focus-visible {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
    border-radius: 3px;
}

.comment__like-readonly {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #444;
    font-size: 0.8rem;
    line-height: 1;
}

.comment__like-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.comment__like-count {
    min-width: 0;
    font-weight: 600;
}

/* ── Reply button ── */
.comment__reply-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
}

.comment__reply-btn:hover {
    color: #dc3545;
}

/* ── Reply badge ── */
.comment__reply-label {
    font-size: 0.75rem;
    color: #dc3545;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Depth indentation ── */
.comment--reply {
    position: relative;
}

.comment--depth-1 {
    padding-left: 20px;
    border-left: 2px solid #2e3240;
    margin-left: 16px;
    border-bottom-color: transparent;
}

.comment--depth-2 {
    padding-left: 20px;
    border-left: 2px solid #3a3f52;
    margin-left: 32px;
    border-bottom-color: transparent;
}

.comment--depth-3 {
    padding-left: 20px;
    border-left: 2px solid #44495e;
    margin-left: 48px;
    border-bottom-color: transparent;
}

/* Faint separator after the last reply in a thread */
.comment--reply + .comment:not(.comment--reply),
.comment--reply:last-child {
    border-bottom: 1px solid #252830;
}

/* ── Admin delete button ── */
.comment__delete-btn {
    background: none;
    border: none;
    color: #5a2a2a;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
    margin-left: auto;
}

.comment__delete-btn:hover:not(:disabled) {
    color: #dc3545;
}

.comment__delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Deleted comment state ── */
.comment--deleted .comment__avatar {
    opacity: 0.3;
    filter: grayscale(1);
}

.comment__text--deleted {
    color: #4a4a55;
    font-style: italic;
    font-size: 0.875rem;
}

.comment--deleted .comment__header .comment__date {
    color: #3a3a45;
}

/* =============================================
   COMMENT FORM
   ============================================= */

.comment-form--root {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #2e3240;
}

.comment-form__label {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0 0 12px;
}

.comment__reply-form {
    margin-top: 10px;
}

.comment-form__textarea {
    width: 100%;
    box-sizing: border-box;
    background: #181b22;
    border: 1px solid #2e3240;
    border-radius: 8px;
    color: #c8c8c8;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 10px 14px;
    resize: vertical;
    transition: border-color 0.18s ease;
    font-family: inherit;
}

.comment-form__textarea:focus {
    outline: none;
    border-color: #dc3545;
}

.comment-form__textarea--error {
    border-color: #dc3545;
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.comment-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-form__counter {
    font-size: 0.75rem;
    color: #555;
}

.comment-form__btns {
    display: flex;
    gap: 8px;
}

.comment-form__cancel {
    background: none;
    border: 1px solid #3a3f52;
    border-radius: 6px;
    color: #888;
    font-size: 0.85rem;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.comment-form__cancel:hover {
    border-color: #888;
    color: #c8c8c8;
}

.comment-form__submit {
    background: #dc3545;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 16px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.comment-form__submit:hover:not(:disabled) {
    background: #c82333;
}

.comment-form__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================
   COMMENT ERROR TOAST
   ============================================= */

.comment-error-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #2a1a1d;
    border: 1px solid #dc3545;
    border-radius: 8px;
    color: #f5c6cb;
    font-size: 0.875rem;
    padding: 10px 20px;
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

.comment-error-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* =============================================
   RESPONSIVE — COMMENTS
   ============================================= */

@media (max-width: 600px) {
    .comment__avatar { width: 28px; height: 28px; }
    .comment { gap: 8px; }

    .comment--depth-1 { margin-left: 8px; }
    .comment--depth-2 { margin-left: 16px; }
    .comment--depth-3 { margin-left: 24px; }

    .article-comments__heading { font-size: 1.1rem; }
}
