/* --- CẤU HÌNH CHUNG --- */
:root {
    /* === CORE PALETTE: SYNCHRONIZED WITH SERIES === */
    --bg-surface: #FFFFFF;
    --bg-surface-2: #E5E7EB;
    /* Gray-200 */

    --text-primary: #111827;
    /* Gray-900 */
    --text-secondary: #4B5563;
    /* Gray-600 */
    --text-tertiary: #9CA3AF;
    /* Gray-400 */

    --color-brand-primary: #2563EB;
    /* Blue-600 */
    --color-brand-hover: #1D4ED8;
    /* Blue-700 */
    --color-brand-secondary: #DC2626;
    /* Red-600 */

    /* MAPPING for Compatibility */
    --primary-color: var(--text-primary);
    --text-color: var(--text-secondary);
    --text-light: var(--text-tertiary);
    --bg-color: var(--bg-body);
    --white: var(--bg-surface);
    --accent: var(--color-brand-primary);
    --red-brand: var(--color-brand-secondary);
    --radius: 16px;
    /* Slightly tighter radius like series */
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --green-btn: #059669;
    /* Green-600 */
    --purple-tag: #9333EA;
    /* Purple-600 */
    --purple-text: #FFFFFF;
    --gray-tag: #F3F4F6;
    --green-tag-bg: #10B981;
    /* Emerald-500 */
    --green-tag-text: #FFFFFF;
    --yellow-star: #FACC15;
    /* Yellow-400 */
}

[data-theme="dark"] {
    /* Gray-900 */
    --bg-surface: #252E36;
    /* Special Dark Surface from Series */
    --bg-surface-2: #374151;
    /* Gray-700 */

    --text-primary: #F9FAFB;
    /* Gray-50 */
    --text-secondary: #D1D5DB;
    /* Gray-300 */
    --text-tertiary: #9CA3AF;
    /* Gray-400 */

    --color-brand-primary: #3B82F6;
    /* Blue-500 */
    --color-brand-hover: #60A5FA;
    /* Blue-400 */
    --color-brand-secondary: #EF4444;
    /* Red-500 */

    /* Remap */
    --purple-tag: #9333EA;
    --purple-text: #FFFFFF;
    --green-tag-bg: #10B981;
    --green-tag-text: #FFFFFF;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body,
input,
select,
button {
    font-family: 'Montserrat', 'Segoe UI', Roboto, Arial, sans-serif;
}

/* --- HERO SECTION --- */
.hero-section {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 20px;
    margin-bottom: 50px;
    height: 520px;
    padding-top: 5.5rem;
}

/* Hero Left (Main) */
.hero-main {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    height: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.hero-main:hover .hero-bg {
    transform: scale(1.05);
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0.95) 100%);
    pointer-events: none;
}

.hero-top {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    display: flex;
    justify-content: space-between;
    z-index: 2;
    pointer-events: none;
}

.badge-red {
    background: var(--red-brand);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.badge-date {
    background: rgba(0, 0, 0, 0.6);
    color: #e5e5e5;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    backdrop-filter: blur(4px);
}

.hero-content {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 120px;
    max-width: 75%;
    z-index: 2;
}

.hero-title {
    text-align: left;
    font-size: 32px;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-desc {
    color: #f0f0f0;
    font-size: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    line-height: 1.5;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e5e7eb;
    font-size: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.hero-stats span {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.hero-stats .divider {
    color: rgba(255, 255, 255, 0.4);
    margin: 0 2px;
}

.stars {
    color: var(--yellow-star);
    font-size: 12px;
    display: flex;
    gap: 2px;
}

.hero-share {
    position: relative;
    z-index: 30;
    pointer-events: auto;

    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.3s;
}

.hero-share:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: none;
}

.hero-share svg {
    width: 24px;
    height: 24px;
}

/* Hero Right (Nav Mini Cards) */
.hero-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

/* Ensure Splide wrappers behave as flex column on Desktop so items stack */
@media (min-width: 769px) {

    .hero-nav.splide .splide__track,
    .hero-nav.splide .splide__list {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        height: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        /* Allow content to be seen if sizing is slightly off */
    }

    .hero-nav.splide .splide__slide {
        width: 100% !important;
        flex-shrink: 1 !important;
        flex-grow: 1 !important;
        margin: 0 !important;
    }
}

.nav-item {
    flex: 1;
    border-radius: var(--radius);
    position: relative;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.nav-item:hover {
    transform: translateY(-3px);
}

.nav-item.active {
    border-color: var(--white);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.nav-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.1) 30%, rgba(0, 0, 0, 0.1) 70%, rgba(0, 0, 0, 0.9) 100%);
    z-index: 1;
    pointer-events: none;
}

.nav-top {
    position: absolute;
    top: 12px;
    left: 15px;
    right: 15px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.mini-badge {
    background-color: var(--red-brand);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mini-date {
    font-size: 10px;
    font-weight: 600;
    background-color: rgb(0 0 0 / 0.5);
    color: rgb(255 255 255);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(4px);
}

.nav-content {
    position: absolute;
    bottom: 12px;
    left: 15px;
    right: 15px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

.nav-text-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
    pointer-events: none;
}

.nav-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #e5e7eb;
    font-weight: 500;
}

.nav-author {
    display: flex;
    align-items: center;
}

.nav-author i,
.nav-author svg,
.nav-view i,
.nav-view svg {
    font-size: 12px;
    /* Slightly larger to match text */
    margin-right: 4px;
}

.nav-dot {
    font-size: 8px;
    opacity: 0.6;
    margin-top: 1px;
}

.nav-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

/* --- CONTENT LAYOUT --- */
.content-wrapper {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 40px;
}

.post-card.research-layout {
    display: flex;
    gap: 25px;
    margin-bottom: 30px;
    padding: 25px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.3s;
    position: relative;
}

.post-card.research-layout:hover {
    box-shadow: var(--shadow);
}

.post-card.research-layout .post-img-box {
    flex: 0 0 32%;
    height: auto;
    min-height: 250px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.post-card.research-layout .post-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.post-tags-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    font-size: 12px;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
}

.tag-purple {
    background: var(--purple-tag);
    color: var(--purple-text);
}

.tag-gray {
    background: var(--gray-tag);
    color: var(--text-color);
}

.tag-green {
    background: var(--green-tag-bg);
    color: var(--green-tag-text);
}

.share-icon {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.3s all;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-icon:hover {
    color: var(--accent);
    background-color: rgba(0, 0, 0, 0.05);
}

.post-title.large {
    text-align: left;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.4;
    margin-bottom: 12px;
}

.post-excerpt {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    color: var(--primary-color);
    font-size: 14px;
}

.meta-item {
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .meta-item {
    color: #9ca3af;
}

.post-meta-row i {
    color: var(--text-light);
}

.post-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: #6b7280;
    font-size: 14px;
}

[data-theme="dark"] .post-stats-row {
    color: #9ca3af;
}

.post-stats-row span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.read-more-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: linear-gradient(145deg, #BADDF2, #F0F7FF);
    color: black;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 0;
    border-radius: 8px;
    text-decoration: none;
    transition: 0.3s;
    margin-top: auto;
}

.read-more-btn:hover {
    transform: translateY(-2px);
}

/* Sidebar */
.sidebar-widget {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.widget-head {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    color: #111827;
}

[data-theme="dark"] .widget-head {
    color: #f3f4f6;
}

.pop-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    transition: 0.3s;
    cursor: pointer;
}

.pop-item:hover {
    transform: translateX(5px);
}

.pop-item:last-child {
    margin-bottom: 0;
}

.pop-img {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    background-color: #eee;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.pop-text h4 {
    font-size: 14px;
    margin-top: 0.375rem;
    line-height: 1.4;
    color: var(--primary-color);
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
}

.pop-text span {
    font-size: 11px;
    color: #999;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .hero-section {
        grid-template-columns: 1fr;
        height: auto;
    }

    .hero-main {
        height: 450px;
        margin-bottom: 20px;
    }

    .hero-nav {
        display: block;
        /* Splide wrapper */
        height: auto;
        /* Space for dots */
        margin-bottom: 20px;
    }

    .splide__pagination {
        bottom: 0;
        /* Align to bottom padding edge */
        z-index: 10;
        padding-bottom: 5px;
    }

    .splide__pagination__page {
        background: #ccc;
        opacity: 1;
        width: 8px;
        height: 8px;
        margin: 0 4px;
        transition: 0.3s;
    }

    .splide__pagination__page.is-active {
        background: var(--color-brand-secondary);
        /* Red brand color or similar */
        transform: scale(1.2);
    }

    .nav-item {
        height: 150px;
        width: 100%;
        margin-right: 0;
        flex: 0 0 100%;
        /* Force full width for Splide slide */
        display: block;
        /* Ensure it behaves as a block */
    }

    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 24px;
        margin-bottom: 5px;
    }

    .hero-content {
        left: 20px;
        right: 80px;
        bottom: 20px;
        max-width: none;
    }

    .hero-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
    }

    .hero-desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        padding-right: 7px;
        overflow: hidden;
        font-size: 13px;
    }

    .post-card.research-layout {
        flex-direction: column;
        padding: 20px;
    }

    .post-card.research-layout .post-img-box {
        width: 100%;
        height: 200px;
        margin-bottom: 20px;
        min-height: auto;
    }

    .post-meta-row {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

.load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}


/* Radial Menu Positioning for Explore Cards (Research Layout) */

/* Wrapper now acts as a zero-size anchor at the top-right corner */
.post-card.research-layout {
    position: relative;
    overflow: hidden;
    /* Clip the radial menu to the card's rounded corners */
}

.post-card.research-layout .share-wrapper {
    position: relative;
    /* Reset potential flex */
}

/* The Menu Container - Centered on the Top-Right Corner */
/* MENU_SIZE is 260px in JS. Center is 130px. 
   We position top/right at -130px so the center (130,130) aligns with card corner (0,0). */
.post-card.research-layout .radial-share-menu {
    width: 280px;
    height: 280px;
    /* Center on the button (wrapper) */
    position: absolute;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.8);
    transform-origin: center center;
}

.post-card.research-layout .radial-share-menu.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Share Button - Positioned visually near the corner */
.post-card.research-layout .card-share-button {
    /* Distance from right edge */
    position: relative;
    z-index: 30;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Above the backdrop */
    background: transparent;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.post-card.research-layout .card-share-button:hover {
    color: #e09f7d;
}

/* The White Quarter-Circle Backdrop */
/* The White Quarter-Circle Backdrop */
.post-card.research-layout .radial-backdrop {
    background: radial-gradient(circle, #ffffff 0px, #ffffff 70px, #f3f4f6 71px, #f3f4f6 100%);
    /* Remove mask to show full ring suitable for rotation */
    mask-image: none;
    -webkit-mask-image: none;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 1;
}

/* Ensure White Ring persists in Dark Mode for high contrast (matches reference image on dark card) */
[data-theme="dark"] .post-card.research-layout .radial-backdrop {
    background: radial-gradient(circle, #252E36 0px, #252E36 70px, #f3f4f6 71px, #f3f4f6 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Icons */
/* Icons */
.post-card.research-layout .share-item {
    background-color: #ffffff;
    /* Dark Gray base */
    color: #4B5563;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Series transition */
    width: 40px;
    /* Series size */
    height: 40px;
    /* Series size */
    z-index: 25;
}

.post-card.research-layout .share-item:hover {
    background-color: #7986CB;
    color: white;
    transform: scale(1.15);
}

.post-card.research-layout .share-item svg {
    width: 20px;
    height: 20px;
}

[data-theme="dark"] .post-card.research-layout .share-item {
    background-color: #4B5563;
    /* Slightly lighter gray for dark mode visibility */
    color: #F9FAFB;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .post-card.research-layout .share-item:hover {
    background-color: #7986CB;
    color: white;
    transform: scale(1.15);
}

/* --- HERO SIDE SHARE CUSTOMIZATION --- */
.hero-side-share {
    position: relative;
    z-index: 20;
}

.hero-side-share .card-share-button {
    /* Ensure button ensures visibility over backdrop if needed, though backdrop is ring */
    position: relative;
    z-index: 30;
}

.hero-side-share .radial-share-menu {
    width: 250px;
    height: 250px;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.8);
    clip-path: none;
}

.hero-side-share .radial-share-menu.active {
    transform: translate(-50%, -50%) scale(1);
}

.hero-side-share .radial-backdrop {
    /* Thick donut style: transparent center (small hole), thick white ring */
    background: radial-gradient(circle, transparent 0px, transparent 22px, rgba(255, 255, 255, 0.98) 22.5px, rgba(255, 255, 255, 0.98) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    /* Mask: Reveal Top-Left quadrant (270 to 360 degrees) with wider padding */
    -webkit-mask-image: conic-gradient(from 0deg at 50% 50%, black 0deg, black 20deg, transparent 20deg, transparent 250deg, black 250deg, black 360deg);
    mask-image: conic-gradient(from 0deg at 50% 50%, black 0deg, black 20deg, transparent 20deg, transparent 250deg, black 250deg, black 360deg);
}

.hero-side-share .share-item {
    width: 36px;
    height: 36px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #4B5563;
}

.hero-side-share .share-item:hover {
    background: #7986CB;
    color: white;
}

.hero-side-share .share-item svg {
    width: 18px;
    height: 18px;
}