/* Khung bao ngoài */
.wct-toc-container {
    border: 1px solid #eee;
    background: #fff;
    margin-bottom: 25px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    /* Các thuộc tính chống lỗi cuộn đã được xử lý trong PHP inline-style */
}

/* Header chính */
.wct-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 5px 18px;
	margin-bottom: 0em;
    background: #fbfbfb;
    cursor: pointer;
    border: none;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    font-size: 15px;
    color: #444;
    text-align: left;
    font-family: inherit;
    transition: background 0.2s;
}

.wct-toc-header:hover, .wct-toc-header:focus {
    background: #f5f5f5;
    outline: none;
}

.wct-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wct-header-title svg {
    color: #777;
}

.wct-header-toggle svg {
    transition: transform 0.3s;
    transform: rotate(-90deg);
    color: #999;
}

/* Danh sách chính */
.wct-toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 18px !important;
}

/* --- CẤU TRÚC H2 (FLEX WRAP) --- */
.wct-item-h2 {
    display: flex;
    flex-wrap: wrap; /* Cho phép xuống dòng */
    align-items: center; /* Căn giữa dọc nút và chữ */
    margin-bottom: 10px;
}

.wct-item-h2 > a {
    text-decoration: none !important;
    color: #333;
    font-weight: 600;
    font-size: 15px;
    display: block;
    transition: color 0.2s;
    flex-grow: 1; 
    line-height: 1.5;
    min-width: 0; 
}
.wct-item-h2 > a:hover {
    color: #e65626;
    text-decoration: none !important;
}

/* --- NÚT TOGGLE TRÒN TUYỆT ĐỐI --- */
.wct-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Ép kích thước cố định */
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    
    cursor: pointer;
    background: transparent;
    color: #aaa;
    border: none;
    border-radius: 50%;
    margin-right: 10px;
    padding: 0;
    flex-shrink: 0; /* Chống méo */
    line-height: 1;
    transition: all 0.2s ease;
}

.wct-sub-toggle:hover, .wct-sub-toggle:focus {
    background: #f2f2f2;
    color: #555;
}
.wct-sub-toggle svg {
    width: 10px;
    height: 10px;
    transition: transform 0.2s;
    display: block;
}

/* Căn lề cho H2 không có nút */
.wct-item-h2:not(.has-sub) > a {
    margin-left: 32px;
}

/* --- DANH SÁCH CON (CHIẾM 100% ĐỂ XUỐNG DÒNG) --- */
.wct-sub-list {
    flex-basis: 100%; 
    width: 100%;      
    list-style: none !important;
    margin: 8px 0 8px 32px !important; 
    padding: 0 !important;
    border-left: 1px solid #eee;
}

.wct-item-h3 {
    margin-bottom: 6px;
    padding-left: 12px;
}

.wct-item-h3 a {
    text-decoration: none !important;
    color: #666;
    font-size: 14px;
    transition: color 0.2s;
    display: block;
    line-height: 1.4;
}
.wct-item-h3 a:hover {
    color: #e65626;
    padding-left: 3px;
}

/* Hỗ trợ scroll margin khi JS tắt hoặc lỗi */
h2[id], h3[id] {
    scroll-margin-top: 120px; 
}
html {
    scroll-behavior: smooth;
}