/* Import Font Rasa từ Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Rasa:ital,wght@0,400;0,600;1,400;1,600&display=swap');

/* ==========================================
   1. ĐỊNH DẠNG BÀI THƠ (poem-table)
   ========================================== */
.poem-table {
    border-collapse: collapse;
    border: none !important;
    margin-top: 1rem;
    margin-bottom: 1rem;
    width: auto;
}

.poem-table td {
    padding: 3px 0 !important;
    border: none !important;
    line-height: 1.6;
}

/* Thụt lề responsive */
@media (max-width: 767px) {
    .poem-table { margin-left: 2.5rem !important; }
}
@media (min-width: 768px) and (max-width: 1023px) {
    .poem-table { margin-left: 6rem !important; }
}
@media (min-width: 1024px) {
    .poem-table { margin-left: 10rem !important; }
}

/* ==========================================
   2. PHÂN LOẠI LỜI NÓI (PHẬT / VUA / CHÚNG)
   ========================================== */
.quote-phat { color: #0044ff !important; }
.quote-vua  { color: #d97706 !important; }
.quote-chung{ color: #800080 !important; }

/* Bàn, Khối văn bản và P có border-left */
blockquote.quote-phat, table.quote-phat, p.quote-phat, div.quote-phat {
    border-left: 4px solid #0044ff !important;
    padding-left: 12px !important;
}
blockquote.quote-vua, table.quote-vua, p.quote-vua, div.quote-vua {
    border-left: 4px solid #d97706 !important;
    padding-left: 12px !important;
}
blockquote.quote-chung, table.quote-chung, p.quote-chung, div.quote-chung {
    border-left: 4px solid #800080 !important;
    padding-left: 12px !important;
}

/* Bỏ border-left cho UL và OL */
ul.quote-phat, ol.quote-phat,
ul.quote-vua, ol.quote-vua,
ul.quote-chung, ol.quote-chung {
    border-left: none !important;
    padding-left: 20px !important;
}

/* ==========================================
   3. BADGE BO TRÒN (2 ĐẦU 1/2 HÌNH TRÒN)
   ========================================== */


/* ==========================================
   PICO CSS TOOLTIP - KÉO MŨI TÊN LÒI RA KHỎI BONG BÓNG
   ========================================== */
[data-tooltip] {
    border-bottom: 1.5px dotted #5f55e8;
    color: #5f55e8;
    cursor: help;
    position: relative;
    display: inline-block;
}

/* 1. Đẩy cả 2 về lề trái, xóa bỏ căn giữa mặc định */
[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    left: 0 !important;
    transform: none !important;
}

/* 2. BONG BÓNG (::before): Nâng chiều cao lên một chút để chừa chỗ cho mũi tên bên dưới */
[data-tooltip]:hover::before {
    bottom: 100% !important;
    margin-bottom: 6px !important; /* Tạo khoảng trống 6px phía dưới cho mũi tên */
    white-space: normal !important;
    max-width: 260px !important;
    width: max-content !important;
    z-index: 9999 !important;
}

/* 3. MŨI TÊN (::after): Đặt chèn ngay mép dưới bong bóng, thụt vào 12px */
[data-tooltip]:hover::after {
    bottom: 100% !important;
    margin-bottom: 0px !important; /* Đặt nằm sát chân bong bóng */
    margin-left: 12px !important;  /* Neo theo góc trái */
    z-index: 10000 !important;     /* Đẩy z-index cao hơn bong bóng để không bị che */
}
/* ==========================================
   5. BLOCKQUOTE & CHỮ NGHIÊNG (FONT RASA)
   ========================================== */
blockquote {
    font-family: 'Rasa', serif !important;
    font-style: italic !important;
    font-size: 1.1rem;
    line-height: 1.6;
}

i, em {
    font-family: 'Rasa', serif;
    font-style: italic;
}

/* ==========================================
   1. TABS PICO (ĐÓNG KHUNG & HIỆN VIỀN RÕ RÀNG)
   ========================================== */
.htmb-tabs {
    display: flex;
    flex-direction: column;
    margin: 1.5rem 0;
}

.htmb-tabs input[type="radio"] {
    display: none;
}

.htmb-tab-header {
    display: flex;
    gap: 4px;
    margin-bottom: -1px;
    z-index: 2;
}

/* Nút Tab mặc định */
.htmb-tab-header label {
    padding: 8px 18px;
    margin: 0;
    cursor: pointer;
    border: 1px solid var(--pico-border-color, rgba(127, 127, 127, 0.3)) !important;
    border-bottom: none !important;
    border-radius: 6px 6px 0 0;
    font-weight: 500;
    color: var(--pico-color);
    opacity: 0.65;
    background: rgba(127, 127, 127, 0.08);
    transition: all 0.2s ease;
}

/* Tab được chọn: Ăn liền viền với khung dưới (Tự động nhận diện theo vị trí, không phụ thuộc tên ID) */
.htmb-tabs input[type="radio"]:nth-of-type(1):checked ~ .htmb-tab-header label:nth-child(1),
.htmb-tabs input[type="radio"]:nth-of-type(2):checked ~ .htmb-tab-header label:nth-child(2),
.htmb-tabs input[type="radio"]:nth-of-type(3):checked ~ .htmb-tab-header label:nth-child(3),
.htmb-tabs input[type="radio"]:nth-of-type(4):checked ~ .htmb-tab-header label:nth-child(4),
.htmb-tabs input[type="radio"]:nth-of-type(5):checked ~ .htmb-tab-header label:nth-child(5),
.htmb-tabs input[type="radio"]:nth-of-type(6):checked ~ .htmb-tab-header label:nth-child(6),
.htmb-tabs input[type="radio"]:nth-of-type(7):checked ~ .htmb-tab-header label:nth-child(7),
.htmb-tabs input[type="radio"]:nth-of-type(8):checked ~ .htmb-tab-header label:nth-child(8) {
    opacity: 1;
    background: var(--pico-card-background-color, var(--pico-background-color));
    color: var(--pico-color);
    border-color: var(--pico-border-color, rgba(127, 127, 127, 0.3)) !important;
    border-bottom: 1px solid var(--pico-card-background-color, var(--pico-background-color)) !important;
}

/* Khung bọc Nội dung Tab */
.htmb-tab-content {
    border: 1px solid var(--pico-border-color, rgba(127, 127, 127, 0.3)) !important;
    border-radius: 0 6px 6px 6px;
    padding: 16px;
    background: var(--pico-card-background-color, var(--pico-background-color));
    color: var(--pico-color);
    position: relative;
    z-index: 1;
}

.htmb-tab-content > div {
    display: none;
}

/* Hiển thị nội dung tương ứng theo vị trí */
.htmb-tabs input[type="radio"]:nth-of-type(1):checked ~ .htmb-tab-content > div:nth-child(1),
.htmb-tabs input[type="radio"]:nth-of-type(2):checked ~ .htmb-tab-content > div:nth-child(2),
.htmb-tabs input[type="radio"]:nth-of-type(3):checked ~ .htmb-tab-content > div:nth-child(3),
.htmb-tabs input[type="radio"]:nth-of-type(4):checked ~ .htmb-tab-content > div:nth-child(4),
.htmb-tabs input[type="radio"]:nth-of-type(5):checked ~ .htmb-tab-content > div:nth-child(5),
.htmb-tabs input[type="radio"]:nth-of-type(6):checked ~ .htmb-tab-content > div:nth-child(6),
.htmb-tabs input[type="radio"]:nth-of-type(7):checked ~ .htmb-tab-content > div:nth-child(7),
.htmb-tabs input[type="radio"]:nth-of-type(8):checked ~ .htmb-tab-content > div:nth-child(8) {
    display: block;
}
/* ==========================================
   2. ACCORDION (ĐỒNG BỘ TIÊU ĐỀ & KHUNG NỀN)
   ========================================== */
/* ==========================================
   2. ACCORDION (BỎ OUTLINE/VIỀN MÀU PHÁT SÁNG KHỦNG KHI CLICK)
   ========================================== */
.htmb-accordion {
    border: 1px solid var(--pico-border-color, rgba(127, 127, 127, 0.3)) !important;
    border-radius: 6px;
    overflow: hidden;
    margin: 1.5rem 0;
    background: var(--pico-card-background-color, var(--pico-background-color));
}

.htmb-accordion details {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--pico-border-color, rgba(127, 127, 127, 0.2)) !important;
}

.htmb-accordion details:last-child {
    border-bottom: none !important;
}

/* Tiêu đề Accordion */
.htmb-accordion summary {
    padding: 12px 16px !important;
    margin: 0 !important;
    font-weight: 600;
    color: var(--pico-color);
    background: rgba(127, 127, 127, 0.08) !important;
    cursor: pointer;
    transition: background 0.2s ease;
    
    /* XÓA VIỀN MÀU FOCUS KHI CLICK CHUỘT */
    outline: none !important;
    box-shadow: none !important;
}

.htmb-accordion summary:focus,
.htmb-accordion summary:focus-visible,
.htmb-accordion details[open] > summary:focus {
    outline: none !important;
    box-shadow: none !important;
}

.htmb-accordion summary:hover {
    background: rgba(127, 127, 127, 0.15) !important;
}

/* Nội dung bên trong mục Accordion */
.htmb-accordion details > p,
.htmb-accordion details > div {
    padding: 16px;
    margin: 0;
    color: var(--pico-color);
    background: var(--pico-card-background-color, var(--pico-background-color));
    border-top: 1px solid var(--pico-border-color, rgba(127, 127, 127, 0.2)) !important;
}