/* =========================================
   Article Detail Page
   ========================================= */

.article-body {
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.article-main {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 100px 24px 64px;
    position: relative;
    z-index: 1;
}

@media (min-width: 1024px) {
    .article-main { padding: 120px 48px 80px; }
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 16px;
    transition: color .2s var(--ease), background .2s var(--ease);
}

.article-back:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.article-back svg { width: 14px; height: 14px; }

/* =========================================
   Article card
   ========================================= */
.article-card {
    background: rgba(20, 22, 28, 0.7);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 36px 36px 32px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 560px) {
    .article-card { padding: 24px 20px; }
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent 60%);
    opacity: .7;
}

.article-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.article-card__tag {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.article-card__date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.article-card__title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 16px;
    letter-spacing: .3px;
}

@media (max-width: 560px) {
    .article-card__title { font-size: 22px; }
}

.article-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.article-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-card__meta-item svg {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

.article-card__summary {
    font-size: 15px;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 24px;
    padding: 14px 16px;
    background: rgba(34, 211, 238, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
}

/* =========================================
   Article body (preview + full)
   ========================================= */
.article-preview,
.article-full {
    font-size: 15px;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.88);
    position: relative;
}

/* PDF preview iframe (logged-in, when article has pdf_path) */
.article-pdf-frame {
    margin: 8px 0 4px;
}
.article-pdf-frame iframe {
    display: block;
    width: 100%;
    height: 78vh;
    min-height: 600px;
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 6px;
    background: #1a1a1a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.article-pdf-hint {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.62);
    text-align: center;
    line-height: 1.6;
}
.article-pdf-open {
    background: none;
    border: none;
    color: var(--accent);
    font: inherit;
    cursor: pointer;
    padding: 0 2px;
    text-decoration: underline;
}
.article-pdf-open:hover { color: #67e8f9; }

.article-preview h3,
.article-full h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
    line-height: 1.4;
}

.article-preview h3:first-child,
.article-full h3:first-child { margin-top: 0; }

.article-preview p,
.article-full p {
    margin-bottom: 14px;
    text-indent: 0;
}

.article-preview strong,
.article-full strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article-preview ul,
.article-preview ol,
.article-full ul,
.article-full ol {
    padding-left: 24px;
    margin: 12px 0 16px;
}

.article-preview li,
.article-full li {
    margin: 6px 0;
    line-height: 1.75;
}

.article-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.article-table th,
.article-table td {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.article-table th {
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent);
    font-weight: 600;
    width: 30%;
}

.article-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.article-note {
    margin-top: 24px;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.06);
    border-left: 3px solid #fbbf24;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.78);
    text-indent: 0;
}

/* =========================================
   Login gate (when not logged in)
   ========================================= */
.article-gate {
    margin-top: 16px;
    padding: 32px 24px;
    background: rgba(20, 22, 28, 0.6);
    border: 1px dashed rgba(34, 211, 238, 0.3);
    border-radius: 12px;
    text-align: center;
    position: relative;
}

.article-gate[hidden] { display: none; }

.article-gate::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #042f33;
    border-radius: 50%;
    box-shadow: 0 0 12px var(--accent-glow);
}

.article-gate__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.article-gate__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(34, 211, 238, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-top: 4px;
}

.article-gate__icon svg { width: 24px; height: 24px; }

.article-gate__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.article-gate__desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.7;
    max-width: 400px;
}

.article-gate__actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.article-gate__btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s var(--ease);
    text-decoration: none;
}

.article-gate__btn--primary {
    background: linear-gradient(180deg, #5eead4 0%, #22d3ee 50%, #06b6d4 100%);
    color: #042f33;
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.35);
}

.article-gate__btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.5);
    filter: brightness(1.05);
}

.article-gate__btn--ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.article-gate__btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* =========================================
   Article actions
   ========================================= */
.article-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.article-download,
.article-fullscreen,
.article-favorite {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s var(--ease);
    font-family: inherit;
}

.article-download {
    background: linear-gradient(180deg, #5eead4 0%, #22d3ee 50%, #06b6d4 100%);
    color: #042f33;
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.3);
}

.article-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.45);
    filter: brightness(1.05);
}

.article-fullscreen {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.article-fullscreen:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.article-favorite {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.article-favorite:hover {
    border-color: #f59e0b;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.article-favorite[data-state="on"] {
    border-color: #f59e0b;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.article-favorite[data-state="on"] svg {
    fill: #f59e0b;
    fill-opacity: 1;
}

.article-favorite svg {
    width: 14px;
    height: 14px;
}

.article-download svg,
.article-fullscreen svg {
    width: 14px;
    height: 14px;
}

/* =========================================
   Comments
   ========================================= */
.article-comments {
    margin-top: 32px;
    background: rgba(20, 22, 28, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 28px 32px;
}

@media (max-width: 560px) {
    .article-comments { padding: 22px 20px; }
}

.article-comments__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-comments__count {
    color: var(--text-tertiary);
    font-weight: 400;
    font-size: 14px;
}

.article-comments__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}

.article-comments__form[hidden] { display: none; }

.article-comments__user {
    font-size: 13px;
    color: var(--text-secondary);
}

.article-comments__user strong {
    color: var(--accent);
    font-weight: 600;
}

.article-comments__textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 80px;
    transition: border-color .2s var(--ease), background .2s var(--ease);
    outline: none;
}

.article-comments__textarea:hover {
    border-color: rgba(34, 211, 238, 0.35);
}

.article-comments__textarea:focus {
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.04);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.article-comments__textarea::placeholder { color: var(--text-tertiary); }

.article-comments__form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.article-comments__hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

.article-comments__submit {
    padding: 10px 24px;
    background: linear-gradient(180deg, #5eead4 0%, #22d3ee 50%, #06b6d4 100%);
    color: #042f33;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.3);
}

.article-comments__submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.45);
}

.article-comments__login-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: rgba(34, 211, 238, 0.05);
    border: 1px dashed rgba(34, 211, 238, 0.3);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 22px;
}

.article-comments__login-prompt[hidden] { display: none; }

.article-comments__login-link {
    color: var(--accent);
    font-weight: 600;
}

.article-comments__login-link:hover { text-decoration: underline; }

.article-comments__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-comments__empty {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
    padding: 32px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    margin: 0;
}

/* Threaded replies: indented under parent */
.comment-item__replies {
    list-style: none;
    margin: 10px 0 0 0;
    padding: 0 0 0 16px;
    border-left: 2px solid rgba(34, 211, 238, 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.comment-item--reply { background: rgba(34, 211, 238, 0.05); }
.comment-item--admin {
    border-color: rgba(34, 211, 238, 0.4);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(34, 211, 238, 0.02));
}

.comment-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 14px 16px;
    transition: background .2s var(--ease);
}

.comment-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.comment-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}

.comment-item__user {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.comment-item__time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.comment-item__text {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.88);
    margin: 0;
    word-wrap: break-word;
}

/* Top action buttons (under summary) */
.article-actions--top {
    margin: 20px 0 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* =========================================
   Visible scrollbar (article body)
   ========================================= */
.article-body {
    scrollbar-color: #22d3ee #0b0d12;
    scrollbar-width: thin;
}
.article-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.article-body::-webkit-scrollbar-track {
    background: #0b0d12;
}
.article-body::-webkit-scrollbar-thumb {
    background: #22d3ee;
    border-radius: 5px;
}
.article-body::-webkit-scrollbar-thumb:hover {
    background: #67e8f9;
}
