/* ============================
   ARTICLE SPECIFIC STYLES
============================ */

/* Reading Progress */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--surface-2);
    z-index: 9999;
    overflow: hidden;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 0;
    transition: width var(--transition);
    border-radius: 0 2px 2px 0;
}

/* Article Container */
.article-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: var(--space-xl);
    padding-top: calc(var(--header-height) + var(--space-lg));
    padding-bottom: var(--space-2xl);
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1200px) {
    .article-container {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

/* Article Main */
.article-main {
    margin-top: 196px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

[data-theme="dark"] .article-main {
    background: var(--surface-dark);
    box-shadow: var(--shadow-lg);
}

/* Article Header */
.article-header {
    margin-bottom: var(--space-xl);
    border-bottom: 2px solid var(--border-light);
    padding-bottom: var(--space-lg);
}

.article-category {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-primary);
}

.article-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: var(--space-md);
    line-height: 1.2;
    color: var(--text);
    font-weight: 900;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    margin-top: var(--space-md);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.meta-item .icon {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
    color: var(--text-light);
    flex-shrink: 0;
}

/* Article Cover */
.article-cover-container {
    margin: var(--space-xl) 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.article-cover {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    transition: transform var(--transition-slow);
}

.article-cover:hover {
    transform: scale(1.02);
}

.article-cover-caption {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
    font-style: italic;
    padding: 0 var(--space-md);
}

/* Table of Contents */
.table-of-contents {
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-xl) 0;
    border-right: 4px solid var(--primary);
}

[data-theme="dark"] .table-of-contents {
    background: var(--surface-2-dark);
}

.toc-title {
    font-weight: 700;
    margin-bottom: var(--space-md);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.toc-title .icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.toc-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.toc-list::-webkit-scrollbar {
    width: 4px;
}

.toc-list::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 2px;
}

.toc-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 2px;
}

.toc-item {
    margin-bottom: 0.75rem;
    position: relative;
    padding-right: 1rem;
}

.toc-item.toc-level-h3 {
    padding-right: 1.5rem;
    font-size: 0.95rem;
}

.toc-item a {
    color: var(--text);
    text-decoration: none;
    display: block;
    padding: 0.5rem 0;
    transition: all var(--transition);
    position: relative;
    line-height: 1.5;
}

.toc-item a:hover,
.toc-item a.active {
    color: var(--primary);
    transform: translateX(-5px);
}

.toc-item a::before {
    content: '';
    position: absolute;
    right: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition);
}

.toc-item a:hover::before,
.toc-item a.active::before {
    opacity: 1;
}

/* Article Content */
.article-content {
    line-height: 1.8;
    font-size: 1.125rem;
}

.article-body {
    color: var(--text);
}

.article-body h2 {
    font-size: 2rem;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    color: var(--text);
    font-weight: 800;
}

.article-body h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text);
    font-weight: 700;
}

.article-body p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.article-body a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all var(--transition);
    padding-bottom: 1px;
}

.article-body a:hover {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

.article-body video {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin: 2rem auto;
    display: block;
    box-shadow: var(--shadow-md);
}

/* ============================
   ARTICLE TABLE STYLES
============================ */

.article-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--space-lg) 0;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

/* Table Head */
.article-body thead {
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-light)
    );
}

.article-body thead th {
    padding: var(--space-sm) var(--space-md);
    color: #ffffff;
    font-weight: 700;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
}

/* Table Body */
.article-body tbody tr {
    transition: background-color var(--transition-fast);
}

.article-body tbody tr:nth-child(even) {
    background-color: var(--surface-2);
}

.article-body tbody tr:hover {
    background-color: rgba(226, 10, 62, 0.06);
}

.article-body td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
    line-height: 1.8;
}

/* Remove border from last row */
.article-body tbody tr:last-child td {
    border-bottom: none;
}

/* Alignment helpers inside table */
.article-body td.center,
.article-body th.center {
    text-align: center;
}

.article-body td.left,
.article-body th.left {
    text-align: left;
}

/* Emphasized cells */
.article-body td.strong {
    font-weight: 600;
    color: var(--primary-dark);
}

/* Code-like content inside table */
.article-body td code {
    background-color: var(--surface-2);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary);
}

/* Responsive: horizontal scroll */
.article-body .table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-body .table-wrapper table {
    min-width: 640px;
}

/* ============================
   DARK MODE REFINEMENTS
============================ */

[data-theme="dark"] .article-body table {
    background-color: var(--surface-dark);
    border-color: var(--border-dark);
}

[data-theme="dark"] .article-body tbody tr:nth-child(even) {
    background-color: var(--surface-2-dark);
}

[data-theme="dark"] .article-body tbody tr:hover {
    background-color: rgba(226, 10, 62, 0.15);
}

[data-theme="dark"] .article-body td code {
    background-color: #1f1f1f;
    color: var(--primary-light);
}


.article-body blockquote {
    border-right: 4px solid var(--primary);
    padding-right: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
}

[data-theme="dark"] .article-body blockquote {
    background: var(--surface-2-dark);
}

.article-body pre {
    background: var(--surface-2);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    border: 1px solid var(--border);
}

[data-theme="dark"] .article-body pre {
    background: var(--surface-2-dark);
}

.article-body code {
    background: var(--surface-2);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--primary);
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin: 2rem auto;
    display: block;
    box-shadow: var(--shadow-md);
}

.article-body ul,
.article-body ol {
    margin: 1.5rem 0;
    padding-right: 2rem;
}

.article-body li {
    margin-bottom: 0.5rem;
    position: relative;
}

.article-body ul li::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    right: -1rem;
}

/* Article Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: var(--space-xl) 0;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.tag {
    background: var(--surface-2);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.tag:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

/* Article Actions */
.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 2px solid var(--border);
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    position: relative;
}

[data-theme="dark"] .share-btn {
    background: var(--surface-2-dark);
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.share-btn .icon {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.share-btn.twitter:hover {
    background: #1DA1F2;
    color: white;
    border-color: #1DA1F2;
}

.share-btn.linkedin:hover {
    background: #0077B5;
    color: white;
    border-color: #0077B5;
}

.share-btn.telegram:hover {
    background: #0088cc;
    color: white;
    border-color: #0088cc;
}

.share-btn.whatsapp:hover {
    background: #25D366;
    color: white;
    border-color: #25D366;
}

.share-btn.copy-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.copy-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    white-space: nowrap;
    margin-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.copy-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--text) transparent transparent transparent;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition);
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    min-height: 48px;
}

.btn-outline {
    border: 2px solid var(--border);
    color: var(--text);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

/* Sidebar */
.article-sidebar {
    margin-top: 196px;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
    height: fit-content;
}

@media (max-width: 1200px) {
    .article-sidebar {
        position: static;
        margin-top: var(--space-xl);
    }
}

.sidebar-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

[data-theme="dark"] .sidebar-section {
    background: var(--surface-dark);
}

.sidebar-section:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Author Info */
.author-info {
    text-align: center;
    padding: var(--space-xl);
}

.author-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto var(--space-md);
    box-shadow: var(--shadow-primary);
}

.author-name {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.author-bio {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.author-social {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.author-social a {
    color: var(--text-muted);
    transition: all var(--transition);
    padding: 0.5rem;
    border-radius: var(--radius-full);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .author-social a {
    background: var(--surface-2-dark);
}

.author-social a:hover {
    color: var(--primary);
    transform: translateY(-2px);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.author-social .icon {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

/* Stats Grid */
.sidebar-title {
    font-weight: 700;
    margin-bottom: var(--space-lg);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.sidebar-title .icon {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
}

/* Related Articles */
.related-articles {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-article {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    border: 1px solid transparent;
}

[data-theme="dark"] .related-article {
    background: var(--surface-2-dark);
}

.related-article:hover {
    background: var(--surface);
    transform: translateX(-8px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.related-article-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.related-article-placeholder {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.related-article-placeholder .icon {
    width: 32px;
    height: 32px;
    color: var(--text-light);
}

.related-article-content {
    flex: 1;
    min-width: 0;
}

.related-article-title {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    line-height: 1.4;
    color: var(--text);
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-article-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Newsletter */
.newsletter-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    position: relative;
}

.newsletter-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition);
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(226, 10, 62, 0.1);
}

.form-error {
    color: #EF4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
}

.form-error:not(:empty) {
    display: block;
}

.newsletter-disclaimer {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    margin-top: var(--space-md);
    line-height: 1.5;
}

/* Icons */
.icon {
    display: inline-block;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .article-container {
        padding: var(--space-md);
        padding-top: calc(var(--header-height) + var(--space-md));
    }

    .article-main {
        padding: var(--space-lg);
    }

    .article-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .article-cover {
        height: 300px;
    }

    .article-actions {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .share-buttons {
        justify-content: center;
    }

    .sidebar-section {
        padding: var(--space-lg);
    }

    .author-info {
        padding: var(--space-lg);
    }
}

@media (max-width: 480px) {
    .article-title {
        font-size: 1.75rem;
    }

    .article-body h2 {
        font-size: 1.5rem;
    }

    .article-body h3 {
        font-size: 1.25rem;
    }

    .article-body {
        font-size: 1rem;
    }

    .related-article {
        flex-direction: column;
        text-align: center;
    }

    .related-article-img {
        width: 100%;
        height: 200px;
    }
}

/* Print Styles */
@media print {

    .reading-progress,
    .article-actions,
    .article-sidebar,
    .table-of-contents,
    header,
    footer {
        display: none !important;
    }

    .article-main {
        box-shadow: none;
        padding: 0;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    .article-body {
        font-size: 11pt;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    .article-cover {
        max-height: 300px;
    }
}