/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", sans-serif;
}

body {
    background: #f5f7fa;
    color: #1e293b;
    line-height: 1.7;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    padding: 24px;
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 24px;
}

/* ===== MAIN CONTENT ===== */
.content {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.content h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.content img {
    width: 100%;
    border-radius: 10px;
    margin: 20px 0;
    object-fit: cover;
}

.content p {
    margin-bottom: 16px;
    color: #475569;
    font-size: 1.3rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
    background: #ffffff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
    height: fit-content;
}

.sidebar h2 {
    font-size: 1.4rem;
    margin-bottom: 16px;
}

/* ===== RELATED LIST – DESKTOP ===== */
.sidebar .related-list {
    display: flex;
    flex-direction: column;
    gap: 12px;

    /* hiển thị đúng 5 item */
    max-height: calc(5 * 240px + 12px * 4);
    overflow-y: auto;
    padding-right: 6px;
}

/* scrollbar */
.sidebar .related-list::-webkit-scrollbar {
    width: 8px;
}

.sidebar .related-list::-webkit-scrollbar-thumb {
    background: rgba(15, 118, 110, 0.18);
    border-radius: 8px;
}

.sidebar .related-list::-webkit-scrollbar-track {
    background: transparent;
}

/* ===== RELATED ITEM ===== */
.sidebar .related-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 240px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.sidebar .related-item:hover {
    transform: translateY(-4px);
}

/* IMAGE */
.sidebar .related-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
}

/* TITLE */
.sidebar .related-item h4 {
    font-size: 1.15rem;

    .container .content p {
        font-size: 1.2rem;
    }

    .sidebar .related-item img {
        height: 220px;
    }

    .sidebar .related-item h4 {
        font-size: 1.5rem;
        text-align: center;
    }
}

/* ===== FIX HEADER CHO TRANG SINGLE ===== */
.page-single .header {
    background: #ffffff;
    box-shadow: 0 4px 30px rgba(0, 0, 0, .08);
}

.page-single .logo,
.page-single .nav-menu a,
.page-single .search-btn,
.page-single .search-box input::placeholder {
    color: var(--text-dark);

}

.page-single .search-box {
    border: 1px solid black;
    border-radius: 20px;
}

.page-single .mobile-search-trigger {
    color: var(--text-dark);
}

.page-single .menu-toggle span {
    background: var(--text-dark);
}

/* Chừa chỗ cho header fixed */
.page-single .page-content {
    padding-top: 100px;
}

.related-item h4 {
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;

    margin-top: 10px;
    line-height: 1.4;
    color: #0f766e;
    font-weight: 500;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* 👈 số dòng */
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 👈 có ... */
}

/* ===== PAGE SINGLE HEADER FIX ===== */
.page-single .header {
    background: #ffffff;
    box-shadow: 0 4px 30px rgba(0, 0, 0, .08);
}

.page-single .logo,
.page-single .nav-menu a,
.page-single .search-btn,
.page-single .search-box input::placeholder {
    color: var(--text-dark);
}

.page-single .search-box {
    border: 1px solid black;
    border-radius: 20px;
}

.page-single .mobile-search-trigger {
    color: var(--text-dark);
}

.page-single .menu-toggle span {
    background: var(--text-dark);
}

.page-single .page-content {
    padding-top: 100px;
}

/* ================================================= */
/* =================== MOBILE ====================== */
/* ================================================= */
@media (max-width: 768px) {

    .container {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .content h1 {
        font-size: 1.6rem;
    }

    .content p {
        font-size: 1.2rem;
    }

    /* SIDEBAR MOBILE – bỏ padding trái phải */
    .sidebar {
        padding: 16px 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        margin: auto;
        width: 100vw;
    }

    /* RELATED LIST – VUỐT NGANG */
    .sidebar .related-list {
        flex-direction: row;
        gap: 12px;

        max-height: none;
        padding: 0;
        max-width: 100%;

        overflow-x: auto;
        overflow-y: hidden;

        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar .related-list::-webkit-scrollbar {
        height: 8px;
    }

    /* CARD MOBILE */
    .sidebar .related-list .related-item {
        flex: 0 0 93%;
        min-width: 50px;
        height: auto;
        scroll-snap-align: start;
    }

    /* IMAGE MOBILE – THU NHỎ */
    .sidebar .related-list .related-item img {
        height: 150px;
        border-radius: 12px;
    }

    /* TITLE MOBILE */
    .sidebar .related-item h4 {
        font-size: 1.1rem;
        text-align: left;
    }

    /* Chừa chỗ cho header fixed */
    .page-single .page-content {
        padding-top: 100px;
    }

    .related-item h4 {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;

        margin-top: 10px;
        line-height: 1.4;
        height: 2.8em;
    }

    .page-content {
        max-width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }

    .content {
        width: 94vw;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .container {
        padding: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }

    .sidebar .related-item:last-of-type {
        padding-right: 25px;
    }

}

.content iframe, 
.content video, 
.content embed {
    width: 100% !important; 
    height: auto !important;
    aspect-ratio: 16 / 9;
    border-radius: 8px;  
    margin: 15px 0;      
}