﻿*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Segoe UI", Arial, sans-serif;
}

/* ===== TOP BAR ===== */
#topBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #7a1111;
    z-index: 9999;
}

/* ===== BANNER ===== */
.main-banner {
    height: 130px;
    background: linear-gradient(135deg,#6d0f0f,#b71c1c,#6d0f0f);
    border-bottom: 3px double #ffd54f;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
    text-align: center;
}

    .main-banner h1 {
        margin: 0;
        font-family: "Times New Roman", serif;
        font-size: clamp(24px, 4vw, 40px);
        font-weight: 900;
        line-height: 1.2;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        background: linear-gradient( to bottom, #fff6c2, #ffd54f 45%, #e0b73f 75%, #b08a1e );
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        text-shadow: 0 2px 2px rgba(0,0,0,0.6), 0 6px 12px rgba(255,215,0,0.45), 0 0 22px rgba(255,215,0,0.6);
    }



    .main-banner p {
        margin: 8px 0 0;
        font-size: 18px;
        color: #d6a25e;

        text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    }

/* ===== HAMBURGER ===== */
#hamburger {
    min-width: 40px; 
    width: auto;
    display: none;
    position: absolute;
    left: 20px;
    top: 90px;
    font-size: 30px;
    cursor: pointer;
    color: #FCFCFC;
    z-index: 10000;
}

/* -------------------------------------------------
             DESKTOP MODE (>768px)
             ------------------------------------------------- */
@media (min-width: 769px) {

    /* ===== MENU CHÍNH ===== */
    #mainMenu {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 5px;
        padding: 8px;
        background: linear-gradient(to right,#7a1111,#b71c1c,#7a1111);
        border-bottom: 3px solid #ffd54f;
        box-shadow: 0 4px 10px rgba(0,0,0,0.35);
        flex-wrap: wrap;
    }

        #mainMenu button {
            min-width: 130px; 
            width: auto;
            height: 30px !important;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 8px;
            border: 2px solid #ffd54f;
            background: linear-gradient(to bottom,#ffe9a8,#ffdb60);
            color: #7a1d1d;
            font-weight: 500;
            font-size: 0.75rem;
            white-space: nowrap;
            cursor: pointer;
        }

    .menu-item {
        position: relative;
    }

    /* ===== SUBMENU ===== */
    .submenu {
        position: absolute;
        left: 0;
        background: #6d0f0f;
        border: 2px solid #ffd54f;
        border-radius: 6px;
        padding: 6px;
        width: 195px; 
        display: flex;
        flex-direction: column; 
        gap: 6px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity .2s ease, transform .2s ease;
    }

    .menu-item:hover .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .submenu button {
        width: 180px !important; 
        height: 30px !important;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding-left: 6px;
        border: 2px solid #ffd54f;
        border-radius: 6px;
        gap: 10px;
        background: transparent;
        color: #ffd54f;
    }
}

/* -------------------------------------------------
             MOBILE MODE (<=768px)
             ------------------------------------------------- */
@media (max-width: 768px) {

    #hamburger {
        display: block;
    }

    #mainMenu {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        position: fixed;
        top: 150px;
        left: -100%;
        width: 100%;
        min-height: 150px;
        max-height: 50vh;
        overflow-y: auto;
        transition: left 0.32s ease;
        padding: 8px 0;
        background: linear-gradient(to bottom,#7a1111,#b71c1c);
    }

        #mainMenu.open {
            left: 0;
        }

    .menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    #mainMenu > .menu-item > button {
        width: 100%;
        text-align: left;
        padding: 6px 10px;
        margin-bottom: 3px;
        border-radius: 5px;
        border: 2px solid #ffd54f;
        background: linear-gradient(to bottom,#ffe9a8,#ffdb60);
        color: #7a1d1d;
        font-weight: 650;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .submenu {
        position: relative;
        background: transparent;
        margin: 0;
        padding-left: 15px;
        max-height: 0;
        overflow: hidden;
        transition: max-height .32s ease;
    }

    .menu-item.open .submenu {
        max-height: 600px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .submenu button {
        width: 100%;
        padding: 6px 10px;
        margin-bottom: 6px;
        border-radius: 6px;
        border: none;
        background: linear-gradient(to bottom,#ffe9a8,#ffdb60);
        color: #7a1d1d;
        text-align: left;
        font-weight: 700;
    }
}

/* MAIN CONTENT */
#mainContent {
    position: absolute;
    top: 150px;
    left: 0;
    width: 100%;
    height: calc(100vh - 150px);
    background: white;
}

@media(max-width:768px) {
    #mainContent {
        top: 90px;
        height: calc(100vh - 90px);
    }
}

#contentFrame {
    width: 100%;
    height: 100%;
    border: none;
}

html, body {
    overscroll-behavior: none; 
    touch-action: pan-y;
}

#contentFrame {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ===============================
             ⭐ EDGE ZONE để vuốt mở menu
             =============================== */
#edgeSwipeLeft {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px; 
    height: 100vh;
    z-index: 99999;
    touch-action: pan-x; 
}

#edgeSwipeRight {
    position: fixed;
    top: 0;
    right: 0;
    width: 20px;
    height: 100vh;
    z-index: 99999;
    touch-action: pan-x;
}
/* =====================================================
        LAPTOP FIX – APP TRUYỀN THỐNG
        Áp dụng cho laptop thấp (1366x768, 1440x900)
        ===================================================== */
@media (min-width: 1024px) and (max-height: 820px) {

    /* ===== BANNER THẤP XUỐNG ===== */
    .main-banner {
        height: 100px; /* ↓ từ 130px */
        padding: 6px;
    }

        .main-banner h1 {
            font-size: clamp(20px, 3vw, 32px);
            letter-spacing: 1.2px;
        }

        .main-banner p {
            font-size: 15px;
            margin-top: 4px;
        }

    /* ===== MENU CHÍNH GỌN LẠI ===== */
    #mainMenu {
        padding: 5px; /* ↓ thấp hơn */
        gap: 4px;
    }

        #mainMenu button {
            min-width: 110px; 
            height: 26px !important; 
            font-size: 0.82rem; 
            border-radius: 6px;
            padding: 0 6px;
        }

    .submenu {
        width: 170px; /* ↓ gọn */
        padding: 5px;
        gap: 5px;
    }

        .submenu button {
            width: 155px !important;
            height: 26px !important;
            font-size: 0.75rem;
            padding-left: 5px;
        }

    /* ===== HAMBURGER (nếu laptop hẹp) ===== */
    #hamburger {
        top: 70px; /* ↓ theo banner thấp */
        font-size: 28px;
    }

    /* ===== MAIN CONTENT TÍNH LẠI ===== */
    #mainContent {
        top: 125px; /* banner + menu mới */
        height: calc(100vh - 125px);
    }
}

/* =========================
   MOBILE YẾU – TỐI ƯU HIỆU NĂNG
   ========================= */
@media (max-width: 768px) {

    /* Giảm bóng & ánh kim */
    .main-banner h1 {
        text-shadow: none !important;
    }

    .main-banner p {
        text-shadow: none !important;
    }

    #mainMenu,
    #mainMenu button,
    .submenu button {
        box-shadow: none !important;
    }

    /* Menu trượt nhẹ hơn */
    #mainMenu {
        transition: left 0.15s linear !important;
    }

    /* Banner thấp hơn */
    .main-banner {
        height: 90px !important;
        padding: 4px !important;
    }

    /* Nội dung tính lại */
    #mainContent {
        top: 90px !important;
        height: calc(100vh - 90px) !important;
    }

    /* Font nhỏ hơn chút */
    .main-banner h1 {
        font-size: clamp(18px, 5vw, 26px) !important;
    }

    .main-banner p {
        font-size: 14px !important;
    }

    /* Bỏ overscroll nặng */
    html, body, #contentFrame {
        overscroll-behavior: auto !important;
    }
}

/* =========================
   LAPTOP THẤP (≤1366x768)
   ========================= */
@media (min-width: 769px) and (max-width: 1366px) and (max-height: 800px) {

    /* Banner gọn */
    .main-banner {
        height: 100px !important;
        padding: 6px !important;
    }

        .main-banner h1 {
            font-size: clamp(20px, 3vw, 32px) !important;
            letter-spacing: 1px !important;
        }

        .main-banner p {
            font-size: 15px !important;
        }

    /* Menu thấp lại */
    #mainMenu {
        padding: 4px !important;
    }

        #mainMenu button {
            min-width: 105px !important;
            height: 26px !important;
            font-size: 0.8rem !important;
        }

    .submenu {
        width: 170px !important;
    }

        .submenu button {
            width: 155px !important;
            height: 26px !important;
            font-size: 0.75rem !important;
        }

    /* Nội dung */
    #mainContent {
        top: 125px !important;
        height: calc(100vh - 125px) !important;
    }
}

/* =========================
   TẮT HIỆU ỨNG NẶNG TRÊN MÁY YẾU
   ========================= */
@media (max-width: 1024px) {

    .main-banner h1 {
        text-shadow: none !important;
    }

    #mainMenu button {
        background: #ffdb60 !important;
    }

    .submenu {
        transition: none !important;
    }
}
