/* VASKA storefront presentation layer: account popover, theme affordance and seasonal decoration. */
:root,
:root[data-theme="light"] {
    --vaska-theme-control-bg: rgba(255,255,255,.72);
    --vaska-theme-control-fg: #4b2e89;
    --vaska-account-popover-bg: #fbfaff;
    --vaska-account-card-bg: linear-gradient(145deg,#fff,#f6f1ff);
    --vaska-account-card-border: #e2d8f1;
    --vaska-seasonal-shadow: rgba(255,255,255,.92);
}

:root[data-theme="dark"] {
    --vaska-theme-control-bg: rgba(19,28,54,.8);
    --vaska-theme-control-fg: #f4d77b;
    --vaska-account-popover-bg: #10182d;
    --vaska-account-card-bg: linear-gradient(145deg,#172340,#1a2644);
    --vaska-account-card-border: rgba(151,169,226,.3);
    --vaska-seasonal-shadow: rgba(239,245,255,.88);
}

/* The account keeps Bootstrap's accessible offcanvas events, but renders as a compact popover. */
#accountDrawer.account-drawer {
    width: min(94vw, 390px) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(82dvh, 720px) !important;
    top: var(--vaska-account-top, 72px) !important;
    right: var(--vaska-account-right, 16px) !important;
    bottom: auto !important;
    left: auto !important;
    border: 1px solid var(--dx-border-strong) !important;
    border-radius: 24px !important;
    background: var(--vaska-account-popover-bg) !important;
    box-shadow: 0 24px 70px rgba(26,18,61,.28) !important;
    overflow: hidden !important;
    transform: translate3d(110%,0,0) !important;
}

#accountDrawer.account-drawer.show {
    transform: translate3d(0,0,0) !important;
}

#accountDrawer .account-drawer-body {
    display: grid !important;
    gap: 10px !important;
    max-height: min(82dvh, 720px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 12px !important;
    scrollbar-width: thin;
}

#accountDrawer .account-drawer-balance-card {
    border-radius: 19px !important;
    padding: 12px !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 9px 24px rgba(39,44,116,.18) !important;
}

#accountDrawer .account-drawer-avatar {
    width: 40px !important;
    height: 40px !important;
    flex-basis: 40px !important;
}

#accountDrawer .account-drawer-user-row {
    padding-right: 42px !important;
}

#accountDrawer .account-drawer-identity-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

#accountDrawer .account-drawer-username {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#accountDrawer .account-drawer-settings,
#accountDrawer .account-drawer-theme-toggle,
#accountDrawer .account-drawer-close {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    flex-basis: 36px !important;
    display: inline-grid;
    place-items: center;
    border-radius: 11px !important;
}

#accountDrawer .account-drawer-theme-toggle {
    border: 1px solid rgba(255,255,255,.24);
    background: var(--vaska-theme-control-bg);
    color: var(--vaska-theme-control-fg);
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease, color .18s ease;
}

#accountDrawer .account-drawer-theme-toggle:hover,
#accountDrawer .account-drawer-theme-toggle:focus-visible {
    background: color-mix(in srgb, var(--vaska-theme-control-bg) 76%, #a889ff);
    transform: translateY(-1px);
}

#accountDrawer .account-drawer-theme-toggle .theme-icon-sun,
#accountDrawer .account-drawer-theme-toggle[data-theme="light"] .theme-icon-moon { display: none; }
#accountDrawer .account-drawer-theme-toggle[data-theme="light"] .theme-icon-sun { display: inline; }

#accountDrawer .account-drawer-close {
    right: 10px !important;
    top: 10px !important;
}

#accountDrawer .account-drawer-wallet-row {
    gap: 8px !important;
}

#accountDrawer .account-drawer-wallet-column,
#accountDrawer .account-drawer-vcoin {
    min-height: 76px !important;
}

#accountDrawer .account-drawer-wallet-action {
    min-height: 36px !important;
}

#accountDrawer .account-drawer-nav {
    gap: 8px !important;
}

#accountDrawer .account-drawer-grid-card {
    min-height: 82px !important;
    grid-template-rows: 30px auto !important;
    gap: 6px !important;
    padding: 9px !important;
    border-radius: 15px !important;
    border-color: var(--vaska-account-card-border) !important;
    background: var(--vaska-account-card-bg) !important;
}

#accountDrawer .account-drawer-grid-icon {
    width: 30px !important;
    height: 30px !important;
    border-radius: 9px !important;
}

#accountDrawer .account-drawer-grid-icon svg { width: 17px; height: 17px; }
#accountDrawer .account-drawer-grid-label { font-size: 12px !important; color: var(--dx-text-strong) !important; }
#accountDrawer .account-drawer-grid-action,
#accountDrawer .account-drawer-grid-subtitle { font-size: 9px !important; color: var(--dx-muted) !important; }

#accountDrawer .account-drawer-logout {
    min-height: 46px !important;
    border-radius: 14px !important;
    padding: 8px 10px !important;
}

@media (max-width: 991.98px) {
    #accountDrawer.account-drawer {
        width: auto !important;
        max-width: none !important;
        min-height: 0 !important;
        top: auto !important;
        right: 10px !important;
        bottom: calc(var(--vaska-mobile-nav-height, 68px) + 10px) !important;
        left: 10px !important;
        max-height: calc(100dvh - var(--vaska-mobile-nav-height, 68px) - 28px) !important;
        transform: translate3d(0, 110%, 0) !important;
    }

    #accountDrawer.account-drawer.show { transform: translate3d(0,0,0) !important; }
    #accountDrawer .account-drawer-body { max-height: inherit !important; }
}

@media (prefers-reduced-motion: reduce) {
    #accountDrawer.account-drawer,
    #accountDrawer .account-drawer-theme-toggle,
    #accountDrawer .account-drawer-grid-card { transition: none !important; }
}

/* Seasonal product-card decorations are deliberately non-interactive. */

[data-seasonal-snow="1"] {
    border-top-color: var(--vaska-seasonal-shadow);
}

/* Keep the canvas above the page background and behind storefront content. */
html[data-seasonal-snowfall="1"] body { isolation: isolate; }
html[data-seasonal-snowfall="1"] :is(.cat-child-card, .cat-card, .epin-card-v2, .vaska-order-row) {
    background-color: var(--dx-surface, #fff);
}
/* One canvas is mounted by JS only when the server-side master/snowfall switches are on. */
#vaska-snowfall {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: .72;
}

@media (prefers-reduced-motion: reduce) {
    #vaska-snowfall { display: none !important; }
}

html[data-theme="dark"] .seasonal-snow-label { color: #eaf0ff; }
html[data-theme="light"] .seasonal-snow-label { color: #37415b; }

/* Final premium refinement: compact account header/actions and consistent
   storefront surfaces. These rules intentionally extend the existing token
   layer instead of introducing a second theme implementation. */
#accountDrawer.account-drawer {
    width: min(360px, calc(100vw - 20px)) !important;
    max-height: min(76dvh, 640px) !important;
    border-radius: 22px !important;
}

#accountDrawer .account-drawer-body {
    gap: 8px !important;
    padding: 10px !important;
    max-height: inherit !important;
}

#accountDrawer .account-drawer-balance-card {
    padding: 10px !important;
    border-radius: 18px !important;
}

#accountDrawer .account-drawer-user-row {
    min-height: 40px !important;
    padding-right: 0 !important;
    gap: 8px !important;
}

#accountDrawer .account-drawer-user { flex: 1 1 auto; min-width: 0; }
#accountDrawer .account-drawer-avatar,
#accountDrawer .account-drawer-avatar img,
#accountDrawer .account-drawer-avatar span {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
}

#accountDrawer .account-drawer-username { font-size: 15px !important; }
#accountDrawer .account-drawer-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex: 0 0 auto;
    margin-left: auto;
}

#accountDrawer .account-drawer-header-actions .account-drawer-settings,
#accountDrawer .account-drawer-header-actions .account-drawer-theme-toggle,
#accountDrawer .account-drawer-header-actions .account-drawer-close {
    position: static !important;
    inset: auto !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    flex-basis: 30px !important;
    border-radius: 9px !important;
}

#accountDrawer .account-drawer-header-actions .account-drawer-close {
    color: var(--dx-text-strong) !important;
    background: color-mix(in srgb, var(--dx-surface-2) 84%, transparent) !important;
    border: 1px solid var(--dx-border) !important;
}

#accountDrawer .account-drawer-wallet-row { gap: 6px !important; }
#accountDrawer .account-drawer-wallet-column,
#accountDrawer .account-drawer-vcoin { min-height: 64px !important; }
#accountDrawer .account-drawer-wallet-icon,
#accountDrawer .account-drawer-vcoin-icon { width: 22px !important; height: 22px !important; }
#accountDrawer .account-drawer-balance,
#accountDrawer .account-drawer-vcoin-value { font-size: 17px !important; }
#accountDrawer .account-drawer-balance-label,
#accountDrawer .account-drawer-vcoin-label { font-size: 10px !important; }
#accountDrawer .account-drawer-wallet-action { min-height: 30px !important; font-size: 10px !important; }

#accountDrawer .account-drawer-nav { gap: 6px !important; }
#accountDrawer .account-drawer-grid-card {
    min-height: 70px !important;
    grid-template-rows: 26px auto !important;
    gap: 4px !important;
    padding: 8px !important;
    border-radius: 13px !important;
}
#accountDrawer .account-drawer-grid-icon {
    width: 26px !important;
    height: 26px !important;
    border-radius: 8px !important;
}
#accountDrawer .account-drawer-grid-icon svg { width: 15px; height: 15px; }
#accountDrawer .account-drawer-grid-label { font-size: 11px !important; }
#accountDrawer .account-drawer-grid-action,
#accountDrawer .account-drawer-grid-subtitle { font-size: 8px !important; }
#accountDrawer .account-drawer-logout { min-height: 40px !important; padding: 6px 8px !important; border-radius: 12px !important; }
#accountDrawer .account-drawer-logout-icon { width: 28px !important; height: 28px !important; border-radius: 9px !important; }

@media (max-width: 991.98px) {
    #accountDrawer.account-drawer {
        width: min(360px, calc(100vw - 20px)) !important;
        left: auto !important;
        right: 10px !important;
        bottom: calc(var(--vaska-mobile-nav-height, 68px) + 10px) !important;
        max-height: calc(100dvh - var(--vaska-mobile-nav-height, 68px) - 22px) !important;
    }
}

@media (max-width: 360px) {
    #accountDrawer .account-drawer-body { padding: 8px !important; }
    #accountDrawer .account-drawer-grid-card { min-height: 66px !important; padding: 7px !important; }
    #accountDrawer .account-drawer-header-actions .account-drawer-settings,
    #accountDrawer .account-drawer-header-actions .account-drawer-theme-toggle,
    #accountDrawer .account-drawer-header-actions .account-drawer-close { width: 28px !important; height: 28px !important; min-width: 28px !important; }
}

/* Dark mode corrections for the surfaces that previously retained light
   gradients or dark foreground text. */
html[data-theme="dark"] header .site-desktop-header,
html[data-theme="dark"] header .site-topline,
html[data-theme="dark"] header .site-mainline,
html[data-theme="dark"] header .site-desktop-header .site-categories,
html[data-theme="dark"] .mobile-header,
html[data-theme="dark"] .headbar {
    background: var(--dx-header) !important;
    color: var(--dx-text) !important;
    border-color: var(--dx-border) !important;
}

html[data-theme="dark"] header .site-desktop-header .site-search:not(.homepage-search-container),
html[data-theme="dark"] header .site-desktop-header .site-search:not(.homepage-search-container) input,
html[data-theme="dark"] .mobile-header-search,
html[data-theme="dark"] .mobile-header-search .mobile-search-control,
html[data-theme="dark"] .mobile-header-search input {
    background: var(--dx-input) !important;
    color: var(--dx-text) !important;
    border-color: var(--dx-border) !important;
}

html[data-theme="dark"] header .site-desktop-header .site-search.homepage-search-container {
    background: linear-gradient(135deg, #101d42, #192f63 58%, #26245f) !important;
    border-color: var(--dx-border-strong) !important;
}

html[data-theme="dark"] .vaska-p1-content .vaska-category-grid-head__text h2,
html[data-theme="dark"] .vaska-p1-content .vaska-category-grid-head__text strong,
html[data-theme="dark"] .vaska-p1-content .home-product-title strong,
html[data-theme="dark"] .vaska-p1-content .epin-showcase-head strong,
html[data-theme="dark"] .vaska-category-grid-head__text h2 {
    color: var(--dx-text-strong) !important;
}

html[data-theme="dark"] .vaska-club-home-badge,
html[data-theme="dark"] .vaska-arena-home-badge {
    color: var(--dx-text-strong) !important;
    background: linear-gradient(135deg, #211d48, #29214f 68%, #3b2b5c) !important;
    border-color: color-mix(in srgb, var(--dx-accent) 56%, var(--dx-border-strong)) !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08) !important;
}

html[data-theme="dark"] .vaska-p1-content .vaska-category-grid-head__text span,
html[data-theme="dark"] .vaska-card-caption { color: var(--dx-muted) !important; }

html[data-theme="dark"] .cat-card,
html[data-theme="dark"] .epin-card-v2 {
    background: var(--dx-surface) !important;
    color: var(--dx-text) !important;
    border-color: var(--dx-border) !important;
}
html[data-theme="dark"] .cat-card-title,
html[data-theme="dark"] .epin-card-v2-title,
html[data-theme="dark"] .cat-card-price,
html[data-theme="dark"] .epin-card-v2-price strong,
html[data-theme="dark"] .home-storefront-card-title-text { color: var(--dx-text-strong) !important; }
html[data-theme="dark"] .cat-card-meta,
html[data-theme="dark"] .epin-card-v2-meta,
html[data-theme="dark"] .epin-card-v2-availability,
html[data-theme="dark"] .storefront-price-regular-label { color: var(--dx-muted) !important; }

/* Slightly stronger but still lightweight snowfall. */
#vaska-snowfall { opacity: .86; }
