/* ============================================================
   Julyem - SIDEBAR PHẢI khu vực Blog
   Dùng chung cho trang Blog/Lưu trữ (.blog-archive) và
   trang chi tiết bài viết (.blog-single).
   Gồm: Tìm kiếm - Chủ đề (dropdown) - Bài viết mới nhất.
   ============================================================ */

/* ============================================================
   BỐ CỤC 2 CỘT (nội dung + sidebar)
   ============================================================ */
.jl-blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 40px;
    align-items: start;
}

/* Khung bọc nội dung trang chi tiết bài viết */
.jl-single-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   KHUNG SIDEBAR
   ============================================================ */
.jl-side {
    --jl-primary: #003462;
    --jl-heading: #0B3F66;
    --jl-gold:    #CFA56A;
    --jl-text:    #333333;
    --jl-muted:   #7A8A99;
    --jl-line:    rgba(11, 63, 102, .1);
    --jl-paper:   #faf8f4;

    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.jl-side-box {
    padding: 22px;
    background: #fff;
    border: 1px solid var(--jl-line);
    border-radius: 16px;
    box-shadow: 0 10px 26px -18px rgba(0, 52, 98, .4);
}

/* Tiêu đề khối */
.jl-side-title {
    position: relative;
    margin: 0 0 18px;
    padding-bottom: 12px;
    color: var(--jl-heading);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1.6px;
    line-height: 1.3;
    text-transform: uppercase;
}
.jl-side-title::before,
.jl-side-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1px;
    background: var(--jl-line);
}
.jl-side-title::before { width: 100%; }
.jl-side-title::after {
    width: 46px;
    height: 2px;
    border-radius: 2px;
    background: var(--jl-gold);
}

/* ============================================================
   1) TÌM KIẾM
   ============================================================ */
.jl-side .jl-side-search {
    position: relative;
    margin: 0;
    display: block;
}

.jl-side .jl-side-search-input {
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 50px 0 16px;
    background: var(--jl-paper);
    border: 1px solid var(--jl-line);
    border-radius: 10px;
    box-shadow: none;
    color: var(--jl-text);
    font-size: 14.5px;
    line-height: 46px;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.jl-side .jl-side-search-input::placeholder { color: var(--jl-muted); }
.jl-side .jl-side-search-input:focus {
    outline: 0;
    background: #fff;
    border-color: rgba(207, 165, 106, .75);
    box-shadow: 0 0 0 3px rgba(207, 165, 106, .16);
}
.jl-side .jl-side-search-input::-webkit-search-cancel-button { display: none; }

.jl-side .jl-side-search-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    min-height: 0;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--jl-primary);
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    color: #fff;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}
.jl-side .jl-side-search-btn:hover {
    background: var(--jl-gold);
    color: #022744;
    transform: none;
}

/* ============================================================
   2) CHỦ ĐỀ - dropdown
   ============================================================ */
.jl-side-dd { position: relative; }

.jl-side-dd-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    background: var(--jl-paper);
    border: 1px solid var(--jl-line);
    border-radius: 10px;
    color: var(--jl-heading);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.jl-side-dd-toggle::-webkit-details-marker { display: none; }
.jl-side-dd-toggle::marker { content: ""; }
.jl-side-dd-toggle:hover { border-color: rgba(207, 165, 106, .55); }
.jl-side-dd[open] .jl-side-dd-toggle {
    background: #fff;
    border-color: rgba(207, 165, 106, .75);
}

.jl-side-dd-current {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jl-side-dd-arrow {
    flex: 0 0 auto;
    color: var(--jl-gold);
    transition: transform .25s ease;
}
.jl-side-dd[open] .jl-side-dd-arrow { transform: rotate(180deg); }

/* Danh sách chuyên mục */
.jl-side-dd-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--jl-line);
    border-radius: 12px;
    box-shadow: 0 18px 40px -18px rgba(0, 52, 98, .5);
    animation: jl-dd-in .18s ease;
}
.jl-side-dd-list li { margin: 0; padding: 0; list-style: none; }

@keyframes jl-dd-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.jl-side-dd-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--jl-text);
    font-size: 14.5px;
    line-height: 1.4;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
}
.jl-side-dd-link:hover {
    background: var(--jl-paper);
    color: var(--jl-primary);
}
.jl-side-dd-link.is-active {
    background: rgba(207, 165, 106, .15);
    color: var(--jl-primary);
    font-weight: 700;
}

.jl-side-dd-count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    background: rgba(0, 52, 98, .06);
    border-radius: 999px;
    color: var(--jl-muted);
    font-size: 12px;
    font-weight: 600;
}

/* ============================================================
   3) BÀI VIẾT MỚI NHẤT
   ============================================================ */
.jl-side-posts {
    margin: 0;
    padding: 0;
    list-style: none;
}

.jl-side-post {
    display: flex;
    gap: 13px;
    margin: 0;
    padding: 15px 0;
    list-style: none;
    border-top: 1px solid var(--jl-line);
}
.jl-side-post:first-child { padding-top: 0; border-top: 0; }
.jl-side-post:last-child { padding-bottom: 0; }

.jl-side-post-thumb {
    flex: 0 0 74px;
    width: 74px;
    height: 74px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--jl-paper);
}
.jl-side-post-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.jl-side-post:hover .jl-side-post-thumb img { transform: scale(1.08); }
.jl-side-post-ph {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0e4a78, var(--jl-gold));
}

.jl-side-post-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.jl-side-post-title {
    margin: 0 0 7px;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.45;
}
.jl-side-post-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--jl-heading);
    text-decoration: none;
    transition: color .2s ease;
}
.jl-side-post-title a:hover { color: var(--jl-gold); }

.jl-side-post-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--jl-muted);
    font-size: 12.5px;
    letter-spacing: .3px;
}
.jl-side-post-date svg { flex: 0 0 auto; color: var(--jl-gold); }

/* ============================================================
   RESPONSIVE - sidebar xuống dưới nội dung
   ============================================================ */
@media (max-width: 1024px) {
    .jl-blog-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .jl-side {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
        align-items: start;
    }
    .jl-side-box:last-child { grid-column: 1 / -1; }
}

@media (max-width: 649px) {
    .jl-side {
        display: flex;
        flex-direction: column;
        /* reset align-items: start của breakpoint trên, nếu không các khối
           sẽ co lại theo nội dung thay vì full chiều ngang */
        align-items: stretch;
    }
    .jl-side-box { padding: 20px 18px; }
    .jl-single-wrap { padding: 0 16px; }
}
