:root {
    --bg-color: #f4f7f6; --surface-color: #ffffff;
    --text-primary: #2d3436; --text-secondary: #636e72;
    --accent-color: #0984e3; --accent-hover: #076bb8;
    --border-radius: 12px; --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }

/* HIỆU ỨNG CHUYỂN TRANG TỐI ƯU GPU */
@keyframes fadeSlideIn {
    0% { opacity: 0; transform: translateY(25px); }
    100% { opacity: 1; transform: translateY(0); }
}
.page-transition { 
    animation: fadeSlideIn 0.4s ease-out forwards; 
    will-change: transform, opacity;
}

/* --- [MỚI] KIỂU DÁNG THANH TIẾN TRÌNH CUỘN MÀN HÌNH --- */
#global-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%; /* JS sẽ tự động tăng % chiều rộng từ đây */
    height: 4px;
    background-color: var(--accent-color);
    z-index: 2000; /* Đảm bảo nằm trên thanh sticky header */
    transition: width 0.1s ease-out;
}

/* --- [MỚI] KIỂU DÁNG NÚT TRỞ VỀ ĐẦU TRANG FLOATING --- */
#global-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 46px;
    height: 46px;
    border-radius: 50%; /* Ép bo tròn hoàn hảo */
    background-color: var(--surface-color);
    color: var(--accent-color);
    border: 1px solid #ddd;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Trạng thái ẩn mặc định: Mờ đi + Đẩy nhẹ xuống dưới */
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Kích hoạt khi cuộn chuột qua ngưỡng của JS */
#global-back-to-top.activated {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#global-back-to-top:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-4px); /* Hiệu ứng nhấc nút lên */
    box-shadow: 0 6px 18px rgba(9, 132, 227, 0.3);
}

/* HEADER */
header { background-color: var(--surface-color); box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; }
nav { max-width: 1200px; margin: 0 auto; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 1.5rem; font-weight: 700; color: var(--accent-color); }
nav ul { display: flex; gap: 2rem; list-style: none; }
nav a { text-decoration: none; color: var(--text-primary); font-weight: 500; transition: var(--transition); padding-bottom: 0.3rem; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--accent-color); }
nav a.active { color: var(--accent-color); border-bottom: 2px solid var(--accent-color); }

/* BỐ CỤC */
.page-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 3rem 2rem; 
    flex: 1; 
    width: 100%; 
    transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1); 
}
.page-container.expanded-mode { max-width: 1600px; }
.section-title { font-size: 2.2rem; margin-bottom: 2rem; border-bottom: 3px solid var(--accent-color); padding-bottom: 0.5rem; display: inline-block; }

/* TRANG DỰ ÁN */
.section-header-flex { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; margin-bottom: 2rem; border-bottom: 3px solid var(--accent-color); padding-bottom: 0.5rem; scroll-margin-top: 90px; }
.section-header-flex .section-title { border: none; margin-bottom: 0; padding-bottom: 0; }
.active-title { font-size: 1.4rem; color: #e74c3c; font-style: italic; animation: fadeIn 0.4s ease; }
.btn-back { background-color: var(--text-secondary); color: white; border: none; padding: 0.6rem 1.2rem; border-radius: 6px; cursor: pointer; font-weight: 600; transition: var(--transition); }
.btn-back:hover { background-color: var(--text-primary); }

.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 2rem; }
.card { background: var(--surface-color); padding: 2rem; border-radius: var(--border-radius); border: 1px solid #eee; display: flex; flex-direction: column; transition: var(--transition); box-shadow: 0 4px 15px rgba(0,0,0,0.04); }
.card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); border-color: var(--accent-color); }
.card-tag { font-size: 0.8rem; font-weight: 700; color: var(--accent-color); text-transform: uppercase; margin-bottom: 0.5rem; }
.card h3 { font-size: 1.4rem; margin-bottom: 1rem; }
.card p { color: var(--text-secondary); margin-bottom: 1.5rem; flex-grow: 1; text-align: justify; }

.btn { background-color: var(--accent-color); color: white; border: none; padding: 0.8rem; border-radius: 6px; font-weight: 600; cursor: pointer; transition: var(--transition); width: 100%; font-size: 1rem; margin-top: auto; }
.btn:hover { background-color: var(--accent-hover); transform: scale(1.02); }

/* SPLIT-SCREEN */
.native-container { width: 100%; height: auto; background-color: var(--surface-color); border-radius: var(--border-radius); border: 1px solid #ddd; box-shadow: 0 10px 30px rgba(0,0,0,0.1); animation: slideUp 0.4s ease; outline: none; }
.viewer-layout { display: flex; flex-direction: row; align-items: stretch; height: auto; }

.viewer-sidebar { width: 30%; background-color: #f8f9fa; border-right: 1px solid #ddd; border-bottom-left-radius: var(--border-radius); }
#sidebar-content { position: sticky; top: 90px; padding: 2.5rem; max-height: calc(100vh - 110px); overflow-y: auto; }

.viewer-sidebar h4 { color: var(--accent-color); font-size: 1.2rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.viewer-sidebar h4:first-child { margin-top: 0; }
.viewer-sidebar p, .viewer-sidebar ul { color: var(--text-primary); font-size: 1.05rem; margin-bottom: 1rem; text-align: justify; line-height: 1.7; }
.viewer-sidebar ul { padding-left: 1.5rem; }
.viewer-sidebar li { margin-bottom: 0.5rem; }

.viewer-main { width: 70%; background-color: #525659; padding: 2rem 0; height: auto; box-shadow: inset 10px 0 10px -10px rgba(0,0,0,0.2); border-bottom-right-radius: var(--border-radius); }
.document-area { display: flex; flex-direction: column; align-items: center; gap: 2rem; }

.pdf-page-canvas, .native-image { width: 90%; max-width: 1200px; height: auto !important; background-color: white; box-shadow: 0 5px 15px rgba(0,0,0,0.3); border-radius: 4px; }
.spinner { text-align: center; color: white; font-weight: bold; margin-bottom: 1rem; }

/* TRANG GIỚI THIỆU & TỔNG KẾT */
.hero { background: var(--surface-color); padding: 4rem 3rem; border-radius: var(--border-radius); box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.hero h1 { font-size: 2.8rem; margin-bottom: 0.5rem; color: var(--accent-color); }
.hero h2 { font-size: 1.2rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 3rem; border-bottom: 1px solid #eee; padding-bottom: 2rem; }
.intro-content { text-align: left; max-width: 900px; margin: 0 auto; }
.intro-content h3 { color: var(--text-primary); margin: 2rem 0 0.8rem 0; font-size: 1.4rem; }
.intro-content p { color: var(--text-secondary); margin-bottom: 1rem; font-size: 1.1rem; line-height: 1.8; text-align: justify;}
.reflection-content { background: var(--surface-color); padding: 3rem; border-radius: var(--border-radius); box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.reflection-content h3 { color: var(--accent-color); margin: 2rem 0 0.8rem 0; font-size: 1.3rem; }
.reflection-content p { margin-bottom: 1rem; font-size: 1.1rem; line-height: 1.8; text-align: justify; }

/* FOOTER */
footer { text-align: center; padding: 2rem; background-color: var(--surface-color); color: var(--text-secondary); font-size: 0.9rem; border-top: 1px solid #ddd; margin-top: auto; }

/* TIỆN ÍCH */
.hidden { display: none !important; }
@keyframes slideUp { from {opacity: 0; transform: translateY(20px);} to {opacity: 1; transform: translateY(0);} }
@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }

/* RESPONSIVE */
@media (max-width: 992px) {
    .viewer-layout { flex-direction: column; } 
    .viewer-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #ddd; border-bottom-left-radius: 0; }
    #sidebar-content { position: relative; top: 0; max-height: none; padding: 2rem; }
    .viewer-main { width: 100%; height: auto; border-bottom-left-radius: var(--border-radius); }
}
@media (max-width: 768px) {
    nav { flex-direction: column; gap: 1rem; }
    .section-header-flex { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .btn-back { width: 100%; }
}