/* halloween.css — Giao diện Lễ Hội Halloween & Hiệu Ứng Ma/Dơi Sinh Động
   ĐẶC BIỆT: Tất cả hiệu ứng nền/sticker đều có pointer-events: none !important
   để KHÔNG cản trở hoặc làm khó thao tác bấm, gõ chữ hay cuộn trang của khách hàng! */

/* ─── Lớp Phủ Hiệu Ứng Nền (Ambient Halloween Layer) ─── */
.halloween-ambient-layer {
    position: fixed;
    inset: 0;
    pointer-events: none !important; /* KHÔNG cản trở thao tác người dùng */
    z-index: 50; /* Dưới các modal và nút bấm tương tác */
    overflow: hidden;
    user-select: none;
}

/* ─── Mạng Nhện Góc Màn Hình (Delicate Cobwebs) ─── */
.cobweb-top-left {
    position: absolute;
    top: 0;
    left: 0;
    width: 140px;
    height: 140px;
    background-image: radial-gradient(circle at 0% 0%, transparent 20%, rgba(139, 92, 246, 0.15) 21%, transparent 22%),
                      radial-gradient(circle at 0% 0%, transparent 40%, rgba(139, 92, 246, 0.15) 41%, transparent 42%),
                      radial-gradient(circle at 0% 0%, transparent 60%, rgba(139, 92, 246, 0.15) 61%, transparent 62%),
                      radial-gradient(circle at 0% 0%, transparent 80%, rgba(139, 92, 246, 0.12) 81%, transparent 82%);
    border-right: 1px dashed rgba(139, 92, 246, 0.2);
    border-bottom: 1px dashed rgba(139, 92, 246, 0.2);
    opacity: 0.7;
    pointer-events: none !important;
}

.cobweb-top-right {
    position: absolute;
    top: 0;
    right: 0;
    width: 140px;
    height: 140px;
    background-image: radial-gradient(circle at 100% 0%, transparent 20%, rgba(255, 117, 24, 0.15) 21%, transparent 22%),
                      radial-gradient(circle at 100% 0%, transparent 40%, rgba(255, 117, 24, 0.15) 41%, transparent 42%),
                      radial-gradient(circle at 100% 0%, transparent 60%, rgba(255, 117, 24, 0.15) 61%, transparent 62%),
                      radial-gradient(circle at 100% 0%, transparent 80%, rgba(255, 117, 24, 0.12) 81%, transparent 82%);
    border-left: 1px dashed rgba(255, 117, 24, 0.2);
    border-bottom: 1px dashed rgba(255, 117, 24, 0.2);
    opacity: 0.7;
    pointer-events: none !important;
}

/* ─── Sticker Dơi Bay (Animated Floating Bats) ─── */
.floating-bat {
    position: absolute;
    font-size: 24px;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.9));
    pointer-events: none !important;
    animation: flyBat 18s linear infinite;
    opacity: 0.85;
}

@keyframes flyBat {
    0% {
        transform: translate(-10vw, 15vh) rotate(5deg) scale(0.8);
    }
    25% {
        transform: translate(25vw, 8vh) rotate(-10deg) scale(1.1);
    }
    50% {
        transform: translate(60vw, 22vh) rotate(8deg) scale(0.9);
    }
    75% {
        transform: translate(85vw, 12vh) rotate(-5deg) scale(1.2);
    }
    100% {
        transform: translate(110vw, 18vh) rotate(10deg) scale(0.8);
    }
}

/* ─── Sticker Bóng Ma Trôi (Ghost Hovering) ─── */
.floating-ghost {
    position: absolute;
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.6));
    pointer-events: none !important;
    animation: floatGhost 14s ease-in-out infinite alternate;
    opacity: 0.75;
}

@keyframes floatGhost {
    0% {
        transform: translate(85vw, 65vh) scale(0.9);
        opacity: 0.5;
    }
    50% {
        transform: translate(88vw, 45vh) scale(1.15);
        opacity: 0.85;
    }
    100% {
        transform: translate(82vw, 25vh) scale(1);
        opacity: 0.6;
    }
}

/* ─── Quả Bí Ngô Lập Lòe (Jack-O'-Lantern Glow) ─── */
.flickering-pumpkin {
    position: fixed;
    bottom: 24px;
    left: 24px;
    font-size: 32px;
    pointer-events: none !important;
    animation: pumpkinFlicker 3s infinite;
    filter: drop-shadow(0 0 12px rgba(255, 117, 24, 0.7));
    z-index: 60;
}

@keyframes pumpkinFlicker {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 14px rgba(255, 117, 24, 0.8));
    }
    50% {
        transform: scale(1.06) rotate(3deg);
        filter: drop-shadow(0 0 22px rgba(255, 117, 24, 1));
    }
}

/* ─── Điểm Nhấn Thẻ Halloween (Card Halloween Styling) ─── */
body.halloween-active .converter-card {
    border-color: rgba(255, 117, 24, 0.35);
    box-shadow: 0 4px 24px rgba(255, 117, 24, 0.08);
}

body.halloween-active .balance-card.available {
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.12);
}

body.halloween-active .balance-card.holding {
    box-shadow: 0 0 16px rgba(255, 117, 24, 0.12);
}

body.halloween-active .tab-btn.active {
    color: var(--pumpkin);
    text-shadow: 0 0 8px var(--pumpkin-glow);
}

/* Tắt toàn bộ hiệu ứng khi người dùng tắt công tắc */
body.halloween-disabled .halloween-ambient-layer,
body.halloween-disabled .flickering-pumpkin {
    display: none !important;
}

/* V14 responsive hardening: force a real left drawer on narrow screens. */
html { width:100%; max-width:100%; overflow-x:hidden; }
body { width:100%; max-width:100%; overflow-x:clip; }
img, video, canvas, iframe { max-width:100%; }
input, select, textarea, button { max-width:100%; }
@media (max-width: 760px) {
  .app-header { width:100%; min-width:0; flex-wrap:wrap; align-items:flex-start; position:relative; }
  .header-left { min-width:0; flex:1 1 auto; }
  .brand { min-width:0; }
  .brand-sub { display:none; }
  .header-controls { min-width:0; flex:0 1 auto; margin-left:auto; max-width:100% !important; justify-content:flex-end; flex-wrap:wrap; }
  .user-pill { min-width:0; max-width:100%; justify-content:flex-start !important; padding:5px 10px; }
  #btn-logout { display:none !important; } /* đăng xuất nằm trong hộp "Tài khoản" trên điện thoại */
  .main-container { width:100% !important; max-width:100% !important; min-width:0; padding:12px !important; }
  .balance-summary-grid { min-width:0; grid-template-columns:minmax(0,1fr) !important; }
  .mobile-menu-toggle { display:inline-flex !important; min-height:40px; align-items:center; gap:8px; margin:0 !important; font-size:14px; touch-action:manipulation; }
  #main-tabs-nav.tabs-nav {
    display:flex !important; position:fixed !important; inset:0 auto 0 0 !important;
    width:min(84vw,340px) !important; max-width:calc(100vw - 48px) !important;
    height:100dvh !important; max-height:100vh !important; box-sizing:border-box !important;
    padding:76px 14px 24px !important; margin:0 !important; gap:7px !important;
    flex-direction:column !important; align-items:stretch !important; overflow-y:auto !important;
    overflow-x:hidden !important; border:0 !important; border-right:1px solid var(--border-color) !important;
    background:var(--bg-surface) !important; z-index:10005 !important;
    transform:translate3d(-110%,0,0) !important; visibility:hidden; pointer-events:none;
    transition:transform .22s ease, visibility .22s ease !important;
  }
  #main-tabs-nav.tabs-nav.mobile-open {
    transform:translate3d(0,0,0) !important; visibility:visible !important; pointer-events:auto !important;
  }
  #main-tabs-nav .tab-btn { display:flex !important; width:100% !important; min-height:46px; flex:0 0 auto; justify-content:flex-start !important; white-space:normal !important; text-align:left !important; margin:0 !important; border-radius:10px !important; }
  #main-tabs-nav .tab-btn.active::after { display:none !important; }
  #mobile-menu-backdrop.visible { display:block !important; position:fixed !important; inset:0 !important; z-index:10004 !important; background:rgba(0,0,0,.58) !important; }
  .input-link, input, select, textarea { font-size:16px !important; }
  .input-group { display:flex; flex-direction:column; width:100%; min-width:0; }
  .input-group > * { width:100%; min-width:0; }
  .converter-card, .admin-card, .balance-card, .modal-content { min-width:0; max-width:100%; }
  .admin-subnav { display:flex; flex-wrap:wrap; overflow:visible !important; }
  table { min-width:620px; }
}
@media (max-width:380px) {
  .brand-title { font-size:14px !important; }
  .brand-tag { display:none; }
  .app-header { padding:10px !important; }
  .main-container { padding:10px !important; }
}

/* V19 — illustrated atmospheric scene, glass surfaces, compact layout.
   The artwork is a single quiet landscape, never a layer of emoji stickers. */
body.halloween-active {
    --bg-dark: #211d36;
    --bg-surface: rgba(34, 29, 51, .72);
    --bg-surface-2: rgba(48, 39, 66, .74);
    --bg-card: rgba(37, 31, 54, .68);
    --border-color: rgba(255, 222, 232, .22);
    --border-light: rgba(255, 232, 238, .38);
    background: #211d36 url('/static/images-bg.svg') center center / cover fixed no-repeat !important;
    background-attachment: fixed !important;
}
/* Keep the scene behind every interactive surface. */
body.halloween-active .halloween-ambient-layer {
    z-index: 0 !important;
    opacity: .42;
}
body.halloween-active .app-header,
body.halloween-active .main-container,
body.halloween-active footer {
    position: relative;
    z-index: 1;
}
body.halloween-active .app-header {
    background: rgba(29, 25, 45, .72) !important;
    border-bottom-color: rgba(255, 225, 235, .22) !important;
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
}
body.halloween-active .converter-card,
body.halloween-active .admin-card,
body.halloween-active .balance-card,
body.halloween-active .kpi-card,
body.halloween-active .tabs-nav,
body.halloween-active .modal-card {
    background: rgba(37, 31, 54, .66) !important;
    border-color: rgba(255, 225, 235, .25) !important;
    box-shadow: 0 8px 26px rgba(12, 10, 24, .16), inset 0 1px rgba(255,255,255,.08);
    backdrop-filter: blur(14px) saturate(125%);
    -webkit-backdrop-filter: blur(14px) saturate(125%);
}
body.halloween-active .balance-card.available,
body.halloween-active .balance-card.holding,
body.halloween-active .balance-card.pending {
    background: rgba(42, 35, 60, .64) !important;
}
body.halloween-active .tabs-nav { background: rgba(31, 27, 48, .9) !important; }
body.halloween-active .tab-btn { background: transparent; }
body.halloween-active .tab-btn.active { background: rgba(255, 117, 24, .14); }

/* Tighter spacing: more information visible without shrinking tap targets. */
body.halloween-active .main-container { padding: 18px 16px !important; }
body.halloween-active .balance-grid,
body.halloween-active .balance-summary-grid { gap: 11px !important; margin-bottom: 16px !important; }
body.halloween-active .balance-card { padding: 14px 15px !important; border-radius: 13px !important; }
body.halloween-active .balance-title { font-size: 11.5px !important; margin-bottom: 5px !important; }
body.halloween-active .balance-amount { font-size: 22px !important; }
body.halloween-active .converter-card,
body.halloween-active .admin-card { padding: 18px !important; margin-bottom: 15px !important; border-radius: 14px !important; }
body.halloween-active .converter-title { font-size: 18px !important; }
body.halloween-active .kpi-row { gap: 10px !important; margin-bottom: 15px !important; }
body.halloween-active .kpi-card { padding: 12px !important; }
body.halloween-active .btn-copy,
body.halloween-active .btn-convert { min-height: 38px; }

@media (max-width: 760px) {
    body.halloween-active .main-container { padding: 12px 10px !important; }
    body.halloween-active .balance-grid,
    body.halloween-active .balance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
    body.halloween-active .balance-card { padding: 11px !important; }
    body.halloween-active .balance-amount { font-size: 19px !important; }
    body.halloween-active .balance-title { font-size: 10.5px !important; }
    body.halloween-active .converter-card,
    body.halloween-active .admin-card { padding: 13px !important; margin-bottom: 11px !important; }
    body.halloween-active .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; }
}
@media (max-width: 360px) {
    body.halloween-active .balance-grid,
    body.halloween-active .balance-summary-grid { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
    body.halloween-active *, body.halloween-active *::before, body.halloween-active *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* V24 ambient visibility tuning */
.halloween-ambient-layer .hfx-bat,.halloween-ambient-layer .hfx-ghost,.halloween-ambient-layer .hfx-wisp{pointer-events:none!important}
