/**
 * Theme Mùa Vọng — tím dịu Advent, ngôi sao, vòng nến.
 * Bật khi html.theme-mua-vong; tắt khi html.mv-theme-off.
 */

html.theme-mua-vong {
    --mv-purple: #5b2178;
    --mv-lilac: #c9b0dc;
    --mv-soft: #efe6f7;
    --mv-ink: #3d1868;
    --mv-gold: #f59e0b;
    --mv-rose: #ec4899;
}

/* Topbar đổi sang tím Mùa Vọng */
html.theme-mua-vong .app-topbar {
    background: linear-gradient(135deg, #3d1868 0%, #5b2178 42%, #7c3aed 78%, #a78bfa 100%) !important;
    box-shadow: 0 8px 24px rgba(61, 24, 104, .28) !important;
}
html.theme-mua-vong .app-topbar .app-dd-item i { color: #5b2178; }
html.theme-mua-vong .app-topbar .app-dd-item:hover { background: #f3eaf8; color: #3d1868; }
html.theme-mua-vong .app-topbar .app-dd-item.active { background: #5b2178; color: #fff; }
html.theme-mua-vong .app-topbar .app-dd-item.active i { color: #fff; }
@media (min-width: 992px) {
    html.theme-mua-vong .app-topbar .app-dd-menu {
        box-shadow: 0 12px 32px rgba(61, 24, 104, .28);
    }
}

/* Nền trang dịu tím (không đè trang đã có scene riêng) */
html.theme-mua-vong body:not(:has(.mv-scene)) {
    background:
        radial-gradient(ellipse 70% 50% at 12% 0%, rgba(221, 198, 240, .55), transparent 55%),
        radial-gradient(ellipse 60% 45% at 92% 8%, rgba(253, 230, 138, .22), transparent 50%),
        linear-gradient(160deg, #f8f4fb 0%, #efe6f7 48%, #e8dff3 100%) !important;
}

/* Fallback khi :has không hỗ trợ */
@supports not selector(:has(*)) {
    html.theme-mua-vong body {
        background:
            radial-gradient(ellipse 70% 50% at 12% 0%, rgba(221, 198, 240, .45), transparent 55%),
            linear-gradient(160deg, #f8f4fb 0%, #efe6f7 48%, #e8dff3 100%);
    }
}

/* Lớp trang trí cố định */
.mv-decor {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
html.mv-theme-off .mv-decor { display: none !important; }
html:not(.theme-mua-vong) .mv-decor { display: none !important; }

.mv-decor-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .9;
}

/* Trang Chiến Dịch đã có mv-scene → giảm lớp trang trí site */
body:has(.mv-scene) .mv-decor-bg { opacity: .22; }
body:has(.mv-scene) .mv-corner { opacity: .35; }

.mv-corner {
    position: absolute;
    z-index: 1;
    opacity: .85;
    filter: drop-shadow(0 6px 14px rgba(91, 33, 120, .18));
}
.mv-corner svg { display: block; width: 100%; height: auto; }
.mv-corner-bl {
    left: -6px;
    bottom: -4px;
    width: min(150px, 28vw);
}
.mv-corner-tr {
    right: 8px;
    top: 64px;
    width: min(88px, 18vw);
}
@media (max-width: 767.98px) {
    .mv-corner-bl { width: min(112px, 34vw); }
    .mv-corner-tr { width: min(64px, 16vw); top: 58px; opacity: .7; }
}

/* Chip Mùa Vọng — bật/tắt trang trí */
.mv-chip-wrap {
    position: fixed;
    right: 12px;
    bottom: 14px;
    z-index: 1045;
}
html:not(.theme-mua-vong):not(.mv-theme-off) .mv-chip-wrap { display: none; }
.mv-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 0;
    cursor: pointer;
    font-family: 'Nunito', system-ui, sans-serif;
    font-weight: 800;
    font-size: .78rem;
    color: #3d1868;
    background: linear-gradient(135deg, #f3eaf8, #efe0ff);
    border: 1.5px solid #c9b0dc;
    border-radius: 999px;
    padding: .42rem .7rem .42rem .45rem;
    box-shadow: 0 8px 22px rgba(91, 33, 120, .18);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.mv-chip:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(91, 33, 120, .24); }
.mv-chip-ic {
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #5b2178; color: #fde68a; font-size: .72rem;
}
html.mv-theme-off .mv-chip {
    opacity: .72;
    background: #fff;
    color: #5c4674;
    border-color: #ddd0e8;
}
html.mv-theme-off .mv-chip-ic { background: #9b87b0; color: #fff; }
html.mv-theme-off .mv-chip-txt::after { content: ' (tắt)'; font-weight: 700; opacity: .75; }

@media (max-width: 575.98px) {
    .mv-chip-txt { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mv-chip-wrap { right: 8px; bottom: 10px; }
}

/* Đưa nội dung lên trên lớp trang trí */
html.theme-mua-vong .app-topbar,
html.theme-mua-vong main,
html.theme-mua-vong .container,
html.theme-mua-vong .login-card,
html.theme-mua-vong .toast-result,
html.theme-mua-vong .lc-topbar,
html.theme-mua-vong .lc-main {
    position: relative;
    z-index: 1;
}
html.theme-mua-vong .app-topbar,
html.theme-mua-vong .lc-topbar { z-index: 1030; }

html.theme-mua-vong .lc-topbar {
    background: linear-gradient(135deg, #3d1868, #5b2178 55%, #7c3aed) !important;
}

/* Card / panel dịu hơn trên nền tím */
html.theme-mua-vong .stat-card,
html.theme-mua-vong .qr-card,
html.theme-mua-vong .panel,
html.theme-mua-vong .camp-card,
html.theme-mua-vong .board {
    box-shadow: 0 10px 28px rgba(91, 33, 120, .08);
}

/* Login Mùa Vọng */
html.theme-mua-vong body.mv-login {
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(167, 139, 250, .4), transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 85%, rgba(91, 33, 120, .35), transparent 50%),
        linear-gradient(145deg, #3d1868 0%, #5b2178 40%, #6d28d9 100%) !important;
}
html.theme-mua-vong body.mv-login .login-bg-shape-1 { background: #c4b5fd !important; }
html.theme-mua-vong body.mv-login .login-bg-shape-2 { background: #f59e0b !important; opacity: .35; }
html.theme-mua-vong body.mv-login .btn-login,
html.theme-mua-vong body.mv-login button[type="submit"] {
    background: linear-gradient(135deg, #5b2178, #7c3aed) !important;
}

@media print {
    .mv-decor,
    .mv-chip-wrap { display: none !important; }
    html.theme-mua-vong body {
        background: #fff !important;
    }
}
