/*
 Theme Name:   Astra Child
 Theme URI:    https://tienso.org
 Description:  Child theme của Astra – Giao diện Crypto cao cấp cho tienso.org
 Author:       TienSo
 Author URI:   https://tienso.org
 Template:     astra
 Version:      1.0.0
 Requires at least: 6.0
 Tested up to: 6.9.4
 License:      GNU General Public License v2 or later
 License URI:  https://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  astra-child
*/

/* ==========================================================================
   1. COLOR SCHEME – Light Mode, Xanh Lá Tiền Tệ
   ========================================================================== */

:root {
    /* Primary – Money Green */
    --color-primary:        #16a34a;
    --color-primary-dark:   #15803d;
    --color-primary-light:  #22c55e;
    --color-primary-bg:     #f0fdf4;

    /* Neutrals */
    --color-bg:             #ffffff;
    --color-surface:        #f8faf9;
    --color-border:         #e2e8f0;
    --color-border-light:   #f1f5f9;

    /* Text */
    --color-heading:        #0f172a;
    --color-text:           #334155;
    --color-text-muted:     #64748b;

    /* Accent */
    --color-accent:         #0d9488;
    --color-accent-gold:    #eab308;

    /* Shadows */
    --shadow-card:          0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-card-hover:    0 10px 25px rgba(22,163,74,.12), 0 4px 10px rgba(0,0,0,.06);

    /* Radius */
    --radius:               12px;
    --radius-sm:            8px;

    /* Transitions */
    --transition:           .25s cubic-bezier(.4,0,.2,1);
}

/* ---------- Global Overrides ---------- */

body {
    background-color: var(--color-bg) !important;
    color: var(--color-text);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.entry-title,
.entry-title a,
.ast-archive-title,
.page-title,
.site-title a {
    font-family: 'Montserrat', 'Open Sans', sans-serif !important;
    font-weight: 700;
    color: var(--color-heading);
    letter-spacing: -0.02em;
}

a {
    color: var(--color-primary);
    transition: color var(--transition);
}
a:hover {
    color: var(--color-primary-dark);
}

/* ==========================================================================
   2. HEADER & NAVIGATION
   ========================================================================== */

.ast-primary-header-bar,
.main-header-bar {
    background: var(--color-bg) !important;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.main-header-menu > .menu-item > a {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-heading) !important;
    transition: color var(--transition);
}
.main-header-menu > .menu-item > a:hover,
.main-header-menu > .menu-item.current-menu-item > a {
    color: var(--color-primary) !important;
}

/* ==========================================================================
   3. CRYPTO PRICE TICKER (Marquee)
   ========================================================================== */

.crypto-ticker-wrap {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    z-index: 100;
}

.crypto-ticker-inner {
    display: inline-flex;
    animation: ticker-scroll 20s linear infinite;
    padding: 8px 0;
}
.crypto-ticker-inner:hover {
    animation-play-state: paused;
}

.crypto-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 32px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.crypto-ticker-item img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.crypto-ticker-item .ticker-name {
    opacity: .85;
    font-weight: 500;
}

.crypto-ticker-item .ticker-price {
    font-weight: 700;
}

.crypto-ticker-item .ticker-change {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.crypto-ticker-item .ticker-change.up {
    background: rgba(255,255,255,.2);
    color: #bbf7d0;
}
.crypto-ticker-item .ticker-change.down {
    background: rgba(255,255,255,.2);
    color: #fca5a5;
}

.crypto-ticker-sep {
    color: rgba(255,255,255,.3);
    padding: 0 8px;
    font-size: 10px;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ==========================================================================
   4. ARCHIVE / CATEGORY – Grid 3 Cột + Card
   ========================================================================== */

/* Container */
.ast-archive-description {
    margin-bottom: 24px;
}
.ast-archive-description .ast-archive-title {
    font-size: 28px;
    border-left: 4px solid var(--color-primary);
    padding-left: 16px;
}

/* Grid layout */
.blog #primary .ast-row,
.archive #primary .ast-row,
.search #primary .ast-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* Card */
.blog #primary .ast-row > article,
.archive #primary .ast-row > article,
.search #primary .ast-row > article,
.blog #primary .ast-row > .ast-col-md-12,
.archive #primary .ast-row > .ast-col-md-12,
.search #primary .ast-row > .ast-col-md-12 {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ast-row > article,
.ast-row > .ast-col-md-12 > article {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.ast-row > article:hover,
.ast-row > .ast-col-md-12 > article:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* Featured image */
.ast-row article .post-thumb,
.ast-row article .ast-blog-featured-section {
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
    aspect-ratio: 16 / 9;
}
.ast-row article .post-thumb img,
.ast-row article .ast-blog-featured-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.ast-row article:hover .post-thumb img,
.ast-row article:hover .ast-blog-featured-section img {
    transform: scale(1.05);
}

/* Card body */
.ast-row article .entry-content,
.ast-row article .ast-blog-post-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ast-row article .entry-title {
    font-size: 17px;
    line-height: 1.4;
    margin-bottom: 8px;
}
.ast-row article .entry-title a {
    color: var(--color-heading);
    text-decoration: none;
}
.ast-row article .entry-title a:hover {
    color: var(--color-primary);
}

/* Meta */
.ast-row article .entry-meta,
.ast-row article .post-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.ast-row article .entry-meta a {
    color: var(--color-primary);
    font-weight: 600;
}

/* Category badge */
.ast-row article .cat-links a,
.ast-row article .entry-meta .cat-links a {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 4px;
    text-decoration: none;
}
.ast-row article .cat-links a:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Excerpt */
.ast-row article .entry-content p,
.ast-row article .ast-excerpt-container {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Read more */
.ast-row article .read-more,
.ast-row article .ast-read-more-container a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding-top: 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.ast-row article .read-more:hover,
.ast-row article .ast-read-more-container a:hover {
    color: var(--color-primary-dark);
    gap: 8px;
}

/* Responsive grid */
@media (max-width: 992px) {
    .ast-row,
    #primary .ast-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}
@media (max-width: 768px) {
    .ast-row,
    #primary .ast-row {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
}

/* ==========================================================================
   5. SINGLE POST – Full Width Typography
   ========================================================================== */

.single .entry-content {
    max-width: 100%;
}

.single .entry-header {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    padding: 40px 0 24px;
}

.single .entry-title {
    font-size: clamp(26px, 4vw, 36px);
    line-height: 1.25;
    color: var(--color-heading);
    margin-bottom: 16px;
}

.single .entry-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--color-text-muted);
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}
.single .entry-meta a {
    color: var(--color-primary);
    font-weight: 600;
}

/* Article body typography */
.single .entry-content {
    font-family: 'Open Sans', sans-serif;
    font-size: 17px;
    line-height: 1.8;
    color: var(--color-text);
}

.single .entry-content p {
    margin-bottom: 1.5em;
}

.single .entry-content h2 {
    font-size: 24px;
    margin: 2em 0 .8em;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary-bg);
}

.single .entry-content h3 {
    font-size: 20px;
    margin: 1.6em 0 .6em;
    color: var(--color-primary-dark);
}

.single .entry-content blockquote {
    border-left: 4px solid var(--color-primary);
    background: var(--color-primary-bg);
    margin: 1.5em 0;
    padding: 20px 24px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--color-heading);
}

.single .entry-content img {
    border-radius: var(--radius-sm);
    margin: 1em 0;
}

.single .entry-content a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(22,163,74,.3);
    transition: text-decoration-color var(--transition);
}
.single .entry-content a:hover {
    text-decoration-color: var(--color-primary);
}

/* Code blocks */
.single .entry-content pre,
.single .entry-content code {
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.single .entry-content pre {
    padding: 20px;
    overflow-x: auto;
    border: 1px solid var(--color-border);
}
.single .entry-content code {
    padding: 2px 6px;
}

/* ==========================================================================
   6. SIDEBAR & WIDGETS
   ========================================================================== */

.widget {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.widget-title,
.widget .wp-block-heading {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-heading);
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-primary);
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */

.ast-footer-overlay,
.site-footer,
footer.site-footer {
    background: var(--color-heading) !important;
    color: #cbd5e1;
}
.site-footer a {
    color: var(--color-primary-light) !important;
}
.site-footer a:hover {
    color: #fff !important;
}

/* ==========================================================================
   8. BUTTONS
   ========================================================================== */

.ast-custom-button,
.wp-block-button__link,
button,
input[type="submit"],
.ast-button {
    background: var(--color-primary) !important;
    color: #fff !important;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 28px;
    transition: background var(--transition), transform var(--transition);
    cursor: pointer;
}
.ast-custom-button:hover,
.wp-block-button__link:hover,
button:hover,
input[type="submit"]:hover,
.ast-button:hover {
    background: var(--color-primary-dark) !important;
    transform: translateY(-1px);
}

/* ==========================================================================
   9. PAGINATION
   ========================================================================== */

.ast-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
}
.ast-pagination .page-numbers {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transition: all var(--transition);
}
.ast-pagination .page-numbers.current,
.ast-pagination .page-numbers:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ==========================================================================
   10. UTILITY / MISC
   ========================================================================== */

::selection {
    background: rgba(22,163,74,.2);
    color: var(--color-heading);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-surface);
}
::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* ==========================================================================
   11. HOMEPAGE – front-page.php
   ========================================================================== */

/* Container */
.ts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Section */
.ts-section {
    padding: 60px 0;
}
.ts-section:nth-child(even) {
    background: var(--color-surface);
}

.ts-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.ts-section-title {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 24px;
    font-weight: 800;
    color: var(--color-heading);
    margin: 0;
}
.ts-view-all {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}
.ts-view-all:hover {
    color: var(--color-primary-dark);
}

/* ---------- MAGAZINE FEATURED GRID ---------- */
.ts-featured-news {
    background: var(--color-bg);
}
.ts-magazine-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.ts-mag-main {
    display: flex;
}
.ts-mag-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.ts-mag-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex: 1;
    background: #064e3b;
    min-height: 250px;
}
.ts-mag-large {
    min-height: 500px;
}
.ts-mag-card .ts-card-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;   
    margin: 0 !important;
    padding: 0 !important;
}
.ts-mag-card .ts-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    opacity: 0.85;
}
.ts-mag-card:hover .ts-card-thumb img {
    transform: scale(1.05);
    opacity: 1;
}
.ts-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    z-index: 1;
}
.ts-mag-content {
    position: relative;
    z-index: 2;
    padding: 32px;
    margin-top: auto; /* push to bottom */
    width: 100%;
}
.ts-mag-large .ts-mag-content {
    padding: 40px;
}
.ts-mag-small .ts-mag-content {
    padding: 24px;
}
.ts-mag-content .ts-card-cat {
    background: var(--color-primary);
    color: #fff;
    margin-bottom: 12px;
    border: none;
}
.ts-mag-content .ts-card-title {
    margin: 0 0 12px;
    line-height: 1.35;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 800;
}
.ts-mag-large .ts-card-title {
    font-size: 32px;
}
.ts-mag-small .ts-card-title {
    font-size: 20px;
}
.ts-mag-content .ts-card-title a {
    color: #fff !important;
    text-decoration: none;
}
.ts-mag-content .ts-card-title a:hover {
    color: #6ee7b7 !important;
}
.ts-mag-content .ts-card-meta {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
}

/* ---------- GRID ---------- */
.ts-grid {
    display: grid;
    gap: 24px;
}
.ts-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.ts-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* ---------- CARD ---------- */
.ts-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.ts-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* Card thumb */
.ts-card-thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}
.ts-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.ts-card:hover .ts-card-thumb img {
    transform: scale(1.05);
}
.ts-card-thumb-placeholder {
    background: linear-gradient(135deg, var(--color-primary-bg), #ecfdf5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.ts-card-thumb-placeholder span {
    font-size: 48px;
    opacity: .3;
}

/* Card body */
.ts-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.ts-card-cat {
    display: inline-block;
    width: fit-content;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 4px;
    text-decoration: none;
    margin-bottom: 10px;
    transition: all var(--transition);
}
.ts-card-cat:hover {
    background: var(--color-primary);
    color: #fff;
}
.ts-card-title {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px;
}
.ts-card-title a {
    color: var(--color-heading);
    text-decoration: none;
}
.ts-card-title a:hover {
    color: var(--color-primary);
}
.ts-card-excerpt {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin: 0 0 12px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ts-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}
.ts-card-readtime {
    margin-left: auto;
    color: var(--color-primary);
    font-weight: 600;
}

/* Horizontal card */
.ts-card-horizontal {
    flex-direction: row;
}
.ts-card-horizontal .ts-card-thumb {
    width: 200px;
    min-width: 200px;
    aspect-ratio: auto;
}
.ts-card-horizontal .ts-card-body {
    justify-content: center;
}

/* ---------- CATEGORY MEGA CARDS (Parent + Children) ---------- */
.ts-cat-mega-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}
.ts-cat-mega-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--cat-bg);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.ts-cat-mega-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-primary);
}
.ts-cat-mega-card:hover::before {
    opacity: 1;
}

.ts-cat-mega-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    position: relative;
}
.ts-cat-mega-header .ts-cat-icon {
    font-size: 36px;
    margin-bottom: 0;
    flex-shrink: 0;
}
.ts-cat-mega-title {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0;
    line-height: 1.3;
}
.ts-cat-mega-title a {
    color: inherit;
    text-decoration: none;
}
.ts-cat-mega-title a:hover {
    color: var(--color-primary);
}
.ts-cat-mega-count {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Sub-category list */
.ts-cat-sub-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    position: relative;
}
.ts-cat-sub-list li {
    border-top: 1px solid var(--color-border-light);
}
.ts-cat-sub-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    font-size: 14px;
    color: var(--color-text);
    text-decoration: none;
    transition: all var(--transition);
}
.ts-cat-sub-list li a:hover {
    color: var(--color-primary);
    padding-left: 10px;
}
.ts-cat-sub-count {
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}
.ts-cat-sub-list li a:hover .ts-cat-sub-count {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

/* View all link */
.ts-cat-mega-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    position: relative;
    transition: gap var(--transition);
}
.ts-cat-mega-link:hover {
    color: var(--color-primary-dark);
    gap: 8px;
}

/* ---------- CTA ---------- */
.ts-cta {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    padding: 60px 0;
}
.ts-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}
.ts-cta-title {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 26px;
    font-weight: 800;
    color: #fff !important;
    margin: 0 0 8px;
}
.ts-cta-desc {
    font-size: 15px;
    color: rgba(255,255,255,.8);
    margin: 0;
    max-width: 480px;
}

/* No posts */
.ts-no-posts {
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px;
    font-size: 16px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
    .ts-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .ts-magazine-grid {
        grid-template-columns: 1fr;
    }
    .ts-mag-large {
        min-height: 400px;
    }
    .ts-mag-side {
        flex-direction: row;
    }
    .ts-cta-inner {
        flex-direction: column;
        text-align: center;
    }
}
@media (max-width: 768px) {
    .ts-mag-side {
        flex-direction: column;
    }
}
@media (max-width: 600px) {
    .ts-grid-3,
    .ts-grid-2 {
        grid-template-columns: 1fr;
    }
    .ts-card-horizontal {
        flex-direction: column;
    }
    .ts-card-horizontal .ts-card-thumb {
        width: 100%;
        aspect-ratio: 16 / 9;
    }
    .ts-mag-large {
        min-height: 300px;
    }
    .ts-mag-small {
        min-height: 200px;
    }
    .ts-section {
        padding: 40px 0;
    }
}

/* ==========================================================================
   12. SINGLE POST - CUSTOM LAYOUT & SIDEBAR
   ========================================================================== */

/* Sticky Sidebar */
@media (min-width: 993px) {
    .ts-sticky-sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 30px;
        transition: top 0.3s ease;
    }
}

/* Bài viết liên quan (Sidebar) */
.ts-widget-related {
    padding: 24px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.ts-widget-related .widget-title {
    font-size: 16px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
    color: var(--color-heading);
    text-transform: uppercase;
    font-weight: 800;
}

.ts-related-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ts-related-sidebar-item {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ts-rel-side-thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.ts-rel-side-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ts-related-sidebar-item:hover .ts-rel-side-thumb img {
    transform: scale(1.1);
}

.ts-rel-side-title {
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 4px;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700;
}

.ts-rel-side-title a {
    color: var(--color-heading);
    text-decoration: none;
}

.ts-rel-side-title a:hover {
    color: var(--color-primary);
}

.ts-rel-side-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Bài viết có thể quan tâm (Dưới nội dung) */
.ts-suggested-posts-wrapper {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--color-border);
    clear: both;
}

.ts-suggested-posts-wrapper .ts-section-heading {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--color-heading);
    border-left: 4px solid var(--color-primary);
    padding-left: 12px;
}

.ts-suggested-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ts-suggested-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ts-suggested-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.ts-sug-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.ts-sug-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.ts-suggested-card:hover .ts-sug-thumb img {
    transform: scale(1.05);
}

.ts-sug-body {
    padding: 16px;
}

.ts-sug-title {
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700;
}

.ts-sug-title a {
    color: var(--color-heading);
    text-decoration: none;
}

.ts-sug-title a:hover {
    color: var(--color-primary);
}

@media (max-width: 992px) {
    .ts-suggested-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .ts-suggested-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   13. FIX SINGLE POST SIDEBAR WIDTH (BỘ CỤC CHUẨN RỘNG)
   ========================================================================== */
@media (min-width: 993px) {
    /* Đảm bảo toàn bộ khung bài viết không bị bóp nhỏ bởi thiết lập Narrow của Astra */
    body.single .site-content > .ast-container {
        max-width: 1240px !important;
        width: 100% !important;
        padding-left: 20px;
        padding-right: 20px;
    }
    /* Đảm bảo Primary và Secondary chia cột chính xác */
    .single #primary {
        width: 68% !important;
        float: left;
    }
    .single #secondary {
        width: 30% !important;
        float: right;
        margin-left: 2%;
        padding-left: 0 !important;
    }
    /* Xoá clear float của Astra (nếu có) */
    .single .ast-row::after {
        content: "";
        display: table;
        clear: both;
    }
    .single .ast-row {
        display: block !important;
    }
}
@media (max-width: 992px) {
    .single #primary, 
    .single #secondary {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
    }
}

/* ==========================================================================
   14. BẢNG MỤC LỤC TỰ ĐỘNG (TABLE OF CONTENTS)
   ========================================================================== */
.ts-toc-wrapper {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    margin: 32px 0 40px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    /* Float TOC to the right if we want, but usually full block is better for long post */
    display: block;
    clear: both;
}

/* Dark mode support if applicable */
.dark-mode .ts-toc-wrapper {
    background: #1e293b;
    border-color: #334155;
}

.ts-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.ts-toc-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-heading);
    text-transform: uppercase;
}

.ts-toc-toggle {
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
}

.ts-toc-toggle:hover {
    color: var(--color-primary);
}

.ts-toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: max-height 0.3s ease-in-out;
}

.ts-toc-list.ts-collapsed {
    display: none !important;
}

.ts-toc-item {
    margin-bottom: 8px !important;
    line-height: 1.5;
}

.ts-toc-item a {
    color: var(--color-heading);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    display: block;
    padding: 4px 0;
    border-bottom: 1px dashed transparent;
}

.ts-toc-item a:hover {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Phân cấp Heading 3 */
.ts-toc-item.ts-toc-sub {
    padding-left: 20px;
    font-size: 0.95em;
    font-weight: 400;
}
.ts-toc-item.ts-toc-sub a {
    color: var(--color-text);
    font-weight: 400;
}
.ts-toc-item.ts-toc-sub a:hover {
    color: var(--color-primary);
}
