/* ================================================================
   ARTIKEL DETAIL — View Article
   Uses: core.css vars + artikel.css (reuse .atk-card, .atk-breadcrumb)
   Prefix: atv-* (artikel view)
   ================================================================ */

/* ---- Light / Dark Container ---- */
#atv-container { transition: background-color 0.4s ease, color 0.4s ease; }
#atv-container.atv-light { background: var(--white); color: var(--gray-900); }
#atv-container.atv-dark  { background: #091f1e; color: #dbeae8; }

/* ================================================================
   DARK MODE OVERRIDES
   ================================================================ */
#atv-container.atv-dark .atv-title { color: #fff; }
#atv-container.atv-dark .atv-author-name { color: #e0eded; }
#atv-container.atv-dark .atv-date,
#atv-container.atv-dark .atv-stat { color: #7aa8a5; }
#atv-container.atv-dark .atv-divider { background: #1a4240; }
#atv-container.atv-dark .atv-meta-bar { background: #0f2d2b; border: none; }
#atv-container.atv-dark .atv-share-label { color: #7aa8a5; }
#atv-container.atv-dark .atv-share-btn { background: #0f2d2b; border-color: #1a4240; color: #8ab5b2; }
#atv-container.atv-dark .atv-share-btn span { color: #8ab5b2; }
#atv-container.atv-dark .atv-body { color: #c4dad8; }
#atv-container.atv-dark .atv-body h3 { color: #fff; border-bottom-color: #1a4240; }
#atv-container.atv-dark .atv-body h4 { color: #e0eded; }
#atv-container.atv-dark .atv-body p,
#atv-container.atv-dark .atv-body li,
#atv-container.atv-dark .atv-body ul,
#atv-container.atv-dark .atv-body ol { color: #b0cbc8; }
#atv-container.atv-dark .atv-tag { background: #0f2d2b; color: var(--teal-400); border-color: #1a4240; }
#atv-container.atv-dark .atv-tags { border-top-color: #1a4240; }
#atv-container.atv-dark .atv-toc-card { background: #0f2d2b; border-color: #1a4240; }
#atv-container.atv-dark .atv-toc-header { background: linear-gradient(135deg, #155e59, #178780); }
#atv-container.atv-dark .atv-toc-search { border-bottom-color: #1a4240; }
#atv-container.atv-dark .atv-toc-search input { background: #091f1e; border-color: #1a4240; color: #e0eded; }
#atv-container.atv-dark .atv-toc-item { color: #8ab5b2; }
#atv-container.atv-dark .atv-toc-item:hover { background: #1a4240; color: #fff; }
#atv-container.atv-dark .atv-toc-item.active { background: var(--teal-600); color: #fff; }
#atv-container.atv-dark .atv-promo-card { background: #0f2d2b; border-color: #1a4240; }
#atv-container.atv-dark .atv-promo-header { background: linear-gradient(135deg, #155e59, #178780); }
#atv-container.atv-dark .atv-promo-visual { background: linear-gradient(135deg, #122e2c, #163d3a); }
#atv-container.atv-dark .atv-promo-icon { background: #1a4240; color: var(--teal-400); border-color: #225755; }
#atv-container.atv-dark .atv-promo-title { color: #fff; }
#atv-container.atv-dark .atv-promo-sub { color: #7aa8a5; }
#atv-container.atv-dark .atv-related { background: #091f1e; }
#atv-container.atv-dark .atv-related-header .sec-title { color: #fff; }
#atv-container.atv-dark .atk-card { background: #0f2d2b; border-color: #1a4240; }
#atv-container.atv-dark .atk-card-title { color: #fff; }
#atv-container.atv-dark .atk-card-desc { color: #7aa8a5; }
#atv-container.atv-dark .atk-card-meta { color: #5f8a87; }
#atv-container.atv-dark .atk-card-link { color: var(--teal-400); }
#atv-container.atv-dark .atv-toggle-pill { background: #1a4240; border-color: #2a5755; color: #e0eded; }
#atv-container.atv-dark .atk-breadcrumb { color: #5f8a87; }
#atv-container.atv-dark .atk-breadcrumb a { color: var(--teal-400); }
#atv-container.atv-dark .atk-breadcrumb .sep { color: #2a5250; }
#atv-container.atv-dark .ea-cta { background: #091f1e; }
/* Dark mode — Table (override Bootstrap high specificity) */
#atv-container.atv-dark .atv-body .table,
#atv-container.atv-dark .atv-body table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #b0cbc8 !important;
    --bs-table-border-color: #1a4240 !important;
    color: #b0cbc8 !important;
}
#atv-container.atv-dark .atv-body .table > :not(caption) > * > *,
#atv-container.atv-dark .atv-body table td,
#atv-container.atv-dark .atv-body table th {
    color: #b0cbc8 !important;
    background-color: transparent !important;
    border-bottom-color: #1a4240 !important;
    box-shadow: none !important;
}
#atv-container.atv-dark .atv-body table th {
    color: #e0eded !important;
    background-color: rgba(21,94,89,0.3) !important;
}
#atv-container.atv-dark .atv-body table tr:nth-child(even) > * {
    background-color: rgba(15,45,43,0.5) !important;
}
#atv-container.atv-dark .atv-body .table-responsive {
    border-color: #1a4240;
}
#atv-container.atv-dark .atv-body .table-borderless > :not(caption) > * > * {
    border-bottom: none !important;
}
#atv-container.atv-dark .atv-body b,
#atv-container.atv-dark .atv-body strong { color: #e0eded; }
#atv-container.atv-dark .atv-body font,
#atv-container.atv-dark .atv-body font.text-primary { color: var(--teal-400) !important; }
#atv-container.atv-dark .atv-body a { color: var(--teal-400); }
/* ================================================================
   HEADER
   ================================================================ */
.atv-header { margin-bottom: 24px; }

/* Title */
.atv-title {
    font-size: 32px; font-weight: 800;
    color: var(--gray-900); line-height: 1.28;
    margin-bottom: 20px;
}

/* ---- Meta Bar (single unified strip) ---- */
.atv-meta-bar {
    display: flex; align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 14px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--teal-50) 0%, white 100%);
    border: none;
    border-radius: var(--r-md);
}
.atv-meta-left {
    display: flex; align-items: center; gap: 12px;
}
.atv-author-avatar {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 15px; flex-shrink: 0;
}
.atv-author-info {
    display: flex; flex-direction: column;
}
.atv-author-name {
    font-size: 14px; font-weight: 700; color: var(--gray-900);
    line-height: 1.2;
}
.atv-date { font-size: 12px; color: var(--gray-500); line-height: 1.3; }

.atv-meta-right {
    display: flex; align-items: center; gap: 12px;
}
.atv-stat {
    font-size: 12px; color: var(--gray-500); font-weight: 600;
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap;
}
.atv-divider {
    width: 1px; height: 24px;
    background: var(--gray-200);
}
.atv-toggle-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 100px;
    background: var(--white); border: 1.5px solid var(--gray-200);
    cursor: pointer; font-size: 12px; font-weight: 600;
    color: var(--teal-700); transition: var(--ease); user-select: none;
    white-space: nowrap;
}
.atv-toggle-pill:hover {
    border-color: var(--teal-400);
    background: var(--teal-50);
}
.atv-toggle-pill i { color: var(--gold); font-size: 13px; }

/* ================================================================
   HERO IMAGE
   ================================================================ */
.atv-hero {
    position: relative; border-radius: var(--r-lg);
    overflow: hidden; margin-bottom: 20px;
    max-height: 460px;
}
.atv-hero img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.6s cubic-bezier(.22,1,.36,1);
}
.atv-hero:hover img { transform: scale(1.02); }
.atv-hero-cat {
    position: absolute; top: 16px; left: 16px;
    background: rgba(255,255,255,0.92); backdrop-filter: blur(8px);
    color: var(--teal-700); font-size: 12px; font-weight: 700;
    padding: 6px 14px; border-radius: 10px;
    display: flex; align-items: center; gap: 6px;
    text-transform: capitalize;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.atv-hero-views {
    position: absolute; bottom: 16px; right: 16px;
    background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
    color: #fff; font-size: 12px; font-weight: 600;
    padding: 6px 14px; border-radius: 10px;
    display: flex; align-items: center; gap: 6px;
    border:1px solid #fff;
}

/* ================================================================
   SHARE BAR
   ================================================================ */
.atv-share {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 28px; flex-wrap: wrap;
    justify-content: flex-end;
}
.atv-share-label { font-size: 13px; color: var(--gray-500); font-weight: 500; }
.atv-share-links { display: flex; gap: 8px; flex-wrap: wrap; }
.atv-share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 10px;
    font-size: 13px; font-weight: 500;
    border: 1.5px solid var(--gray-200);
    background: var(--white); color: var(--gray-500);
    cursor: pointer; transition: var(--ease); text-decoration: none;
}
.atv-share-btn span { font-size: 12px; }
.atv-share-btn:hover { transform: translateY(-2px); }
.atv-share-fb:hover  { background: #1877F2; color: #fff; border-color: #1877F2; }
.atv-share-fb:hover span { color: #fff; }
.atv-share-tw:hover  { background: #000; color: #fff; border-color: #000; }
.atv-share-tw:hover span { color: #fff; }
.atv-share-wa:hover  { background: #25D366; color: #fff; border-color: #25D366; }
.atv-share-wa:hover span { color: #fff; }
.atv-share-copy:hover { background: var(--teal-500); color: #fff; border-color: var(--teal-500); }
.atv-share-copy:hover span { color: #fff; }

/* ================================================================
   LAYOUT (content + sidebar)
   ================================================================ */
.atv-layout {
    display: flex; gap: 32px; align-items: flex-start;
}
.atv-main { flex: 1; min-width: 0; }
.atv-sidebar {
    width: 300px; flex-shrink: 0;
    position: sticky;
    top: calc(var(--topbar-h) + var(--navbar-h) - 24px);
    display: flex; flex-direction: column; gap: 20px;
}

/* ================================================================
   ARTICLE BODY (rendered HTML from DB)
   ================================================================ */
.atv-body {
    font-size: 15px; line-height: 1.85; color: var(--gray-700);
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: hidden;
}
.atv-body h3 {
    font-size: 24px; font-weight: 800;
    color: var(--teal-800); margin: 36px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--teal-100);
}
.atv-body h4 {
    font-size: 22px; font-weight: 800;
    color: var(--teal-800); margin: 36px 0 14px;
    padding-bottom: 10px;
}
.atv-body p { margin-bottom: 16px; }
.atv-body ul, .atv-body ol { margin-bottom: 16px; padding-left: 24px; list-style: disc; }
.atv-body ol { list-style: decimal; }
.atv-body li { margin-bottom: 8px; padding-left: 4px; font-size: 15px; }
.atv-body ul li::marker { color: var(--teal-500); }
.atv-body a { color: var(--teal-600); font-weight: 600; }
.atv-body a:hover { text-decoration: underline; }
.atv-body .text-primary { color: var(--teal-600) !important; }
.atv-body font.text-primary { color: var(--teal-600) !important; }
.atv-body img { max-width: 100%; border-radius: var(--r-md); margin: 16px 0; }
.atv-body table {
    width: 100%; margin-bottom: 16px; font-size: 14px;
}
.atv-body .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.atv-body table td, .atv-body table th { padding: 10px 12px; vertical-align: top; }

/* ================================================================
   TAGS
   ================================================================ */
.atv-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 36px; padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}
.atv-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 14px; border-radius: 100px;
    font-size: 12px; font-weight: 600;
    background: var(--teal-50); color: var(--teal-700);
    border: 1px solid var(--teal-100); transition: var(--ease);
}
.atv-tag i { font-size: 9px; opacity: 0.5; }
.atv-tag:hover { background: var(--teal-100); }

/* ================================================================
   TOC CARD
   ================================================================ */
.atv-toc-card {
    border-radius: var(--r-lg); overflow: hidden;
    border: 1px solid var(--gray-200);
    background: var(--white); box-shadow: var(--sh-sm);
}
.atv-toc-header {
    background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
    color: #fff; padding: 12px 16px;
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; gap: 10px;
}
.atv-toc-dots { display: flex; gap: 5px; margin-right: 4px; }
.atv-toc-dots span { width: 10px; height: 10px; border-radius: 50%; display: block; }
.dot-1  { background: white; }
.dot-2  { background: var(--teal-200); }
.dot-3 { background: var(--teal-300); }

.atv-toc-search {
    padding: 10px 12px; position: relative;
    border-bottom: 1px solid var(--gray-100);
}
.atv-toc-search i {
    position: absolute; left: 22px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-300); font-size: 12px;
}
.atv-toc-search input {
    width: 100%; padding: 8px 12px 8px 32px;
    border: 1.5px solid var(--gray-200); border-radius: 10px;
    font-size: 12px; font-family: 'Poppins', sans-serif;
    background: var(--gray-50); color: var(--gray-900);
    outline: none; transition: var(--ease);
}
.atv-toc-search input:focus {
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(44,197,189,0.08);
}

.atv-toc-list {
    list-style: none; padding: 8px; margin: 0;
    max-height: 380px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--teal-300) transparent;
}
.atv-toc-list::-webkit-scrollbar { width: 5px; }
.atv-toc-list::-webkit-scrollbar-thumb { background: var(--teal-300); border-radius: 10px; }
.atv-toc-list::-webkit-scrollbar-track { background: transparent; }

.atv-toc-item {
    padding: 9px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
    color: var(--gray-700); cursor: pointer;
    transition: var(--ease); margin-bottom: 2px; line-height: 1.4;
}
.atv-toc-item:hover { background: var(--teal-50); color: var(--teal-700); }
.atv-toc-item.active {
    background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
    color: #fff; font-weight: 600;
    box-shadow: 0 2px 8px rgba(44,197,189,0.25);
}

/* ================================================================
   PROMO CARD
   ================================================================ */
.atv-promo-card {
    border-radius: var(--r-lg); overflow: hidden;
    border: 1px solid var(--gray-200);
    background: var(--white); box-shadow: var(--sh-sm);
}
.atv-promo-header {
    background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
    color: #fff; padding: 12px 16px;
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.atv-promo-body { padding: 16px; }
.atv-promo-visual {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 16px; padding: 16px;
    background: linear-gradient(135deg, var(--teal-50), var(--teal-100));
    border-radius: 14px;
}
.atv-promo-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: var(--white); border: 2px solid var(--teal-200);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--teal-600); flex-shrink: 0;
    transition: var(--ease);
}
.atv-promo-card:hover .atv-promo-icon {
    background: var(--teal-500); color: #fff; border-color: var(--teal-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44,197,189,0.3);
}
.atv-promo-title { font-size: 16px; font-weight: 800; color: var(--teal-800); }
.atv-promo-sub { font-size: 12px; color: var(--gray-500); }
.atv-promo-btn { width: 100%; text-align: center; display: block; }

/* ================================================================
   RELATED ARTICLES
   ================================================================ */
.atv-related { margin-top: 48px; }
.atv-related-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.atv-see-all {
    font-size: 14px; font-weight: 600;
    color: var(--teal-700); transition: var(--ease);
    display: flex; align-items: center;
}
.atv-see-all:hover { color: var(--teal-500); }
.atv-see-all i { transition: transform 0.25s; }
.atv-see-all:hover i { transform: translateX(4px); }
.atvRelatedSwiper { padding-bottom: 48px; }
.atvRelatedSwiper .swiper-pagination-bullet-active { background: var(--teal-500); }

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes atvFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.atv-anim { animation: atvFadeUp 0.5s ease forwards; opacity: 0; }

/* ================================================================
   COPY TOAST
   ================================================================ */
.atv-toast {
    position: fixed; bottom: 32px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
    color: #fff; padding: 12px 28px; border-radius: 14px;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 9999; opacity: 0;
    transition: all 0.35s cubic-bezier(.22,1,.36,1);
    pointer-events: none;
}
.atv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.atv-body iframe,
.atv-body video {
    max-width: 100%;
    height: auto;
}

/* Sticky breadcrumb — desktop */
@media (min-width: 992px) {
    .atv-breadcrumb-wrap {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #fff;
        border-bottom: 1px solid #f0f0f0;
        padding: 12px 0;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .atv-dark .atv-breadcrumb-wrap {
        background: #091f1e;
        border-color: #1a4240;
    }
}

/* ================================================================
   RESPONSIVE — Tablet
   ================================================================ */
@media (max-width: 991.98px) {
    .atv-layout { flex-direction: column; }
    .atv-sidebar {
        position: static; width: 100%;
        flex-direction: row; flex-wrap: wrap;
    }
    .atv-toc-card, .atv-promo-card { flex: 1; min-width: 280px; }
}

@media (max-width: 767.98px) {
    .atv-title { font-size: 24px; }
    .atv-hero { max-height: 300px; }
    .atv-related-header { flex-direction: column; align-items: flex-start; }
}

/* ================================================================
   RESPONSIVE — Mobile
   ================================================================ */
@media (max-width: 575.98px) {
    .atv-title { font-size: 22px; margin-bottom: 14px; }
    .atv-hero { max-height: 220px; }

    /* Meta bar stacks on mobile */
    .atv-meta-bar {
        flex-direction: column; align-items: stretch;
        padding: 12px 14px; gap: 12px;
    }
    .atv-toc-card.atv-anim{display:none;}
    .atv-meta-left { gap: 10px; }
    .atv-author-avatar { width: 36px; height: 36px; font-size: 13px; }
    .atv-author-name { font-size: 13px; }
    .atv-meta-right {
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid var(--gray-200);
    }
    #atv-container.atv-dark .atv-meta-right { border-top-color: #1a4240; }
    .atv-divider { display: none; }

    /* Body */
    .atv-body { font-size: 14px; }
    .atv-body h3 { font-size: 18px; margin-top: 28px; }
    .atv-body h4 { font-size: 15px; }
    .atv-body li { font-size: 14px; }

    /* Sidebar full width */
    .atv-sidebar { flex-direction: column; }
    .atv-toc-card, .atv-promo-card { min-width: 100%; }

    /* Share: icon only */
    .atv-share-btn span { display: none; }
    .atv-share-btn { padding: 8px 12px; gap: 0; }
    .atv-breadcrumb-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .atv-breadcrumb-wrap .atk-breadcrumb {
        white-space: nowrap;
        flex-wrap: nowrap;
    }
    .atv-share {
        justify-content: center;
        gap: 8px;
    }
    .atv-share-label { display: none; }
}