/* ================= PHÒNG TRƯNG BÀY: BẢNG VÀNG HSG QUỐC GIA & QUYỂN ALBUM LẬT TRANG ================= */

/* ---------- 1. BẢNG VÀNG HỌC SINH GIỎI QUỐC GIA ---------- */
#honor-modal, #album-modal {
    position: fixed; inset: 0; z-index: 63; display: none;
    align-items: center; justify-content: center; padding: 10px;
    background: rgba(14, 24, 28, 0.74); backdrop-filter: blur(2px);
    font-family: Tahoma, 'Segoe UI', sans-serif;
}
#honor-modal.open, #album-modal.open { display: flex; }

.hn-frame {
    width: min(940px, 97vw); max-height: 90dvh; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 12px; border: 4px solid #9c7944; background: #1e4243;
    box-shadow: 0 16px 44px rgba(0,0,0,0.6), inset 0 0 0 2px #d8b56c;
    color: #fff8e3;
}
.hn-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 16px; background: linear-gradient(90deg, #163334, #245050, #163334);
    border-bottom: 2.5px solid #d8b56c;
}
.hn-head-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hn-head h2 { margin: 0; font: 800 20px Tahoma, sans-serif; color: #f6d57f; letter-spacing: .4px; text-shadow: 0 2px 4px rgba(0,0,0,0.45); }
.hn-sync-pill, .alb-sync-pill {
    padding: 3px 9px; border-radius: 12px; font: 700 11.5px Tahoma, sans-serif;
    background: rgba(255, 248, 225, 0.9); color: #4e342e;
}
.hn-sync-pill.cloud, .alb-sync-pill.cloud { background: #e8f5e9; color: #1b5e20; }
.hn-close, .alb-close {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; border: 2px solid #fff;
    background: #b73b36; color: #fff; font: 700 16px Tahoma, sans-serif; cursor: pointer;
}
.hn-close:hover, .alb-close:hover { background: #d32f2f; }

.hn-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 14px; background: rgba(15, 34, 35, 0.65); border-bottom: 1px solid rgba(216, 181, 108, 0.35);
}
#hn-search, #hn-filter-cohort, #hn-filter-class {
    padding: 7px 10px; border-radius: 7px; border: 1.5px solid #bfa062;
    background: #fffdf5; color: #243938; font: 600 13px Tahoma, sans-serif;
    -webkit-user-select: text; user-select: text;
}
#hn-search { flex: 1 1 200px; min-width: 0; }
.hn-add-btn {
    padding: 7px 14px; border-radius: 7px; border: 1.5px solid #ffe082;
    background: #c8962e; color: #1d1507; font: 800 13px Tahoma, sans-serif; cursor: pointer;
}
.hn-add-btn:hover { background: #e0ad3e; }

.hn-form {
    padding: 12px 14px; background: #fbf4df; color: #2a3936;
    border-bottom: 2px solid #c9a662; display: flex; flex-direction: column; gap: 9px;
}
.hn-form[hidden] { display: none; }
.hn-form-grid { display: grid; grid-template-columns: 1.4fr 0.85fr 0.95fr; gap: 8px 10px; }
.hn-form-grid label { display: flex; flex-direction: column; gap: 3px; font: 700 12px Tahoma, sans-serif; color: #54412b; }
.hn-form-grid .hn-span-wide { grid-column: 1 / -1; }
.hn-form-grid input, .hn-form-grid select, .hn-form-grid textarea {
    padding: 7px 10px; border-radius: 7px; border: 1.5px solid #b99b68;
    background: #fffdf9; color: #20312f; font: 13.5px/1.45 Tahoma, sans-serif;
    -webkit-user-select: text; user-select: text;
}
.hn-form-grid textarea { resize: vertical; }
.hn-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.hn-form-err { margin-right: auto; font: 700 12px Tahoma, sans-serif; color: #b71c1c; }
.hn-cancel-btn {
    padding: 7px 13px; border-radius: 7px; border: 1.5px solid #9f8760;
    background: #efe3c7; color: #4a3723; font: 700 12.5px Tahoma, sans-serif; cursor: pointer;
}
.hn-submit-btn {
    padding: 7px 15px; border-radius: 7px; border: 1.5px solid #163b3a;
    background: #225452; color: #ffe7a1; font: 700 13px Tahoma, sans-serif; cursor: pointer;
}
.hn-submit-btn:hover { background: #2c6a67; }

.hn-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px 14px; }
.hn-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.hn-table thead th {
    position: sticky; top: 0; z-index: 2; padding: 9px 10px; text-align: left;
    background: #142f30; color: #f6d57f; border-bottom: 2px solid #d8b56c;
    font: 700 13px Tahoma, sans-serif; white-space: nowrap;
}
.hn-table tbody tr { border-bottom: 1px dashed rgba(246, 213, 127, 0.25); transition: background .1s; }
.hn-table tbody tr:hover { background: rgba(255, 244, 206, 0.08); }
.hn-table td { padding: 9px 10px; vertical-align: middle; color: #fff8e6; }
.hn-table .col-stt { width: 42px; text-align: center; color: #e2c57d; font-weight: 700; }
.hn-table .col-name { font-weight: 700; color: #fffdf5; min-width: 140px; }
.hn-table .col-cls, .hn-table .col-coh { white-space: nowrap; }
.hn-badge-cls {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    background: rgba(246, 213, 127, 0.16); border: 1px solid rgba(246, 213, 127, 0.45);
    color: #ffe8a3; font: 700 12px Tahoma, sans-serif;
}
.hn-table .col-award { color: #ffefb8; line-height: 1.48; }
.hn-award-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.hn-award-list li { padding-left: 14px; position: relative; }
.hn-award-list li::before { content: "-"; position: absolute; left: 2px; color: #f6d57f; font-weight: 700; }
.hn-table .col-act { width: 58px; text-align: right; }
.hn-del-btn {
    padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(255, 160, 150, 0.5);
    background: rgba(183, 28, 28, 0.35); color: #ffd6d6; font: 700 11.5px Tahoma, sans-serif; cursor: pointer;
}
.hn-del-btn:hover { background: #c62828; color: #fff; }
.hn-empty {
    margin: 26px auto; max-width: 460px; text-align: center; padding: 18px 20px;
    border-radius: 10px; border: 1.5px dashed rgba(246, 213, 127, 0.45);
    background: rgba(15, 34, 35, 0.45); color: #f4e6be; font: 600 14px/1.55 Tahoma, sans-serif;
}

/* ---------- 2. QUYỂN ALBUM ẢNH TẬP THỂ (LẬT TRANG THEO LỚP & NIÊN KHÓA) ---------- */
.alb-book {
    width: min(1020px, 98vw); max-height: 94dvh; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 14px; border: 4px solid #6b4322;
    background: linear-gradient(180deg, #5a371b, #4a2d15);
    box-shadow: 0 18px 46px rgba(0,0,0,0.65), inset 0 0 0 2px #9e7246;
}
.alb-head {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 11px 15px; background: linear-gradient(90deg, #513117, #6c4322, #513117);
    border-bottom: 2px solid #9d7145; color: #fff6dc;
}
.alb-head-left { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.alb-head h2 { margin: 0; font: 700 19px Tahoma, sans-serif; color: #ffefc4; }
.alb-pickers { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alb-pickers label { display: inline-flex; align-items: center; gap: 5px; font: 700 12.5px Tahoma, sans-serif; color: #f6e1b5; }
.alb-pickers select {
    padding: 6px 9px; border-radius: 7px; border: 1.5px solid #c9a46c;
    background: #fffaf0; color: #312011; font: 700 13px Tahoma, sans-serif; cursor: pointer;
}
.alb-add-btn {
    padding: 6px 13px; border-radius: 16px; border: 1.5px solid #c8e6c9;
    background: #2e7d32; color: #fff; font: 700 12.5px Tahoma, sans-serif; cursor: pointer;
}
.alb-add-btn:hover { background: #388e3c; }

/* Khu thêm ảnh vào lớp đang chọn */
.alb-upload {
    display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 12px;
    padding: 11px 15px; background: #fbf4e2; border-bottom: 2px solid #bfa06c; color: #362516;
}
.alb-upload[hidden] { display: none; }
.alb-dropzone {
    display: flex; align-items: center; justify-content: center; min-height: 112px; padding: 9px;
    border: 2px dashed #9d7a4b; border-radius: 9px; background: #f3e7ca; text-align: center;
}
.alb-dropzone.dragover { background: #e8f5e9; border-color: #2e7d32; }
.alb-drop-empty { display: grid; gap: 5px; font: 600 12.5px/1.4 Tahoma, sans-serif; color: #543e26; }
.alb-drop-empty small { font-size: 11px; color: #7a6650; }
#alb-pick-btn {
    padding: 4px 10px; border-radius: 6px; border: 1px solid #513117;
    background: #6b4322; color: #fff8e3; font: 700 12px Tahoma, sans-serif; cursor: pointer;
}
.alb-drop-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.alb-drop-preview[hidden] { display: none; }
.alb-preview-strip { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-height: 92px; overflow: auto; }
.alb-preview-strip img { width: 58px; height: 46px; object-fit: cover; border-radius: 4px; border: 1.5px solid #9d7a4b; }
#alb-clear-pick {
    padding: 3px 9px; border-radius: 6px; border: 1px solid #9e8159;
    background: #fffdf7; color: #523b24; font: 700 11.5px Tahoma, sans-serif; cursor: pointer;
}
.alb-up-fields { display: flex; flex-direction: column; gap: 7px; }
.alb-target-note { font: 700 12.5px Tahoma, sans-serif; color: #244f50; }
#alb-caption-input {
    width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 7px;
    border: 1.5px solid #bfa172; background: #fffdf8; color: #2b1e12;
    font: 13.5px Tahoma, sans-serif; -webkit-user-select: text; user-select: text;
}
.alb-up-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: auto; }
.alb-up-status { margin-right: auto; font: 600 12px Tahoma, sans-serif; color: #8c2d26; }
.alb-cancel-btn {
    padding: 6px 12px; border-radius: 7px; border: 1.5px solid #a08560;
    background: #efe3c8; color: #4a3723; font: 700 12.5px Tahoma, sans-serif; cursor: pointer;
}
.alb-submit-btn {
    padding: 6px 14px; border-radius: 7px; border: 1.5px solid #1b5e20;
    background: #2e7d32; color: #fff; font: 700 13px Tahoma, sans-serif; cursor: pointer;
}
.alb-submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Phần trang sách khổ rộng của quyển Album (tự ôm sát cả ảnh ngang toàn cảnh lẫn ảnh dọc) */
.alb-spread {
    flex: 1; min-height: 360px; display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 14px 14px; background: radial-gradient(ellipse at 50% 45%, #754a26, #4a2d15 82%);
    overflow: hidden;
}
.alb-flip {
    width: 44px; height: 68px; flex-shrink: 0; border-radius: 10px;
    border: 2px solid rgba(255, 232, 180, 0.55); background: rgba(255, 248, 225, 0.14);
    color: #fff6dc; font: 700 34px/1 Tahoma, sans-serif; cursor: pointer;
    transition: background .12s, transform .1s;
}
.alb-flip:hover:not(:disabled) { background: rgba(255, 224, 130, 0.32); transform: scale(1.06); }
.alb-flip:disabled { opacity: 0.24; cursor: default; }

.alb-sheet {
    position: relative; flex: 1; max-width: 900px; height: min(500px, 64dvh); min-height: 340px;
    padding: 16px 22px 14px; border-radius: 8px; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(180deg, #fffdf5 0%, #f7eed8 100%);
    box-shadow: 0 12px 30px rgba(0,0,0,0.52), 0 0 0 3px #c8ad7c, inset 0 0 24px rgba(120, 86, 48, 0.12);
    color: #362617;
}
/* Nếp gáy nhẹ kiểu album ảnh khổ ngang */
.alb-sheet::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 16px; pointer-events: none;
    background: linear-gradient(90deg, rgba(90, 58, 26, 0.24), transparent);
}
.alb-sheet.flip-next { animation: albFlipNext .26s ease-out; }
.alb-sheet.flip-prev { animation: albFlipPrev .26s ease-out; }
@keyframes albFlipNext { from { transform: perspective(1100px) rotateY(-6deg) translateX(12px); opacity: .72; } to { transform: none; opacity: 1; } }
@keyframes albFlipPrev { from { transform: perspective(1100px) rotateY(6deg) translateX(-12px); opacity: .72; } to { transform: none; opacity: 1; } }

/* Trang bìa khi lớp chưa có ảnh */
.alb-cover-card {
    width: min(540px, 100%); display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 10px; padding: 26px 22px;
    border: 2px double #c2a06c; border-radius: 10px; background: rgba(255, 251, 240, 0.8);
}
.alb-cover-crest { font-size: 44px; line-height: 1; }
.alb-cover-school { font: 700 12.5px Tahoma, sans-serif; color: #8b5f2c; letter-spacing: .9px; text-transform: uppercase; }
.alb-cover-class { margin: 0; font: 800 26px Tahoma, sans-serif; color: #1f4445; }
.alb-cover-coh {
    padding: 4px 14px; border-radius: 14px; background: #244f50; color: #ffe7a1;
    font: 700 13.5px Tahoma, sans-serif;
}
.alb-cover-stat { font: 600 13.5px/1.55 Tahoma, sans-serif; color: #64503a; max-width: 390px; margin: 2px 0; }
.alb-cover-cta {
    margin-top: 4px; padding: 8px 16px; border-radius: 18px; border: 1.5px solid #1b5e20;
    background: #2e7d32; color: #fff; font: 700 13px Tahoma, sans-serif; cursor: pointer;
}
.alb-cover-cta:hover { background: #388e3c; }

/* Bố cục trang ảnh NGANG (trải rộng toàn trang, khung ôm khít đúng tỉ lệ ảnh, không viền thừa!) */
.alb-view {
    width: 100%; height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 9px; min-height: 0;
}
.alb-view.portrait {
    flex-direction: row; align-items: center; justify-content: center; gap: 24px;
}
.alb-photo-stage {
    flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%;
    display: flex; align-items: center; justify-content: center;
}
.alb-view.portrait .alb-photo-stage {
    flex: 0 1 auto; width: auto; height: 100%;
}
.alb-photo-frame {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    padding: 8px; border-radius: 3px; background: #ffffff;
    border: 1px solid #d5c19a; box-shadow: 0 6px 18px rgba(62, 42, 18, 0.24);
    cursor: zoom-in; max-width: 100%; max-height: 100%;
}
/* 4 góc kẹp ảnh cổ điển ôm sát đúng 4 góc bức ảnh */
.alb-photo-frame::before, .alb-photo-frame::after {
    content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none;
    border: 3px solid #9d7540;
}
.alb-photo-frame::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.alb-photo-frame::after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.alb-photo-frame img {
    display: block; max-width: 100%; max-height: min(390px, 49dvh);
    width: auto; height: auto; border-radius: 2px;
}
.alb-view.portrait .alb-photo-frame img {
    max-height: min(445px, 56dvh); max-width: min(360px, 46vw);
}

.alb-info-bar {
    width: 100%; max-width: 820px; display: flex; flex-direction: column; gap: 5px;
    flex-shrink: 0;
}
.alb-view.portrait .alb-info-bar {
    width: min(300px, 42%); max-width: 310px; padding: 16px 16px;
    border: 1.5px dashed #cfb78a; border-radius: 10px; background: rgba(255, 252, 242, 0.85);
    gap: 10px;
}
.alb-class-pill {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
    padding: 3px 10px; border-radius: 12px; background: #244f50; color: #ffe8a6;
    font: 700 11.5px Tahoma, sans-serif;
}
.alb-slot-cap {
    font: italic 600 14.5px/1.4 Georgia, 'Times New Roman', serif; color: #3e2b18;
    text-align: center; overflow-wrap: anywhere;
}
.alb-view.portrait .alb-slot-cap { text-align: left; font-size: 15px; }
.alb-slot-meta {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding-top: 6px; border-top: 1px dashed #decba6; font: 12px Tahoma, sans-serif; color: #75604b;
}
.alb-slot-btns { display: inline-flex; gap: 6px; align-items: center; }
.alb-like-btn {
    padding: 3px 10px; border-radius: 14px; border: 1px solid #d4bc95;
    background: #faf3e4; color: #5a422b; font: 700 12px Tahoma, sans-serif; cursor: pointer;
}
.alb-like-btn.liked { background: #ffe4ec; border-color: #d81b60; color: #ad1457; }
.alb-del-btn {
    padding: 3px 9px; border-radius: 8px; border: 1px solid #dca8a5;
    background: #fff5f5; color: #b71c1c; font: 700 11.5px Tahoma, sans-serif; cursor: pointer;
}
.alb-del-btn:hover { background: #d32f2f; color: #fff; }

.alb-footer {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding: 9px 15px; background: #472b14; border-top: 2px solid #8a6239; color: #f6e3ba;
    font: 700 12.5px Tahoma, sans-serif;
}
.alb-thumbs { display: flex; gap: 5px; align-items: center; overflow-x: auto; max-width: 55%; padding: 2px; }
.alb-dot {
    width: 34px; height: 24px; padding: 0; border-radius: 4px; overflow: hidden;
    border: 2px solid rgba(255,240,200,0.35); background: #2d1b0c; cursor: pointer; flex-shrink: 0;
}
.alb-dot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.alb-dot.active { border-color: #ffe082; transform: scale(1.08); }
.alb-tip { font-weight: 500; font-size: 11.5px; color: #dfc79a; }

/* Lightbox phóng to ảnh trong Album */
#alb-lightbox {
    position: fixed; inset: 0; z-index: 72; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px; padding: 18px;
    background: rgba(10, 14, 18, 0.92);
}
#alb-lightbox[hidden] { display: none; }
#alb-lb-img {
    max-width: 90vw; max-height: 78dvh; object-fit: contain;
    border-radius: 6px; border: 4px solid #f5ead1; box-shadow: 0 10px 32px rgba(0,0,0,0.65);
}
.alb-lb-cap { color: #fff5d8; font: 600 14px Tahoma, sans-serif; text-align: center; max-width: 680px; }
.alb-lb-close {
    position: fixed; top: 16px; right: 18px; width: 40px; height: 40px; border-radius: 50%;
    border: 2px solid #fff; background: #c62828; color: #fff; font: 700 18px Tahoma, sans-serif; cursor: pointer;
}

@media (max-width: 760px) {
    .hn-form-grid { grid-template-columns: 1fr 1fr; }
    .hn-form-grid label:first-child { grid-column: 1 / -1; }
    .alb-upload { grid-template-columns: 1fr; }
    .alb-sheet { padding: 12px; height: auto; min-height: 310px; }
    .alb-view.portrait { flex-direction: column; gap: 10px; }
    .alb-view.portrait .alb-info-bar { width: 100%; max-width: 100%; padding: 8px 10px; }
    .alb-view.portrait .alb-photo-frame img { max-width: 100%; max-height: 46dvh; }
    .alb-flip { width: 34px; height: 52px; font-size: 26px; }
    .alb-tip { display: none; }
}
