/*
====================================
SHARED SIDEBAR (toggleable on pages, news items, and category archives)
====================================
*/

/* ---------- Generic content + sidebar layout ---------- */

.nctf-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 40px;
    align-items: start;
    padding: 30px 20px;
}

.nctf-layout.no-sidebar,
.single-news-grid.no-sidebar {
    grid-template-columns: 1fr;
}

.nctf-sidebar {
    display: flex;
    flex-direction: column;
}

/* ---------- Card component ("hero-card" look) ----------
   One definition, reused everywhere a sidebar box appears:
   - the front-page hero side panel (.hero-side.sidebar-box)
   - every Content Sidebar box (Popular/Recent, Related News,
     Popular Categories, Popular Tags) rendered by sidebar-render.php
   - every widget dropped into the "Content Sidebar" widget area,
     since register_sidebar() wraps widgets in this same class
   Changing this one rule updates the look everywhere at once. */

.sidebar-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
    padding: 20px;
    margin-bottom: 24px;
}

.sidebar-box:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-family: var(--font-en-display);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--charcoal);
    text-transform: uppercase;
    letter-spacing: .02em;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title .front-section-accent {
    width: 6px;
    height: 24px;
    background: var(--amber);
    border-radius: 3px;
    flex-shrink: 0;
}

/* ---------- Shared list row (Popular/Recent tabs, Related News) ---------- */

.sidebar-empty {
    font-size: 13px;
    color: var(--muted);
}

.side-list-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.side-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.side-list-thumb {
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--border);
}

.side-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.side-list-body {
    flex: 1;
    min-width: 0;
}

.side-list-cat {
    display: block;
    margin-bottom: 3px;
    font-family: var(--font-en-body);
    font-size: 14px;
    font-weight: 600;
    line-height: 15px;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--teal);
}

.side-list-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 4px;
    font-family: var(--font-en-body);
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0;
    color: var(--charcoal);
}

/* ---------- Popular Categories ---------- */

.popular-categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.popular-categories-list li {
    border-bottom: 1px solid var(--border);
}

.popular-categories-list li:last-child {
    border-bottom: none;
}

.popular-categories-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 14px;
    color: var(--charcoal);
    font-family: var(--font-en-body);
}

.popular-categories-list a:hover {
    color: var(--teal);
}

.cat-count {
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ---------- Popular / Recent tabs box ---------- */

.sidebar-tabs-box {
    display: flex;
    flex-direction: column;
}

.sidebar-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-tab {
    background: none;
    border: 1px solid transparent;
    padding: 6px 18px;
    font-size: 14px;

    color: var(--muted);
    cursor: pointer;
    border-radius: 20px;
    transition: all .2s ease;
}

.sidebar-tab.active {
    background: var(--green);
    border-color: var(--green);
    color: var(--white);
}

.sidebar-tab:not(.active) {
    border-color: var(--border);
}

.sidebar-tab-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.sidebar-tab-panel.active {
    display: flex;
}

/* ---------- Shared list item meta row (time + views) ---------- */

.side-list-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.side-list-meta i {
    margin-right: 4px;
    font-size: 11px;
}

.side-list-time,
.side-list-views {
    display: inline-flex;
    align-items: center;
}

/* Hidden items revealed by "Load More" */
.side-list-item.is-hidden {
    display: none;
}

/* ---------- Load More button ---------- */

.sidebar-load-more {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 0;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-pill);
    font-family: var(--font-en-body);
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: all .2s ease;
}

.sidebar-load-more:hover {
    background: var(--white);
    border-color: var(--green);
    color: var(--green);
}

.sidebar-load-more.is-done {
    display: none;
}

/* ---------- Popular Tags (news_tag) ---------- */

.sidebar-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sidebar-tag-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.25s ease;

    --item-color: var(--tag-color, var(--muted));

    background-color: color-mix(in srgb, var(--item-color) 12%, var(--white));
    color: var(--item-color);
}

.sidebar-tag-pill:hover {
    background-color: color-mix(in srgb, var(--item-color) 22%, var(--white));
    transform: translateY(-1px);
}

/* ---------- Override Newsup's native "Sidebar Widget Area" (sidebar-1) ----------
   Parent theme wraps widgets there in .mg-widget / .mg-wid-title / .wtitle and
   paints the title bar with var(--pri-color) (see css/colors/default.css).
   Force it to match the .sidebar-box / .sidebar-title look used everywhere
   else, so a widget looks the same no matter which sidebar it's dropped into. */

.mg-sidebar .mg-widget {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
    padding: 20px;
    margin-bottom: 24px;
}

.mg-wid-title {
    border-width: 0;
    margin: 0 0 16px;
    padding: 0;
}

.mg-sidebar .mg-widget .wtitle,
.mg-sidebar .mg-widget h6 {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    color: var(--charcoal);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    line-height: normal;
    height: auto;
    padding: 0;
}

.mg-sidebar .mg-widget .wtitle::before {
    content: "";
    position: static;
    width: 6px;
    height: 24px;
    background: var(--amber);
    border: none;
    clip-path: none;
    border-radius: 3px;
    flex-shrink: 0;
    display: block;
}

/* ---------- Calendar widget (core WP Calendar widget, dropped into
   Content Sidebar). WP core ships #wp-calendar with no real styling
   ("default theme design" look) — this reskins it to match .sidebar-box. ---------- */

.sidebar-box #wp-calendar {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sidebar-box #wp-calendar caption {
    caption-side: top;
    text-align: center !important;
    font-size: 13px;
    font-weight: 700;
    color: var(--green);
    padding-bottom: 10px;
    padding-top: 0px !important;
}

.sidebar-box #wp-calendar th {
    background: var(--surface);
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    padding: 8px 4px;
    text-align: center;
}

.sidebar-box #wp-calendar td {
    text-align: center;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--charcoal);
}

.sidebar-box #wp-calendar td#today {
    background: var(--green);
    color: var(--white);
    border-radius: 6px;
    font-weight: 700;
}

.sidebar-box #wp-calendar td a {
    color: var(--teal);
    font-weight: 700;
}

.sidebar-box #wp-calendar td a:hover {
    color: var(--green);
}

.nctf-calendar-nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 10px;
}

.nctf-calendar-nav a {
    color: var(--teal);
    text-decoration: none;
    font-size: 13px;
    transition: .2s;
}

.nctf-calendar-nav a:hover {
    color: var(--green);
}

/* ---------- Search results header ---------- */

.archive-title span {
    color: var(--green);
}

/* ---------- Responsive ---------- */

@media (max-width: 991px) {
    .nctf-layout {
        grid-template-columns: 1fr;
        padding: 10px 0px;
    }
}
