/* ================= BẢNG TIN TRƯỜNG HỌC (BULLETIN BOARD) ================= */
#bb-modal { position: fixed; inset: 0; z-index: 55; display: none; align-items: center; justify-content: center; padding: 10px; background: rgba(13,20,66,0.62); }
#bb-modal.open { display: flex; }
#bb-modal, #bb-modal * { --hand: 'Patrick Hand', 'Caveat', 'Comic Sans MS', 'Segoe Print', cursive; }
.bb-frame {
    position: relative; width: min(1100px, 100%); max-height: 94dvh; display: flex; flex-direction: column; padding: 14px; border-radius: 10px;
    background: repeating-linear-gradient(90deg, #7a4a22 0 14px, #6b3f1b 14px 16px, #84522a 16px 30px);
    box-shadow: 0 10px 32px rgba(0,0,0,0.6), inset 0 0 0 3px #4e2f14, inset 0 0 14px rgba(0,0,0,0.5);
}
.bb-close {
    position: absolute; top: -12px; right: -12px; z-index: 5; width: 36px; height: 36px; border-radius: 50%;
    cursor: pointer; font: bold 18px Tahoma, sans-serif; color: #fff; background: #c62828; border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.bb-close:hover { background: #e53935; }
.bb-cork {
    flex: 1; min-height: 0; display: flex; gap: 14px; padding: 14px; height: min(670px, 86dvh); border-radius: 5px;
    box-shadow: inset 0 0 16px rgba(0,0,0,0.55); background-color: #c69a64;
    background-image:
        radial-gradient(rgba(90,55,20,0.35) 1.2px, transparent 1.6px),
        radial-gradient(rgba(255,230,180,0.28) 1.4px, transparent 1.8px),
        radial-gradient(rgba(70,40,10,0.25) 1px, transparent 1.4px);
    background-size: 11px 11px, 17px 17px, 7px 7px; background-position: 0 0, 5px 8px, 3px 2px;
}

/* Điều hướng 2 tab bên trái */
.bb-nav { flex: 0 0 168px; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.bb-tab {
    position: relative; padding: 12px 11px; font: 700 18.5px var(--hand); text-align: left; cursor: pointer;
    color: #4e2f14; background: #e8d3a8; border: 2px solid #6b3f1b; border-radius: 5px 0 0 5px;
    box-shadow: 2px 3px 5px rgba(0,0,0,0.35); transition: transform .12s, background .12s;
}
.bb-tab:hover { background: #f3e2bd; }
.bb-tab:focus-visible { outline: 3px solid #1a237e; outline-offset: 2px; }
.bb-tab[aria-selected="true"] { background: #fff8e1; color: #b71c1c; transform: translateX(9px); box-shadow: 3px 4px 8px rgba(0,0,0,0.5); border-color: #b71c1c; }
.bb-tab[aria-selected="true"]::before { content: "📌"; position: absolute; left: -12px; top: -8px; font-size: 17px; }
.bb-sync-pill {
    margin-top: auto; padding: 7px 9px; border-radius: 7px; text-align: center;
    background: rgba(255, 248, 225, 0.86); border: 1.5px solid #8a6235;
    color: #4e342e; font: 700 11.5px/1.35 Tahoma, sans-serif;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.bb-sync-pill.cloud { background: #e8f5e9; border-color: #2e7d32; color: #1b5e20; }
.bb-sync-pill.warn { background: #fff3e0; border-color: #ef6c00; color: #bf360c; }

.bb-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bb-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.bb-panel[hidden] { display: none; }

.bb-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bb-heading { margin: 0; font: 700 23px var(--hand); color: #3e240f; text-shadow: 1px 1px 0 rgba(255,235,200,0.65); }
.bb-post-total {
    padding: 3px 10px; border-radius: 12px; background: rgba(255,248,225,0.84); border: 1px solid #9c7442;
    font: 700 12px Tahoma, sans-serif; color: #5d3a1a;
}

/* ================= TAB 1: CONFESSIONS ================= */
.bb-toolbar {
    padding: 7px 9px; border-radius: 6px;
    background: rgba(255, 249, 234, 0.56); border: 1px solid rgba(107, 63, 27, 0.35);
}
.bb-search-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bb-tag-filters { display: inline-flex; gap: 6px; align-items: center; flex-shrink: 0; }
.bb-chip {
    padding: 5px 12px; border-radius: 14px; border: 1.5px solid #9e7648;
    background: #fff8e7; color: #4e342e; font: 700 12.5px Tahoma, sans-serif;
    cursor: pointer; transition: background .12s, color .12s;
}
.bb-chip:hover { background: #ffecc4; }
.bb-chip.active { background: #293d52; border-color: #1b2a3a; color: #fff9eb; }
.bb-chip.mine.active { background: #2e7d32; border-color: #1b5e20; color: #fff; }
#bb-search {
    flex: 1 1 180px; min-width: 0; padding: 6px 10px; border-radius: 6px;
    border: 1.5px solid #8c6239; background: #fffdf7; color: #2b2118;
    font: 13.5px Tahoma, sans-serif; -webkit-user-select: text; user-select: text;
}
#bb-sort {
    padding: 6px 8px; border-radius: 6px; border: 1.5px solid #8c6239;
    background: #fffdf7; color: #3e2723; font: 700 12.5px Tahoma, sans-serif; cursor: pointer;
}

.bb-feed {
    flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
    gap: 10px; padding: 3px 6px 4px 2px;
}
.bb-empty {
    margin: 22px auto; padding: 18px 20px; text-align: center; max-width: 420px;
    background: rgba(255,253,245,0.88); border: 1.5px dashed #9e7648; border-radius: 10px;
    color: #5d4037; font: 600 14px/1.5 Tahoma, sans-serif;
}
.bb-post {
    position: relative; padding: 12px 14px 10px; background: #fffdf7;
    border: 1.5px solid #b98f55; border-radius: 8px;
    box-shadow: 0 2px 6px rgba(60,35,10,0.28); color: #2b2118;
    font: 14.5px/1.5 'Tahoma', 'Segoe UI', sans-serif;
}
.bb-post-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; margin-bottom: 6px; padding-right: 28px; flex-wrap: wrap;
}
.bb-post-meta { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bb-post-author { font-weight: 700; color: #1a237e; }
.bb-post-author.bb-anon { font-style: italic; color: #6d6d6d; font-weight: 600; }
.bb-post-cls {
    font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 9px;
    background: #eef2f8; color: #3949ab;
}
.bb-post-time { font-size: 11.5px; color: #78695a; }
.bb-post-del {
    position: absolute; top: 7px; right: 8px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #8d6e63; font: bold 13px/24px Tahoma, sans-serif; text-align: center; cursor: pointer;
}
.bb-post-del:hover { background: #e53935; color: #fff; }
.bb-text { white-space: pre-wrap; word-break: break-word; }
.bb-text.collapsed { display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bb-text.expanded { display: block; }
.bb-more { margin-top: 5px; padding: 0; border: 0; background: none; color: #1565c0; font: bold 13px 'Tahoma', sans-serif; cursor: pointer; text-decoration: underline; }
.bb-more:hover { color: #0d47a1; }

/* Cảm xúc & Bình luận */
.bb-post-foot {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
    margin-top: 9px; padding-top: 8px; border-top: 1px dashed #e0cfb3;
}
.bb-reacts { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.bb-react-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 14px;
    border: 1px solid #d5be9c; background: #faf4e6; color: #4e342e;
    font: 700 12px Tahoma, sans-serif; cursor: pointer; transition: transform .1s, background .12s;
}
.bb-react-btn:hover { background: #f3e4c3; transform: translateY(-1px); }
.bb-react-btn.reacted { background: #ffe4ec; border-color: #d81b60; color: #ad1457; }
.bb-cmt-toggle {
    padding: 4px 10px; border-radius: 14px; border: 1px solid #b9a487; background: #f5efe2;
    color: #3e2723; font: 700 12px Tahoma, sans-serif; cursor: pointer;
}
.bb-cmt-toggle:hover, .bb-cmt-toggle.open { background: #293d52; border-color: #1c2c3c; color: #fff; }

.bb-comments {
    margin-top: 8px; padding: 9px 10px; border-radius: 7px;
    background: #f8f2e4; border: 1px solid #dfd0b4; display: flex; flex-direction: column; gap: 7px;
}
.bb-comments[hidden] { display: none; }
.bb-cmt-list { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; }
.bb-cmt-empty { font: italic 12.5px Tahoma, sans-serif; color: #7c6d58; }
.bb-cmt-item {
    position: relative; padding: 6px 26px 6px 9px; border-radius: 6px;
    background: #fffdf7; border: 1px solid #e4d5bc; font-size: 13px;
}
.bb-cmt-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.bb-cmt-author { font-weight: 700; color: #283593; font-size: 12.5px; }
.bb-cmt-author.bb-anon { font-style: italic; color: #757575; font-weight: 600; }
.bb-cmt-time { font-size: 11px; color: #8c7b6a; }
.bb-cmt-text { white-space: pre-wrap; word-break: break-word; color: #2b2118; }
.bb-cmt-del {
    position: absolute; top: 4px; right: 5px; width: 20px; height: 20px; border: 0; border-radius: 50%;
    background: transparent; color: #9e8570; font: 700 11px/20px Tahoma, sans-serif; cursor: pointer;
}
.bb-cmt-del:hover { background: #e53935; color: #fff; }
.bb-cmt-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bb-cmt-input {
    flex: 1 1 180px; min-width: 0; padding: 6px 9px; border-radius: 6px;
    border: 1.5px solid #b59268; background: #fffdf7; color: #2b2118;
    font: 13px Tahoma, sans-serif; -webkit-user-select: text; user-select: text;
}
.bb-cmt-anon { display: inline-flex; align-items: center; gap: 4px; font: 12px Tahoma, sans-serif; color: #5d4037; cursor: pointer; user-select: none; }
.bb-cmt-send {
    padding: 6px 12px; border-radius: 6px; border: 1.5px solid #1b5e20;
    background: #2e7d32; color: #fff; font: 700 12.5px Tahoma, sans-serif; cursor: pointer;
}
.bb-cmt-send:hover { background: #388e3c; }

/* Khung viết bài Confession */
.bb-form {
    display: flex; flex-direction: column; gap: 6px; padding: 9px 10px;
    background: rgba(255,250,238,0.62); border: 1px solid rgba(107,63,27,0.35); border-radius: 6px;
}
#bb-input {
    width: 100%; min-height: 70px; max-height: 170px; resize: vertical; padding: 8px 10px;
    font: 14px/1.45 'Tahoma', 'Segoe UI', sans-serif; color: #2b2118; background: #fffdf7;
    border: 1.8px solid #7d4e24; border-radius: 5px; -webkit-user-select: text; user-select: text;
}
.bb-form-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.bb-form-actions { display: flex; align-items: center; gap: 12px; }
.bb-anon-label { display: inline-flex; align-items: center; gap: 5px; font: 600 13px 'Tahoma', sans-serif; color: #4e2f14; cursor: pointer; user-select: none; }
.bb-anon-label input { width: 15px; height: 15px; cursor: pointer; }
#bb-count { font-size: 12px; color: #4e2f14; font-variant-numeric: tabular-nums; }
#bb-post {
    padding: 7px 16px; font: bold 14px 'Tahoma', sans-serif; cursor: pointer;
    color: #fff; background: #2e7d32; border: 2px solid #1b5e20; border-radius: 5px;
    box-shadow: 1px 2px 0 rgba(0,0,0,0.3);
}
#bb-post:hover { background: #388e3c; }
#bb-post:active { transform: translate(1px, 1px); }

/* ================= TAB 2: SỰ KIỆN SẮP TỚI GẦN NHẤT (LỊCH VIỆT NAM) ================= */
.bb-vn-clock {
    padding: 4px 11px; border-radius: 14px; background: #263954; color: #fff5d9;
    font: 700 12.5px Tahoma, sans-serif; font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 5px rgba(0,0,0,0.22);
}
.bb-event-stage {
    flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 14px 8px;
}
.bb-event-hero {
    position: relative; width: min(650px, 100%); padding: 28px 26px 24px; border-radius: 12px;
    background: #fffdf6; border: 2px solid #c9a16b; border-top: 10px solid #c62828;
    box-shadow: 0 8px 24px rgba(55, 25, 5, 0.36); color: #2b2118; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.bb-event-hero::before {
    content: ""; position: absolute; top: -18px; left: 50%; width: 42px; height: 18px; margin-left: -21px;
    border-radius: 4px; background: #b0bec5; border: 1.5px solid #607d8b; box-shadow: 0 3px 5px rgba(0,0,0,0.35);
}
.bb-event-hero.cat-school { border-top-color: #1565c0; }
.bb-event-hero.cat-trad { border-top-color: #d84315; }
.bb-event-hero.is-today { background: linear-gradient(180deg, #fffdf4, #fff3d1); border-color: #ef6c00; }

.bb-hero-badges { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bb-hero-kicker {
    padding: 4px 11px; border-radius: 14px; background: #c62828; color: #fff9e6;
    font: 700 12px Tahoma, sans-serif; letter-spacing: .3px;
}
.bb-event-hero.cat-school .bb-hero-kicker { background: #1565c0; }
.bb-event-hero.cat-trad .bb-hero-kicker { background: #d84315; }
.bb-hero-cat {
    padding: 4px 10px; border-radius: 14px; background: #f3e7cf; color: #5d3a1a;
    border: 1px solid #d5b98e; font: 700 12px Tahoma, sans-serif;
}
.bb-hero-ico { font-size: 46px; line-height: 1; margin-top: 2px; }
.bb-hero-title { margin: 0; font: 700 28px/1.25 Tahoma, sans-serif; color: #1a237e; }
.bb-hero-date { font: 700 15px Tahoma, sans-serif; color: #8c4a12; }
.bb-hero-lunar { font: 600 13.5px Tahoma, sans-serif; color: #6d5c49; margin-top: -6px; }

.bb-hero-timer {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
    margin: 4px 0 2px;
}
.bb-tbox {
    min-width: 78px; padding: 11px 10px; border-radius: 10px; text-align: center;
    background: linear-gradient(180deg, #273b54, #1c2c40); border: 2px solid #d9b56a;
    box-shadow: 0 4px 10px rgba(25, 35, 55, 0.28);
}
.bb-tbox b { display: block; font: 800 30px/1.05 Tahoma, sans-serif; color: #ffe082; font-variant-numeric: tabular-nums; }
.bb-tbox span { display: block; margin-top: 3px; font: 700 11.5px Tahoma, sans-serif; color: #e2e8f0; text-transform: uppercase; letter-spacing: .4px; }
.bb-hero-today {
    padding: 12px 22px; border-radius: 12px; background: linear-gradient(90deg, #c62828, #ef6c00); color: #fff8e1;
    font: 800 18px Tahoma, sans-serif; box-shadow: 0 4px 12px rgba(180,40,0,0.35);
}
.bb-hero-desc {
    margin: 2px 0 0; max-width: 520px; font: 14.5px/1.55 Tahoma, sans-serif; color: #4a3b2c;
}
.bb-hero-actions {
    margin-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.bb-ev-cheer {
    padding: 8px 18px; border-radius: 20px; border: 1.5px solid #c9a673;
    background: #faf2df; color: #5d3a1a; font: 700 13.5px Tahoma, sans-serif; cursor: pointer;
    transition: transform .1s, background .12s;
}
.bb-ev-cheer:hover { background: #ffebb8; transform: translateY(-1px); }
.bb-ev-cheer.cheered { background: #ffecb3; border-color: #ef6c00; color: #bf360c; }
.bb-hero-next {
    margin-top: 4px; padding-top: 10px; width: 100%; border-top: 1px dashed #dfcfb4;
    font: 600 12.5px Tahoma, sans-serif; color: #7a6855;
}

/* Hộp xác nhận xóa */
.bb-confirm { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(13,20,66,0.58); border-radius: 10px; }
.bb-confirm.open { display: flex; }
.bb-confirm-box { width: min(350px, 88%); padding: 18px; background: #fffdf7; border: 2px solid #6b3f1b; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.45); color: #2b2118; font: 14.5px/1.5 'Tahoma', sans-serif; text-align: center; }
.bb-confirm-actions { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.bb-confirm-actions button { padding: 8px 18px; font: bold 14px 'Tahoma', sans-serif; cursor: pointer; border-radius: 5px; border: 2px solid #6b3f1b; background: #efe3cf; color: #2b2118; }
.bb-confirm-actions #bb-confirm-ok { background: #c62828; border-color: #8e0000; color: #fff; }

@media (max-width: 720px) {
    .bb-cork { flex-direction: column; padding: 10px; gap: 9px; }
    .bb-nav { flex: none; flex-direction: row; flex-wrap: wrap; padding: 0; gap: 6px; align-items: center; }
    .bb-tab { flex: 1 1 120px; font-size: 16px; padding: 9px 6px; text-align: center; border-radius: 5px; }
    .bb-tab[aria-selected="true"] { transform: translateY(-2px); }
    .bb-tab[aria-selected="true"]::before { left: 50%; top: -11px; margin-left: -8px; font-size: 15px; }
    .bb-sync-pill { margin-top: 0; flex: 1 0 100%; padding: 4px 8px; font-size: 11px; }
    .bb-heading { font-size: 19px; }
    #bb-input { min-height: 58px; }
    .bb-event-hero { padding: 20px 14px 18px; }
    .bb-hero-title { font-size: 21px; }
    .bb-tbox { min-width: 62px; padding: 8px 6px; }
    .bb-tbox b { font-size: 23px; }
}
