:root {
    --gold: #d4af37;
    --dark-bg: #1a1a1a;
    --sidebar-bg: #222;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Times New Roman', Times, serif; }

body { background-color: var(--dark-bg); height: 100vh; overflow: hidden; }

.container { display: flex; height: 100vh; width: 100%; }

/* --- SIDEBAR --- */
.sidebar {
    width: 350px; background-color: var(--sidebar-bg); display: flex; flex-direction: column;
    border-right: 1px solid #444; color: #fff; z-index: 20; flex-shrink: 0;
}
.sidebar-header { padding: 15px; background: #2c2c2c; text-align: center; border-bottom: 2px solid var(--gold); }

/* Fix cứng kích thước Logo Sidebar trong CSS để đảm bảo không bị vỡ */
.sidebar-header img { 
    width: 100px; 
    height: auto; 
    object-fit: contain; 
    margin-bottom: 10px;
}
.sidebar-header h2 { color: var(--gold); font-size: 14px; margin-top: 5px; text-transform: uppercase; font-family: Arial, sans-serif; }

.search-container { padding: 10px; background: #333; }
.search-input { width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #555; font-family: Arial, sans-serif; }

.donor-list { flex: 1; overflow-y: auto; padding: 10px; }
.donor-list::-webkit-scrollbar { width: 6px; }
.donor-list::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

/* --- CẬP NHẬT GIAO DIỆN ITEM DANH SÁCH (HỖ TRỢ XỔ XUỐNG) --- */
.donor-item {
    background: #2f3136; padding: 12px; margin-bottom: 10px; border-radius: 6px;
    cursor: pointer; border-left: 4px solid transparent; 
    /* Đổi thành block để chứa phần header và phần chi tiết bên dưới */
    display: block; 
    transition: 0.2s;
}
.donor-item:hover, .donor-item.active { background: #3a3d42; border-left-color: var(--gold); }

/* Header của Item (Chứa Avatar + Tên + Tiền như cũ) */
.item-header {
    display: flex;
    align-items: center;
}

.d-avatar {
    width: 35px; height: 35px; background: var(--gold); color: #000; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 10px; font-family: Arial, sans-serif; flex-shrink: 0;
}
.d-info h4 { font-size: 15px; margin-bottom: 4px; color: #fff; font-family: Arial, sans-serif; }
.d-info p { font-size: 12px; color: #aaa; margin-bottom: 2px; font-family: Arial, sans-serif; }
.money-txt { color: #4cd137; font-weight: bold; font-family: Arial, sans-serif; }

/* Phần chi tiết ẩn (Sẽ hiện khi active) */
.item-details-expand {
    display: none; /* Mặc định ẩn */
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #555;
    font-size: 13px;
    color: #ccc;
    animation: fadeIn 0.3s ease;
}

.donor-item.active .item-details-expand {
    display: block; /* Hiện khi active */
}

.detail-row { margin-bottom: 5px; font-family: Arial, sans-serif; line-height: 1.4; }
.detail-label { color: #888; font-size: 11px; margin-right: 5px; }
.detail-msg { color: #fff; font-style: italic; background: rgba(0,0,0,0.2); padding: 5px; border-radius: 4px; margin-top: 5px; display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.copyright { padding: 10px; text-align: center; font-size: 11px; color: #777; border-top: 1px solid #444; font-family: Arial, sans-serif; }
.copyright a { color: var(--gold); text-decoration: none; }

/* --- MAIN DISPLAY (GIỮ NGUYÊN SCALE CŨ) --- */
.main-display {
    flex: 1; 
    background: url('https://suckhoecongdong.net.vn/uploads/about/bg-about.jpg') center/cover no-repeat;
    position: relative; 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    overflow: hidden; 
}
.main-display::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.6); }

/* KHUNG BAO NGOÀI */
.scale-outer-wrapper {
    position: relative;
    width: 1000px;
    height: 700px;
    margin: 0 auto;
    z-index: 10;
}

/* KHUNG NỘI DUNG CỐ ĐỊNH */
.cert-fixed-size {
    width: 1000px;
    height: 700px;
    position: absolute;
    top: 0; left: 0;
    background: #fff;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.5);
    transform-origin: top left;
    transition: transform 0s;
}

/* Hiệu ứng viền */
.glowing-border {
    position: absolute; inset: -8px;
    background: linear-gradient(45deg, #d4af37, #000, #fff, #d4af37);
    background-size: 400%; animation: glow 6s infinite linear; z-index: 0; border-radius: 4px;
}
@keyframes glow { 0% { background-position: 0 50%; } 100% { background-position: 100% 50%; } }

/* CSS NỘI DUNG BÊN TRONG */
.certificate {
    position: absolute; inset: 0; background: #fff; z-index: 1;
    border: 3px solid var(--gold); overflow: hidden;
}
.certificate::after { content: ''; position: absolute; inset: 15px; border: 2px solid var(--gold); pointer-events: none; }

.corner-img { position: absolute; width: 200px; z-index: 2; }
.top-right { top: 0; right: 0; }
.bottom-left { bottom: 0; left: 0; }

.badge-badge {
    position: absolute; top: -10px; left: 70px; width: 130px; z-index: 10;
    filter: drop-shadow(2px 4px 5px rgba(0,0,0,0.4));
}
.badge-badge img { width: 100%; display: block; }

.cert-content {
    position: absolute;
    top: 50px; left: 50px; right: 50px;
    text-align: center; z-index: 5;
}

.org-name { font-size: 24px; font-weight: bold; text-transform: uppercase; margin-bottom: 10px; line-height: 1.3; color: #333; }
.center-logo img { height: 90px; margin-bottom: 10px; }
/* Style cho dòng Quốc Hiệu: CỘNG HÒA... */
.country-name {
    font-size: 22px; /* Kích thước chữ */
    font-weight: bold;
    text-transform: uppercase; /* Lệnh này bắt buộc viết hoa toàn bộ */
    margin-bottom: 5px;
    line-height: 1.3;
    color: #333;
}

/* Style cho dòng Tiêu Ngữ: Độc lập - Tự do... */
.motto-name {
    font-size: 20px; /* Kích thước nhỏ hơn dòng trên 1 xíu */
    font-weight: bold;
    text-transform: none; /* QUAN TRỌNG: Lệnh này cho phép viết thường/hoa tùy ý */
    margin-bottom: 15px; /* Khoảng cách với logo hoặc nội dung dưới */
    color: #333;
    position: relative; /* Để canh chỉnh gạch chân nếu cần */
}

/* (Tùy chọn) Thêm gạch chân dưới dòng Độc lập - Tự do... cho giống giấy khen chuẩn */
.motto-name::after {
    content: '';
    display: block;
    width: 150px; /* Độ dài gạch chân */
    height: 1px;  /* Độ dày gạch chân */
    background: #333; /* Màu gạch chân */
    margin: 5px auto 0; /* Canh giữa gạch chân */
}

.main-title {
    font-size: 48px; color: #b00; font-weight: 900;
    text-transform: uppercase; margin-bottom: 5px;
    text-shadow: 1px 1px 0 #ddd;
}
.honor-label { font-size: 22px; font-weight: bold; margin-bottom: 5px; color: #333; }
.donor-name {
    font-size: 50px; color: #000; text-transform: uppercase;
    font-weight: 900; margin-bottom: 15px; line-height: 1.1; white-space: nowrap;
}
.desc-text {
    font-size: 22px; font-weight: bold; line-height: 1.4; color: #333; width: 80%; margin: 0 auto;
}
.cert-footer {
    position: absolute; bottom: 30px; right: 60px;
    display: flex; flex-direction: column; align-items: center; z-index: 6;
}
.date-text { font-size: 18px; font-style: italic; margin-bottom: 5px; }
.signature-box img { height: 150px; width: auto; }

/* NAV BUTTONS */
.nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.3); border: 2px solid var(--gold);
    color: #fff; font-size: 24px; cursor: pointer; z-index: 100; border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center;
}
.nav-btn:hover { background: var(--gold); }
.prev-btn { left: -70px; }
.next-btn { right: -70px; }

/* --- MOBILE LAYOUT --- */
@media (max-width: 900px) {
    body { overflow: auto; height: auto; }
    .container { flex-direction: column; }
    
    .main-display { 
        order: 1; width: 100%; 
        height: auto; 
        padding: 20px 0;
        overflow: visible;
    }
    
    .sidebar { 
        order: 2; width: 100%; height: 500px; 
        border-right: none; border-top: 2px solid var(--gold); 
    }

    .prev-btn { left: -15px; width: 40px; height: 40px; font-size: 18px; background: rgba(0,0,0,0.6); border: none; }
    .next-btn { right: -15px; width: 40px; height: 40px; font-size: 18px; background: rgba(0,0,0,0.6); border: none; }
}