/**
 * Topz - Frontend Stylesheet
 * Clean, lightweight, responsive CSS (~8KB)
 */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 20px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
}

.site-brand .brand-logo {
    font-size: 24px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
}

.nav-link:hover {
    color: var(--primary);
}

.admin-pill {
    background: #eff6ff;
    color: var(--primary) !important;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #bfdbfe;
    font-weight: 600;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    padding: 5px 0;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    min-width: 220px;
    padding: 8px 0;
    z-index: 110;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    color: var(--text-main);
    font-size: 14px;
}

.nav-dropdown-menu a:hover {
    background: #f1f5f9;
}

.badge-count {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
}

.header-search .search-form {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2px 10px;
}

.header-search input {
    background: transparent;
    border: none;
    outline: none;
    padding: 6px 10px;
    font-size: 13px;
    width: 170px;
    transition: width 0.2s;
}

.header-search input:focus {
    width: 210px;
}

.header-search button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.mobile-header-actions {
    display: none;
    align-items: center;
    gap: 8px;
}

.mobile-search-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    padding: 7px 9px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    align-items: center;
    justify-content: center;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.mobile-search-toggle svg {
    display: block;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    align-items: center;
    justify-content: center;
}

/* Floating Mobile Search Bar (strictly hidden on desktop) */
.floating-search-bar,
.floating-search-backdrop {
    display: none !important;
}

@media (min-width: 861px) {
    .floating-search-bar,
    .floating-search-backdrop,
    .mobile-header-actions,
    .mobile-search-toggle,
    .menu-toggle {
        display: none !important;
    }
}

/* Hero Section */
.hero-section {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 60px 0 50px;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    background: #eff6ff;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid #dbeafe;
}

.hero-title {
    font-size: 38px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    max-width: 800px;
    margin: 0 auto 16px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 680px;
    margin: 0 auto 28px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
}

.btn-outline {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-main);
}

/* Category Pills */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
}

.category-pill {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.category-pill.active, .category-pill:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.category-pill.active .pill-count, .category-pill:hover .pill-count {
    background: rgba(255,255,255,0.25);
    color: #ffffff;
}

.pill-count {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.article-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.15s, box-shadow 0.15s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

/* Featured Image Thumbnail in Grid Cards */
.article-card-thumb {
    margin: -24px -24px 16px -24px;
    width: calc(100% + 48px);
    height: 195px;
    overflow: hidden;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    background: #f1f5f9;
    position: relative;
}

.article-card-thumb a.thumb-img-link {
    display: block;
    width: 100%;
    height: 100%;
}

.article-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-card:hover .article-card-thumb img {
    transform: scale(1.05);
}

/* Category badge on thumbnail top-left corner */
.thumb-badge-cat {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
}

.thumb-badge-cat a,
.thumb-badge-cat span {
    display: inline-block;
    background: #ffffff;
    color: var(--primary, #2563eb);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    line-height: 1.3;
}

.thumb-badge-cat a:hover {
    background: var(--primary, #2563eb);
    color: #ffffff;
}

/* Eye icon with page count on thumbnail top-right corner */
.thumb-badge-views {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    line-height: 1.3;
}

.thumb-badge-views svg {
    flex-shrink: 0;
}

/* Fallback placeholder when no thumbnail image exists */
.article-card-thumb.thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.thumb-placeholder-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.thumb-placeholder-icon {
    font-size: 38px;
    opacity: 0.35;
    transition: transform 0.25s ease;
}

.article-card:hover .thumb-placeholder-icon {
    transform: scale(1.1);
}

.article-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-category {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.read-time {
    font-size: 12px;
    color: var(--text-muted);
}

.article-card-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 12px;
}

.article-card-title a {
    color: #0f172a;
}

.article-card-title a:hover {
    color: var(--primary);
}

.article-card-excerpt {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0;
    flex-grow: 1;
}

.article-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    font-size: 13px;
}

.article-meta {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.read-more-link {
    font-weight: 600;
    font-size: 13px;
}

/* Article Single View */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    min-width: 0;
}

.article-main {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.bc-sep {
    color: #cbd5e1;
}

.bc-current {
    color: var(--text-main);
    font-weight: 500;
    max-width: 350px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.article-title {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 14px;
}

.article-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.meta-item.meta-views {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.btn-meta-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 12.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-meta-action:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.btn-meta-action:active {
    transform: scale(0.97);
}

.edit-pill {
    background: #eff6ff;
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12.5px;
    border: 1px solid #bfdbfe;
    text-decoration: none;
}

.edit-pill:hover {
    background: #dbeafe;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    line-height: 1.4;
}

a.tag-pill:hover,
.tag-pill:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* Article Body Typography */
.article-short-description {
    font-size: 18px;
    line-height: 1.75;
    color: #334155;
    margin-bottom: 28px;
    font-weight: 400;
}

.article-short-description p {
    font-size: 18px;
    line-height: 1.75;
    margin-bottom: 16px;
}

.article-tool-embed-section {
    margin: 32px 0;
    position: relative;
    clear: both;
}

.article-tool-embed-section .cms-tool-embed {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.article-long-description {
    margin-top: 28px;
}

.article-body {
    font-size: 17px;
    line-height: 1.8;
    color: #334155;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 36px 0 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.article-body h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 28px 0 14px;
}

.article-body ul, .article-body ol {
    margin-bottom: 20px;
    padding-left: 28px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body pre {
    background: #0f172a;
    color: #f8fafc;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 14px;
    margin-bottom: 20px;
    max-width: 100%;
    white-space: pre;
    word-break: normal;
    -webkit-overflow-scrolling: touch;
}

.article-body code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 85%;
    font-family: monospace;
    word-break: break-word;
}

.article-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    word-break: normal;
}

.article-body img,
.article-short-description img,
.article-tool-embed-section img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
    margin: 20px auto;
}

.article-body table,
.article-short-description table,
.article-tool-embed-section table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-body th, .article-body td,
.article-short-description th, .article-short-description td,
.article-tool-embed-section th, .article-tool-embed-section td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
    min-width: 80px;
}

.article-body th,
.article-short-description th,
.article-tool-embed-section th {
    background: #f8fafc;
    font-weight: 600;
}

.article-body iframe,
.article-short-description iframe,
.article-tool-embed-section iframe,
.article-body video,
.article-short-description video,
.article-tool-embed-section video {
    max-width: 100%;
    box-sizing: border-box;
}

.article-main,
.article-header,
.article-short-description,
.article-tool-embed-section,
.article-long-description,
.article-body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-body pre,
.article-short-description pre,
.article-tool-embed-section pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    font-style: italic;
}

/* Embedded Tool Card */
.cms-tool-embed {
    background: #f8fafc;
    border: 2px dashed #93c5fd;
    border-radius: var(--radius);
    padding: 24px;
    margin: 30px 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

/* Article Footer Box & Share */
.article-footer-box {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.share-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-main);
}

/* Sidebar */
.article-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-widget {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
}

.widget-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.widget-category-list {
    list-style: none;
}

.widget-category-list li {
    margin-bottom: 8px;
}

.widget-category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    font-size: 14px;
    padding: 4px 0;
}

.widget-category-list a:hover {
    color: var(--primary);
}

.widget-related-list {
    list-style: none;
}

.widget-related-list li {
    margin-bottom: 12px;
}

.related-title {
    font-size: 14px;
    font-weight: 600;
    display: block;
    line-height: 1.4;
    color: var(--text-main);
}

.promo-widget {
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.tool-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
}

.tool-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.tool-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.tool-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Alerts */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Footer */
.site-footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 40px;
    padding: 50px 20px 40px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 10px;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 380px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 14px;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* Utilities */
.my-5 { margin-top: 40px; margin-bottom: 40px; }
.mb-4 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }

/* Responsive */
@media (max-width: 860px) {
    .article-layout {
        grid-template-columns: 100%;
        gap: 28px;
    }
    .article-main {
        padding: 28px 24px;
        border-radius: 10px;
    }
    .article-title {
        font-size: 26px;
    }
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .header-search {
        display: none;
    }
    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .mobile-search-toggle {
        display: inline-flex;
    }
    .menu-toggle {
        display: inline-flex;
    }

    /* Floating Mobile Search Bar (Only shown on mobile <= 860px) */
    .floating-search-bar {
        display: block !important;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        width: 100%;
        background: #ffffff;
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color, #e2e8f0);
        box-shadow: 0 14px 28px -4px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.05);
        z-index: 125;
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .floating-search-bar.open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .floating-search-backdrop {
        display: block !important;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 120;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .floating-search-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    .floating-search-form {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .floating-search-input-wrap {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        background: #f1f5f9;
        border: 1.5px solid #cbd5e1;
        border-radius: 8px;
        padding: 0 10px;
        transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    }

    .floating-search-input-wrap:focus-within {
        border-color: var(--primary, #2563eb);
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    }

    .floating-search-icon {
        display: flex;
        align-items: center;
        color: #64748b;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .floating-search-input-wrap input {
        flex: 1;
        min-width: 0;
        background: transparent;
        border: none;
        outline: none;
        padding: 9px 0;
        font-size: 14px;
        color: #0f172a;
        width: 100%;
    }

    .floating-search-input-wrap input::placeholder {
        color: #94a3b8;
        font-size: 13.5px;
    }

    .floating-search-clear {
        background: none;
        border: none;
        color: #94a3b8;
        cursor: pointer;
        font-size: 13px;
        padding: 4px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .floating-search-clear:hover {
        color: #334155;
    }

    .floating-search-submit {
        background: var(--primary, #2563eb);
        color: #ffffff;
        border: none;
        padding: 9px 15px;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.15s;
        flex-shrink: 0;
    }

    .floating-search-submit:hover {
        background: var(--primary-hover, #1d4ed8);
    }

    .floating-search-close {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        color: #64748b;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 15px;
        flex-shrink: 0;
        transition: background 0.15s, color 0.15s;
    }

    .floating-search-close:hover {
        background: #e2e8f0;
        color: #0f172a;
    }
    .site-nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        flex-direction: column;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 24px rgba(0,0,0,0.12);
        z-index: 105;
    }
    .site-nav.open {
        display: flex;
    }
    .site-nav .nav-link,
    .site-nav .nav-dropdown {
        width: 100%;
        padding: 8px 0;
    }
    .site-nav .nav-dropdown-menu {
        position: static;
        width: 100%;
        margin-top: 6px;
        border-radius: 6px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 14px;
    }
    .my-5 {
        margin-top: 20px;
        margin-bottom: 24px;
    }
    .article-layout {
        gap: 20px;
    }
    .article-main {
        padding: 20px 16px;
        border-radius: 8px;
        box-shadow: none;
    }
    .article-header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    .article-title {
        font-size: 22px;
        line-height: 1.3;
        margin-bottom: 12px;
    }
    .article-meta-bar {
        gap: 8px;
        font-size: 12px;
        margin-bottom: 14px;
    }
    .meta-item.meta-views {
        font-size: 12px;
        padding: 3px 8px;
    }
    .btn-meta-action {
        font-size: 12px;
        padding: 4px 10px;
    }
    .article-tags {
        gap: 5px;
    }
    .tag-pill {
        font-size: 11px;
        padding: 2px 7px;
    }
    .breadcrumbs {
        font-size: 12px;
        margin-bottom: 14px;
        flex-wrap: wrap;
        row-gap: 4px;
    }
    .bc-current {
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
    }
    .article-short-description,
    .article-short-description p {
        font-size: 16px;
        line-height: 1.65;
        margin-bottom: 14px;
    }
    .article-body {
        font-size: 15px;
        line-height: 1.7;
    }
    .article-body h2 {
        font-size: 20px;
        margin: 26px 0 12px;
    }
    .article-body h3 {
        font-size: 17px;
        margin: 20px 0 10px;
    }
    .article-body ul, .article-body ol {
        padding-left: 20px;
        margin-bottom: 16px;
    }
    .article-body pre {
        padding: 12px;
        font-size: 13px;
        border-radius: 6px;
        margin-bottom: 16px;
    }
    .cms-tool-embed,
    .article-tool-embed-section .cms-tool-embed {
        padding: 16px 14px;
        margin: 20px 0;
        border-radius: 8px;
    }
    .sidebar-widget {
        padding: 18px 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    .article-main {
        padding: 16px 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .article-title {
        font-size: 20px;
        line-height: 1.35;
    }
    .article-meta-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }
    .article-meta-bar .meta-sep {
        display: none;
    }
    .meta-item.meta-views,
    .btn-meta-action {
        font-size: 11.5px;
        padding: 4px 9px;
    }
    .article-body {
        font-size: 14.5px;
        line-height: 1.65;
    }
    .article-body h2 {
        font-size: 18px;
    }
    .article-body h3 {
        font-size: 16px;
    }
    .cms-tool-embed,
    .article-tool-embed-section .cms-tool-embed {
        padding: 12px 10px;
        margin: 16px 0;
        max-width: 100%;
        overflow-x: auto;
    }
    .share-links {
        font-size: 13px;
        gap: 8px;
    }
    .share-links strong {
        width: 100%;
        display: block;
        margin-bottom: 2px;
    }
}

/* Very small screens & compact devices (360px and below) */
@media (max-width: 360px) {
    .container {
        padding: 0 8px;
    }
    .article-main {
        padding: 14px 10px;
    }
    .article-title {
        font-size: 18px;
        line-height: 1.3;
    }
    .btn-meta-action {
        font-size: 11px;
        padding: 3px 7px;
    }
    .article-body {
        font-size: 14px;
        line-height: 1.6;
    }
    .cms-tool-embed,
    .article-tool-embed-section .cms-tool-embed {
        padding: 10px 8px;
    }
}

/* ==========================================================================
   Home Page Dynamic Sections: List View & Left/Right Scrollable Reel
   ========================================================================== */

/* 1. Articles List View */
.articles-list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.article-list-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.article-list-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateX(3px);
}

.article-list-item.has-thumbnail {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.article-list-thumb {
    width: 200px;
    height: 130px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.article-list-thumb a {
    display: block;
    width: 100%;
    height: 100%;
}

.article-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.article-list-item:hover .article-list-thumb img {
    transform: scale(1.05);
}

.article-list-main-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 640px) {
    .article-list-item.has-thumbnail {
        flex-direction: column;
    }
    .article-list-thumb {
        width: 100%;
        height: 180px;
    }
}

.article-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.article-list-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
}

.article-list-title a {
    color: var(--text-main);
    text-decoration: none;
}

.article-list-title a:hover {
    color: var(--primary);
}

.article-list-excerpt {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.article-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    margin-top: 4px;
}

/* 2. Articles Left/Right Scrollable Carousel */
.scrollable-reel-wrapper {
    position: relative;
    margin: 0 -8px;
    padding: 0 8px;
}

.articles-scrollable-reel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding: 10px 4px 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.articles-scrollable-reel::-webkit-scrollbar {
    height: 6px;
}

.articles-scrollable-reel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

.articles-scrollable-reel .article-card {
    flex: 0 0 320px;
    max-width: 340px;
    scroll-snap-align: start;
}

.reel-nav-btn {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    z-index: 5;
    transition: all 0.15s ease;
}

.reel-nav-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.reel-nav-prev {
    left: -12px;
}

.reel-nav-next {
    right: -12px;
}

@media (max-width: 640px) {
    .articles-scrollable-reel .article-card {
        flex: 0 0 280px;
    }
    .reel-nav-btn {
        display: none;
    }
}

/* ==========================================
   Infinite Scroll & Dynamic Batch Loading
   ========================================== */
.infinite-scroll-container {
    margin: 40px auto 20px auto;
    text-align: center;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.infinite-scroll-sentinel {
    height: 24px;
    width: 100%;
    pointer-events: none;
    visibility: hidden;
}

.infinite-scroll-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.infinite-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: infiniteSpin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes infiniteSpin {
    to {
        transform: rotate(360deg);
    }
}

.infinite-scroll-end {
    margin: 20px auto;
}

.end-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.end-bubble .end-icon {
    color: #10b981;
    font-weight: 800;
}

/* Smooth card entry animation */
@keyframes cardFadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-card.newly-loaded {
    animation: cardFadeInUp 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-sep {
    color: #cbd5e1;
    font-size: 12px;
}

.breadcrumb-current {
    color: var(--text-main);
    font-weight: 600;
}


