* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; }
body { background-color: #fdfaf0; color: #333; line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; height: 100vh; overflow: hidden; }

/* NAVBAR TRÊN CÙNG */
.top-navbar { height: 65px; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: grid; grid-template-columns: auto minmax(420px, 1fr) auto; align-items: center; gap: 24px; padding: 0 30px; z-index: 100; flex-shrink: 0; position: relative;}
.top-nav-logo { display: flex; align-items: center; min-width: 88px; }

/* Ép thanh menu ra chính giữa màn hình tuyệt đối */
.top-nav-links { min-width: 0; display: flex; justify-content: center; gap: clamp(18px, 2vw, 35px); font-weight: 700; font-size: 15px; white-space: nowrap;}
.top-nav-links a { text-decoration: none; color: #444; transition: 0.2s;}
.top-nav-links a:hover, .top-nav-links a.active { color: #ce1f28; }

.top-nav-right { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: clamp(10px, 1.2vw, 20px);}
.search-bar { background: #f0f2f5; border-radius: 30px; padding: 9px 20px; display: flex; align-items: center; width: clamp(170px, 14vw, 250px); min-width: 0; transition: 0.3s; border: 1px solid transparent;}
.search-bar:focus-within { background: white; border-color: #15397f; box-shadow: 0 0 8px rgba(21,57,127,0.1); }
.search-bar input { border: none; background: transparent; outline: none; margin-left: 10px; width: 100%; font-size: 13px;}

.user-profile-top { min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 14px; color: #15397f; cursor: pointer;}
.user-profile-top span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vip-top-entry { position: relative; display: none; align-items: center; }
.vip-toggle-btn {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #f1c7cb;
    border-radius: 999px;
    background: #fff5f6;
    color: #ce1f28;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s ease;
}
.vip-toggle-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(206,31,40,0.12); }
.vip-popover {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 360px;
    padding: 18px;
    border: 1px solid #f0d5d8;
    border-radius: 18px;
    background: white;
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.14);
    display: none;
    z-index: 220;
}
.vip-popover.open { display: block; }
.vip-popover-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.vip-popover-head strong { color: #15397f; font-size: 16px; }
.vip-popover-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f6f7fb;
    color: #667085;
    font-size: 16px;
    cursor: pointer;
}
.vip-popover-note {
    margin: 0 0 14px;
    color: #667085;
    font-size: 13px;
    line-height: 1.6;
}
.vip-migration-box {
    display: none;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #f4d8dc;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff8f8, #ffffff);
}
.vip-migration-box.active { display: block; }
.vip-migration-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    color: #ce1f28;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vip-migration-code {
    padding: 12px 14px;
    border: 1px dashed #ce1f28;
    border-radius: 14px;
    background: #fff2f4;
    color: #ce1f28;
    font-size: 22px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.08em;
    word-break: break-word;
}
.vip-migration-list {
    margin: 10px 0 0;
    color: #475467;
    font-size: 13px;
    line-height: 1.7;
}
.vip-migration-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.vip-secondary-btn,
.vip-primary-btn {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s ease;
}
.vip-primary-btn {
    border: none;
    background: #ce1f28;
    color: white;
}
.vip-secondary-btn {
    border: 1px solid #d5dbe5;
    background: white;
    color: #15397f;
}
.vip-input-row { display: flex; gap: 10px; }
.vip-input-row input {
    flex: 1;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #d7dee8;
    border-radius: 12px;
    outline: none;
    font-size: 13px;
}
.vip-input-row input:focus {
    border-color: #15397f;
    box-shadow: 0 0 0 4px rgba(21,57,127,0.08);
}
.vip-feedback {
    min-height: 22px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
}
.vip-feedback.success { color: #1f8f55; }
.vip-feedback.error { color: #ce1f28; }

/* LAYOUT CHÍNH - 3 CỘT */
.dashboard-container { display: flex; flex: 1; overflow: hidden; }

/* CỘT TRÁI - MENU TOOL */
.sidebar-left { width: 260px; background: white; border-right: 1px solid #eee; padding: 25px 15px; overflow-y: auto; display: flex; flex-direction: column; box-shadow: 2px 0 10px rgba(0,0,0,0.02); z-index: 10; flex-shrink: 0;}
.user-brief { display: flex; align-items: center; gap: 12px; padding: 0 10px 20px 10px; border-bottom: 1px solid #eee; margin-bottom: 25px;}
.user-brief img { width: 50px; height: 50px; border-radius: 50%; border: 2px solid #ce1f28; padding: 2px; object-fit: cover;}
.sidebar-menu { list-style: none; flex: 1;}
.sidebar-title { font-size: 13px; color: #999; text-transform: uppercase; margin: 15px 0 10px 15px; font-weight: 800; letter-spacing: 1px;}
.sidebar-menu li a { display: flex; align-items: center; gap: 15px; padding: 14px 15px; color: #444; text-decoration: none; border-radius: 10px; font-weight: 600; transition: 0.3s; font-size: 15px;}
.sidebar-menu li a:hover, .sidebar-menu li a.active { background: #fff2f4; color: #ce1f28; transform: translateX(5px); }
.sidebar-menu li a i { width: 22px; text-align: center; font-size: 18px; }

/* CỘT GIỮA - BANNER & SLOGAN */
.main-content { flex: 1; padding: 40px 50px; overflow-y: auto; display: flex; flex-direction: column; justify-content: center;}
.banner-hero { width: 100%; border-radius: 20px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.08); margin-bottom: 30px; background: white;}
.banner-hero img { width: 100%; max-height: 500px; object-fit: cover; display: block;}
.slogan-box { text-align: center; padding: 30px; background: white; border-radius: 16px; box-shadow: 0 5px 20px rgba(0,0,0,0.04); border-left: 6px solid #ce1f28; border-right: 6px solid #15397f;}
.slogan-text { font-size: 26px; font-weight: 900; background: linear-gradient(90deg, #ce1f28, #15397f); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 0.5px;}
.slogan-sub { color: #666; font-size: 16px; margin-top: 10px; font-weight: 500;}

/* CỘT PHẢI - CHỌN KỲ THI */
.sidebar-right { width: 320px; background: transparent; padding: 40px 20px; overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column; gap: 25px;}
.sidebar-right-title { font-size: 16px; color: #15397f; font-weight: 900; text-transform: uppercase; border-bottom: 2px solid #ccc; padding-bottom: 10px; margin-bottom: 5px; text-align: center;}

.portal-card { background: white; border-radius: 16px; padding: 25px 20px; text-align: center; box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: all 0.3s ease; border: 2px solid transparent;}
.portal-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.portal-card:hover.card-hsa { border-color: #27ae60; }
.portal-card:hover.card-tsa { border-color: #ce1f28; }

.portal-logo { width: 80%; max-height: 70px; margin-bottom: 15px; object-fit: contain;}
.portal-title { font-size: 18px; color: #111; margin-bottom: 10px; font-weight: 900;}
.portal-desc { color: #666; font-size: 13px; margin-bottom: 20px; line-height: 1.5;}

.btn-portal { padding: 12px 20px; border-radius: 8px; font-weight: bold; text-decoration: none; transition: 0.3s; font-size: 14px; width: 100%; display: flex; justify-content: center; align-items: center; gap: 8px;}
.btn-hsa { background: #ebf7ed; color: #27ae60; border: 1px solid #27ae60;}
.btn-hsa:hover { background: #27ae60; color: white;}
.btn-tsa { background: #fce8e9; color: #ce1f28; border: 1px solid #ce1f28;}
.btn-tsa:hover { background: #ce1f28; color: white;}

@media (max-width: 1280px) {
    .top-navbar {
        height: auto;
        min-height: 65px;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "logo right"
            "nav nav";
        row-gap: 8px;
        padding: 10px 20px;
    }

    .top-nav-logo { grid-area: logo; }
    .top-nav-links { grid-area: nav; justify-content: center; padding-bottom: 2px; }
    .top-nav-right { grid-area: right; }
    .search-bar { width: min(260px, 32vw); }
    .sidebar-left { width: 230px; }
    .sidebar-right { width: 290px; }
    .main-content { padding: 30px; }
}

@media (max-width: 980px) {
    body {
        height: auto;
        overflow: auto;
    }

    .top-navbar {
        position: sticky;
        top: 0;
        grid-template-columns: auto 1fr;
        padding: 10px 16px;
    }

    .top-nav-links {
        justify-content: flex-start;
        gap: 22px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .top-nav-links::-webkit-scrollbar { display: none; }
    .search-bar { display: none; }
    #auth-buttons { flex-wrap: nowrap; }
    #auth-buttons a { padding: 7px 12px !important; font-size: 12px !important; }

    .dashboard-container {
        flex-direction: column;
        overflow: visible;
    }

    .main-content {
        order: 1;
        padding: 24px 18px;
        overflow: visible;
        justify-content: flex-start;
    }

    .sidebar-right {
        order: 2;
        width: 100%;
        padding: 0 18px 24px;
        overflow: visible;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .sidebar-right-title { grid-column: 1 / -1; }

    .sidebar-left {
        order: 3;
        width: 100%;
        max-height: none;
        border-top: 1px solid #eee;
        border-right: none;
        padding: 18px;
        overflow: visible;
    }

    .sidebar-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .sidebar-title {
        grid-column: 1 / -1;
        margin: 10px 0 4px 6px;
    }

    .banner-hero img { max-height: none; }
    .slogan-text { font-size: 22px; line-height: 1.25; }
}

@media (max-width: 640px) {
    .top-navbar { gap: 8px 12px; padding: 10px 12px; }
    .top-nav-logo img { height: 34px !important; }
    .top-nav-links { font-size: 13px; gap: 16px; }
    .top-nav-right { gap: 8px; }
    .top-nav-right > .fa-bell,
    .top-nav-right > div[style*="height: 25px"] { display: none; }
    .vip-toggle-btn { min-height: 36px; padding: 0 12px; font-size: 12px; }
    .vip-popover { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; max-height: calc(100vh - 90px); overflow: auto; }
    .user-profile-top span { max-width: 96px; }

    .main-content { padding: 18px 12px; }
    .slogan-box { padding: 20px 14px; }
    .slogan-text { font-size: 19px; }
    .slogan-sub { font-size: 14px; }
    .sidebar-right { grid-template-columns: 1fr; padding: 0 12px 18px; }
    .portal-card { padding: 20px 16px; }
    .sidebar-left { padding: 14px 12px 20px; }
    .sidebar-menu { grid-template-columns: 1fr; }
}
