/* --- VARIABLES & THEME CONFIG --- */
:root {
    --color-danger: #e53e3e;   
    --color-warning: #dd6b20;  
    --color-loss: #744210;     
    --color-money: #d69e2e;    
    --color-hero: #3182ce;     
    --color-love: #ed64a6;
    
    --glass-bg: rgba(20, 25, 35, 0.85); 
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-blur: 25px;
    
    --text-main: #f7fafc;
    --text-sub: #a0aec0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: #1a202c;
    color: var(--text-main);
    overflow-x: hidden;
}

/* --- BACKGROUND SYSTEM --- */
.bg-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    background-color: #000;
}

.bg-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    filter: brightness(0.7) contrast(1.1); 
    will-change: opacity;
}

/* Background đen cho page story */
#bg-black {
    background-color: #000;
    z-index: -1; /* Nằm trên các ảnh khác khi active */
}

.bg-image.active { opacity: 1; }

/* Layer phụ cho Page 1 (Tương tác tỉnh thành) */
/* Lưu ý: Không set z-index cứng để nó tuân theo DOM order (nằm sau bg-1 và nằm trước bg-2) */
.bg-layer-1 {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0; transition: opacity 0.8s ease;
    filter: brightness(0.7) contrast(1.1);
    pointer-events: none; 
}
.bg-layer-1.active { opacity: 1; }

#bg-5.active, #bg-6.active {
        filter: brightness(0.3) contrast(1.1);
}

.scrolly-container { width: 100%; position: relative; }

/* Default Section Style */
.story-section {
    height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* --- CONTENT CARD --- */
.content-card {
    position: absolute;
    bottom: 5%; right: 5%;
    width: 600px; 
    height: 650px;
    max-width: 90vw; max-height: 85vh;
    
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex; flex-direction: column;
    
    transform: translateX(100px); opacity: 0;
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 20;
}

/* --- FIX HIDE LOGIC --- */
.content-card.hidden-card, 
.story-container.hidden-card, 
.split-content.hidden-card {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.95) !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
}

.story-section.active .content-card {
    transform: translateX(0); opacity: 1;
}

/* --- HIDE / SHOW BUTTONS UI --- */
.hide-btn {
    position: absolute;
    top: 15px; right: 15px;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    transition: all 0.2s;
    background: rgba(0,0,0,0.3);
    display: flex; align-items: center; gap: 6px;
    font-weight: 500;
    z-index: 30; 
}
.hide-btn:hover { background: rgba(255,255,255,0.2); color: white; border-color: white; }

.show-btn {
    position: absolute;
    bottom: 30px; right: 30px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 15; 
    display: flex; align-items: center; gap: 8px;
    
    opacity: 0; 
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s ease;
}
.show-btn.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.show-btn:hover { background: rgba(255, 255, 255, 0.3); transform: translateY(-2px); }

/* --- CARD HEADER & CONTENT --- */
.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    padding-right: 70px; 
}

.card-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: white; flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}
.card-scroll-area::-webkit-scrollbar { width: 4px; }
.card-scroll-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 4px; }

.card-text {
    font-size: 1.1rem; line-height: 1.6;
    color: var(--text-sub); margin-bottom: 20px;
}

/* --- PAGE 1: INTERACTIVE PROVINCE LIST --- */
.interactive-layout { display: flex; gap: 15px; height: 100%; }
.province-list { width: 35%; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 5px; }
.province-btn {
    padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid transparent;
    border-radius: 8px; color: var(--text-sub); cursor: pointer; text-align: left;
    font-weight: 600; transition: all 0.2s; font-size: 0.9rem;
}
.province-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.province-btn.active { background: var(--color-danger); color: white; box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4); }
.province-detail-panel { width: 65%; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; justify-content: center; }
.stat-big-box { display: flex; gap: 15px; margin-bottom: 20px; }
.stat-box { flex: 1; background: rgba(255,255,255,0.05); padding: 15px; border-radius: 10px; text-align: center; }
.stat-num { font-size: 2rem; font-weight: 900; color: white; display: block; line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; color: #a0aec0; }
.cause-box { background: rgba(229, 62, 62, 0.1); border-left: 3px solid var(--color-danger); padding: 15px; border-radius: 0 8px 8px 0; }
.cause-title { font-size: 0.8rem; text-transform: uppercase; color: var(--color-danger); font-weight: 700; margin-bottom: 5px; }
.cause-text { font-size: 0.95rem; color: white; line-height: 1.4; font-style: italic; }

/* --- PAGE 2: HOUSING CARDS --- */
.housing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}
.housing-card {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s;
}
.housing-card:hover { transform: translateY(-5px); background: rgba(255,255,255,0.08); }
.housing-card.large { grid-column: span 2; background: linear-gradient(135deg, rgba(221, 107, 32, 0.2), rgba(255,255,255,0.05)); border-color: var(--color-warning); }
.h-icon { font-size: 2rem; margin-bottom: 10px; color: var(--color-warning); }
.h-num { font-size: 2.5rem; font-weight: 900; color: white; line-height: 1; }
.h-label { margin-top: 5px; font-size: 0.9rem; color: #cbd5e0; text-transform: uppercase; letter-spacing: 1px; }
.h-desc { font-size: 0.85rem; color: #a0aec0; margin-top: 8px; font-style: italic; }

/* --- PAGE 3: AGRICULTURE LIST (Full Content) --- */
.agri-list {
    display: flex; flex-direction: column; gap: 15px;
}
.agri-item {
    background: rgba(116, 66, 16, 0.2);
    border-left: 4px solid var(--color-loss);
    padding: 15px;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}
.agri-icon { font-size: 1.5rem; color: var(--color-loss); margin-top: 3px; }
.agri-text { font-size: 1rem; color: #fff; line-height: 1.5; }
.agri-highlight { color: var(--color-money); font-weight: 700; font-size: 1.1em; }

/* --- PAGE 4: COUNTER --- */
.counter-wrapper {
    text-align: center; padding: 40px 0;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    background: radial-gradient(circle, rgba(214, 158, 46, 0.15) 0%, rgba(0,0,0,0) 70%);
}
#economy-counter { font-size: 5rem; font-weight: 900; line-height: 1; color: var(--color-money); text-shadow: 0 0 30px rgba(214, 158, 46, 0.5); }
.counter-unit { font-size: 1.5rem; text-transform: uppercase; color: white; font-weight: 700; letter-spacing: 2px; margin-top: 10px;}

/* --- PAGE 5: LONG SCROLL STORY --- */
.long-story-section {
    height: auto;
    min-height: 100vh;
    padding: 100px 20px;
    display: block; 
    background: transparent;
    z-index: 5;
}

.story-container {
    max-width: 1080px;
    margin: 0 auto;
    background: rgba(0,0,0,0.6); 
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    position: relative;
    transition: all 0.5s ease;
}

.story-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #e2e8f0;
    margin-bottom: 30px;
}
.story-text p { margin-bottom: 20px; }
.story-highlight { color: var(--color-hero); font-weight: 700; font-size: 1.25em; }

.video-container {
    width: 100%;
    margin: 30px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    background: #000;
    border: 1px solid rgba(255,255,255,0.2);
}
.video-container video {
    width: 100%;
    display: block;
}
.video-caption {
    padding: 10px;
    background: rgba(0,0,0,0.8);
    color: #a0aec0;
    font-size: 0.9rem;
    text-align: right;
    font-style: italic;
}

/* --- PAGE 6: SPLIT SCREEN --- */
.split-section {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}
.split-video {
    width: 50%;
    height: 100%;
    position: relative;
    background: #000;
    transform: translateX(-100%);
}
.split-video video {
    width: 100%; height: 100%;
    object-fit: cover;
}
.split-content {
    width: 50%;
    height: 100%;
    display: flex; flex-direction: column; justify-content: center;
    padding: 60px;
    background: rgba(20, 25, 35, 0.9);
    transform: translateX(100%);
    position: relative;
    transition: all 0.5s ease;
}

/* --- PAGE 8: HEARTS & QUOTE --- */
.hearts-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}
.heart-icon {
    font-size: 2.5rem;
    color: var(--color-love);
    margin: 0 -10px;
    filter: drop-shadow(0 0 10px rgba(237, 100, 166, 0.5));
    animation: beat 2s infinite ease-in-out;
}
.heart-icon:nth-child(2) { font-size: 3.5rem; z-index: 2; animation-delay: 0.2s; }

@keyframes beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.quote-box {
    margin-top: 20px;
    padding: 20px;
    background: rgba(237, 100, 166, 0.15);
    border: 1px solid rgba(237, 100, 166, 0.3);
    border-radius: 16px;
    text-align: center;
}
.quote-text {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: var(--color-love);
    line-height: 1.3;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Table Dropdown Styles */
.allocation-container {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
}
.custom-select {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--color-love);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-family: 'Be Vietnam Pro', sans-serif;
    margin-bottom: 15px;
    cursor: pointer;
    outline: none;
}
.custom-select option { background: #1a202c; }

.allocation-details {
    display: none;
    animation: fadeIn 0.3s ease;
}
.allocation-details.active { display: block; }

.allocation-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    font-size: 0.95rem;
}
.allocation-stat-row:last-child { border-bottom: none; padding-top: 15px; margin-top: 5px; }
.total-row { font-weight: 900; color: var(--color-money); font-size: 1.2rem; }
.source-note {
    margin-top: 15px; font-size: 0.8rem; color: #718096; text-align: center; font-style: italic; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px;
}

.header-content {
    text-align: center;
    z-index: 10;
    padding: 20px;
    max-width: 900px;
}

/* --- FOOTER & POPUP --- */
.footer-card { background: rgba(0,0,0,0.6); padding: 40px; border-radius: 20px; backdrop-filter: blur(10px); display: flex; flex-direction: column; align-items: center; gap: 20px; width: 90%; max-width: 800px; border: 1px solid rgba(255,255,255,0.15); }
.qr-box { text-align: center; margin-bottom: 20px; cursor: pointer; transition: transform 0.3s; }
.qr-box:hover { transform: scale(1.05); }
.qr-image { width: 300px; height: auto; border-radius: 10px; margin: 15px 0; box-shadow: 0 5px 20px rgba(0,0,0,0.5); background: white; padding: 5px;}
.action-link { font-weight: 700; color: var(--color-money); text-decoration: underline; cursor: pointer; font-size: 1.1rem; margin-bottom: 20px; text-transform: uppercase; }
.poem-box { font-family: serif; font-style: normal; font-size: 1.5rem; color: var(--color-love); text-align: center; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; width: 100%; }

/* POPUP STYLES */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 9999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-content { width: 90%; max-width: 800px; max-height: 90vh; background: #1a1a1a; border: 1px solid #333; border-radius: 15px; padding: 30px; position: relative; overflow-y: auto; }
.modal-close-btn { position: sticky; top: 0; float: right; background: var(--color-danger); color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-weight: bold; z-index: 10; }
.modal-body { color: #e2e8f0; font-size: 1rem; line-height: 1.6; white-space: pre-line; }
.modal-body strong { color: var(--color-money); }

.nav-dots { position: fixed; left: 20px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 15px; z-index: 100; }
.nav-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.3); cursor: pointer; transition: all 0.3s; }
.nav-dot.active { transform: scale(1.4); }

@media (max-width: 768px) {
    .main-title { font-size: 2.5rem; }
    .content-card { width: 90%; height: auto; max-height: 70vh; bottom: 20px; right: 5%; padding: 20px; }
    .housing-grid { grid-template-columns: 1fr; }
    .housing-card.large { grid-column: span 1; }
    .split-section { flex-direction: column; }
    .split-video, .split-content { width: 100%; height: 50%; }
    .split-content { padding: 30px; overflow-y: auto; }
    .story-container { padding: 20px; }
}