/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

:root {
    --hero-offset: 130px; /* adjust this to push content further below the top of the background */
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    background-image: url('Slide2.JPG');
    background-size: cover;
    background-position: top center; /* keep header artwork visible, crop sides/bottom instead */
    background-repeat: no-repeat;
    background-attachment: scroll;
}

/* Background Wrapper - Mobile First Approach */
.background-wrapper {
    min-height: 100vh;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(18px, 5vh, 36px);
    padding: clamp(32px, 12vh, 120px) clamp(18px, 6vw, 48px) clamp(28px, 10vh, 64px);
    box-sizing: border-box;
    overflow-x: hidden;
    padding-top: calc(clamp(32px, 12vh, 120px) + var(--hero-offset));
}

/* Video Container - Responsive */
.video-container {
    width: 100%;
    max-width: 820px;
    background: rgba(255, 255, 255, 0.12);
    padding: clamp(6px, 1.8vw, 14px);
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

/* Responsive Video Wrapper (16:9 aspect ratio) */
.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Document Buttons - Responsive Grid */
.document-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(12px, 3vw, 22px);
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    z-index: 10;
    box-sizing: border-box;
}

.doc-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(230, 240, 255, 0.9));
    border: none;
    padding: clamp(10px, 3vw, 16px) clamp(14px, 4vw, 22px);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: clamp(10px, 2.8vw, 16px);
    font-size: clamp(0.9rem, 3vw, 1.05rem);
    font-weight: 600;
    color: #0b1b57;
    box-shadow: 0 10px 30px rgba(0, 36, 102, 0.18);
    box-sizing: border-box;
}

.doc-btn:hover,
.doc-btn:focus-visible {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(222, 236, 255, 0.95));
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(0, 36, 102, 0.28);
    outline: 3px solid rgba(0, 51, 160, 0.35);
    outline-offset: 4px;
}

.doc-btn:active {
    transform: translateY(0);
}

.doc-icon {
    font-size: clamp(1.2rem, 3.6vw, 1.5rem);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(28px, 7vw, 38px);
    height: clamp(28px, 7vw, 38px);
    border-radius: 12px;
    background: rgba(0, 51, 160, 0.08);
    color: #0033a0;
}

.doc-text {
    flex: 1;
    text-align: left;
    line-height: 1.4;
    letter-spacing: 0.4px;
    min-width: 0; /* Quan trọng cho flex container */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* PDF Modal */
.pdf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    padding: clamp(10px, 3vw, 20px);
    overflow: hidden;
}

.pdf-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.pdf-modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 1200px;
    height: 85vh;
    max-height: calc(100vh - 30px);
    border-radius: clamp(8px, 2vw, 12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.pdf-header {
    background: linear-gradient(135deg, #0033a0, #0055d4);
    color: white;
    padding: clamp(8px, 2.5vw, 14px) clamp(12px, 3.5vw, 20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pdf-title {
    margin: 0;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 600;
}

.pdf-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: clamp(1.8rem, 4vw, 2rem);
    width: clamp(36px, 8vw, 40px);
    height: clamp(36px, 8vw, 40px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    line-height: 1;
    flex-shrink: 0;
}

.pdf-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.pdf-viewer {
    flex: 1;
    width: 100%;
    background: #f5f5f5;
    overflow: hidden;
}

.pdf-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
    margin-top: 0;
    transform-origin: top left;
}

/* Submenu Modals - áp dụng cho tất cả các submenu */
.submenu-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    padding: clamp(10px, 3vw, 20px);
}

.submenu-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

.submenu-content {
    background: #ffffff;
    width: 100%;
    max-width: 720px;
    border-radius: clamp(10px, 2vw, 14px);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.submenu-header {
    background: linear-gradient(135deg, #0033a0, #0055d4);
    color: #fff;
    padding: clamp(12px, 3vw, 16px) clamp(16px, 4vw, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.submenu-title {
    margin: 0;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 600;
}

.submenu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: clamp(1.6rem, 4vw, 1.8rem);
    width: clamp(34px, 8vw, 38px);
    height: clamp(34px, 8vw, 38px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.submenu-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.submenu-body {
    padding: clamp(16px, 3vw, 24px);
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(12px, 3vw, 18px);
}

.submenu-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(230,240,255,0.95));
    border: 1px solid rgba(0, 51, 160, 0.15);
    color: #0b1b57;
    font-weight: 600;
    padding: clamp(12px, 3vw, 16px);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* Quan trọng cho flex container */
}

.submenu-btn:hover,
.submenu-btn:focus-visible {
    background: linear-gradient(135deg, rgba(255,255,255,1), rgba(222,236,255,1));
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,36,102,0.18);
    outline: 3px solid rgba(0, 51, 160, 0.25);
    outline-offset: 3px;
}

@media (min-width: 768px) {
    .submenu-body {
        grid-template-columns: 1fr; /* vẫn 1 cột để dễ bấm */
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Mobile: Đảm bảo không bị tràn */
@media (max-width: 767px) {
    .background-wrapper {
        padding: clamp(24px, 18vw, 56px) clamp(14px, 6vw, 26px) clamp(20px, 14vh, 48px);
        gap: clamp(16px, 6vh, 28px);
        padding-top: calc(clamp(24px, 18vw, 56px) + var(--hero-offset));
    }

    .video-container {
        padding: clamp(4px, 2.8vw, 10px);
        border-radius: 18px;
    }

    .doc-btn {
        padding: clamp(12px, 4.2vw, 18px) clamp(16px, 8vw, 26px);
        border-radius: 16px;
        box-shadow: 0 12px 26px rgba(0, 36, 102, 0.22);
        align-items: flex-start;
        min-height: clamp(60px, 15vw, 80px);
    }

    .doc-icon {
        width: clamp(32px, 10vw, 42px);
        height: clamp(32px, 10vw, 42px);
        flex-shrink: 0;
        margin-top: 4px;
    }

    .doc-text {
        font-size: clamp(0.8rem, 3.5vw, 0.95rem);
        line-height: 1.3;
    }
}

/* Tablet và lớn hơn: 2 cột buttons */
@media (min-width: 768px) {
    :root {
        --hero-offset: 100px; /* Tăng nhẹ cho tablet */
    }

    body {
        background-attachment: fixed;
    }

    .document-buttons {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
    }

    .video-container {
        max-width: 800px;
    }
}

/* Desktop: Tối ưu cho màn hình lớn */
@media (min-width: 1024px) {
    :root {
        --hero-offset: 250px; /* Tăng khoảng cách cho laptop/desktop */
    }

    .document-buttons {
        max-width: 900px;
    }

    .video-container {
        max-width: 900px;
    }
}

/* Large Desktop */
@media (min-width: 1440px) {
    :root {
        --hero-offset: 300px; /* Tăng thêm khoảng cách cho màn hình rất lớn */
    }

    .document-buttons {
        max-width: 1000px;
    }

    .video-container {
        max-width: 1000px;
    }
}

/* Landscape Mode cho Mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .background-wrapper {
        gap: clamp(12px, 6vh, 24px);
        padding-top: calc(clamp(18px, 6vh, 48px) + var(--hero-offset));
    }

    .video-container {
        max-width: 600px;
        padding: clamp(4px, 2vw, 8px);
    }

    .document-buttons {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }

    .doc-btn {
        padding: clamp(10px, 3vw, 16px);
    }
}

/* Modal responsive cho mobile */
@media (max-width: 767px) {
    .pdf-modal-content {
        height: 90vh;
        max-height: calc(100vh - 20px);
    }

    .pdf-header {
        padding: clamp(6px, 2vw, 12px) clamp(10px, 3vw, 16px);
    }

    .pdf-title {
        font-size: clamp(0.85rem, 2vw, 1rem);
    }

    .pdf-close {
        width: clamp(28px, 6vw, 32px);
        height: clamp(28px, 6vw, 32px);
        font-size: clamp(1.3rem, 3vw, 1.6rem);
    }
}

/* Small mobile screens - enable text wrapping for very long titles */
@media (max-width: 400px) {
    .doc-text {
        white-space: normal;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .doc-btn {
        align-items: flex-start;
        padding-top: clamp(14px, 5vw, 20px);
        padding-bottom: clamp(14px, 5vw, 20px);
    }

    .doc-icon {
        align-self: flex-start;
        margin-top: 2px;
    }

    /* Submenu buttons - keep ellipsis for very long text */
    .submenu-btn {
        font-size: clamp(0.75rem, 3vw, 0.9rem);
        padding: clamp(14px, 4vw, 18px);
        /* Giữ nguyên white-space: nowrap và text-overflow: ellipsis từ styles chính */
    }
}

/* Mobile landscape optimization */
@media (max-width: 767px) and (orientation: landscape) {
    .pdf-modal-content {
        height: 85vh;
        max-height: calc(100vh - 25px);
    }

    .pdf-header {
        padding: clamp(4px, 1.5vw, 8px) clamp(8px, 2.5vw, 14px);
    }

    .pdf-title {
        font-size: clamp(0.8rem, 1.8vw, 0.95rem);
    }

    .pdf-close {
        width: clamp(24px, 5vw, 28px);
        height: clamp(24px, 5vw, 28px);
        font-size: clamp(1.2rem, 2.8vw, 1.4rem);
    }
}
