/* ═══════════════════════════════════════════════════════════
   ThinhTrack — FUTURISTIC layer (v3)
   Mesh · Neon · Holographic · Motion
   ═══════════════════════════════════════════════════════════ */

:root {
    --font-display: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
    --font-body: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
    --neon-indigo: #818cf8;
    --neon-cyan: #22d3ee;
    --neon-violet: #c084fc;
    --neon-pink: #f472b6;
}

/* ── Ambient layers (HTML) ── */
.ambient-mesh,
.ambient-grid,
.ambient-glow {
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

.ambient-mesh {
    inset: -40%;
    background:
        radial-gradient(ellipse 40% 35% at 20% 30%, rgba(99, 102, 241, 0.28) 0%, transparent 55%),
        radial-gradient(ellipse 35% 30% at 75% 20%, rgba(34, 211, 238, 0.22) 0%, transparent 50%),
        radial-gradient(ellipse 45% 40% at 60% 75%, rgba(192, 132, 252, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 30% 25% at 10% 80%, rgba(244, 114, 182, 0.12) 0%, transparent 50%);
    filter: blur(40px);
    animation: meshFloat 18s ease-in-out infinite alternate;
}

.ambient-glow {
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
}

.ambient-glow--1 {
    width: 420px;
    height: 420px;
    top: -80px;
    right: -60px;
    background: rgba(99, 102, 241, 0.35);
    animation: orbPulse 8s ease-in-out infinite;
}

.ambient-glow--2 {
    width: 380px;
    height: 380px;
    bottom: -100px;
    left: -40px;
    background: rgba(34, 211, 238, 0.25);
    animation: orbPulse 11s ease-in-out infinite reverse;
}

.ambient-grid {
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 10%, transparent 75%);
    opacity: 0.7;
}

.cursor-glow {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(34, 211, 238, 0.05) 35%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
    mix-blend-mode: screen;
}

body.cursor-glow-active .cursor-glow {
    opacity: 1;
}

[data-theme="light"] .ambient-mesh {
    opacity: 0.55;
    filter: blur(50px);
}

[data-theme="light"] .ambient-grid {
    background-image:
        linear-gradient(rgba(79, 70, 229, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 70, 229, 0.06) 1px, transparent 1px);
}

@keyframes meshFloat {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    33% { transform: translate(3%, -2%) rotate(2deg) scale(1.04); }
    66% { transform: translate(-2%, 3%) rotate(-1deg) scale(1.02); }
    100% { transform: translate(2%, 1%) rotate(1deg) scale(1.05); }
}

@keyframes orbPulse {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.12); }
}

@keyframes neonPulse {
    0%, 100% { opacity: 0.6; filter: brightness(1); }
    50% { opacity: 1; filter: brightness(1.25); }
}

@keyframes shimmerSlide {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

@keyframes holoBorder {
    0% { --holo-angle: 0deg; }
    100% { --holo-angle: 360deg; }
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scanLine {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

/* ── Typography — Be Vietnam Pro (hỗ trợ tiếng Việt) ── */
html,
body,
body.app-interior,
body.auth-landing {
    font-family: var(--font-body);
}

body.app-interior h1,
body.auth-landing h1,
.game-catalog-header h1,
.page-header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text-heading);
    -webkit-text-fill-color: currentColor;
    background: none;
    animation: none;
}

.sidebar-brand strong,
.brand-copy strong {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.page-header h1,
.game-catalog-header h1,
.auth-landing-hero h1 {
    text-shadow: 0 0 48px rgba(99, 102, 241, 0.12);
}

/* ── Sidebar — neon edge ── */
body.app-interior .sidebar {
    position: relative;
    overflow: hidden;
}

body.app-interior .sidebar::before {
    content: "";
    position: absolute;
    top: 12%;
    left: 0;
    width: 3px;
    height: 30%;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, transparent, var(--neon-cyan), var(--neon-indigo), var(--neon-violet), transparent);
    box-shadow: 0 0 20px var(--neon-cyan), 0 0 40px rgba(99, 102, 241, 0.4);
    animation: neonPulse 3s ease-in-out infinite;
    z-index: 2;
}

body.app-interior .sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, transparent 40%, rgba(34, 211, 238, 0.04) 100%);
    pointer-events: none;
    z-index: 0;
}

body.app-interior .sidebar > * {
    position: relative;
    z-index: 1;
}

.nav-item.is-active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(34, 211, 238, 0.08) 100%) !important;
    border-color: rgba(99, 102, 241, 0.32) !important;
    box-shadow:
        0 0 16px rgba(99, 102, 241, 0.14),
        inset 0 0 12px rgba(34, 211, 238, 0.04) !important;
}

.nav-item.is-active .nav-icon-wrap {
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

/* ── Holographic panels ── */
.panel,
.page-header,
.auth-landing-panel,
.game-catalog-card:not(.is-soon),
.change-password-card {
    position: relative;
}

.panel::before,
.page-header::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        var(--holo-angle, 135deg),
        rgba(99, 102, 241, 0.5),
        rgba(34, 211, 238, 0.4),
        rgba(192, 132, 252, 0.35),
        rgba(99, 102, 241, 0.5)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.35;
    animation: holoSpin 8s linear infinite;
    pointer-events: none;
}

@property --holo-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes holoSpin {
    to { --holo-angle: 360deg; }
}

/* ── Game catalog — premium cards ── */
.game-catalog-card {
    transform-style: preserve-3d;
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.35s ease !important;
}

.game-catalog-card:hover {
    transform: translateY(-10px) scale(1.02) !important;
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(99, 102, 241, 0.3),
        0 0 60px rgba(99, 102, 241, 0.2),
        0 0 100px rgba(34, 211, 238, 0.1) !important;
}

.game-catalog-card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(6, 8, 14, 0.85) 100%);
    pointer-events: none;
}

.game-catalog-card-media img {
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.game-catalog-card:hover .game-catalog-card-media img {
    transform: scale(1.08);
}

.game-catalog-card-cta {
    opacity: 0.7 !important;
    transform: none !important;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
}

.game-catalog-card:hover .game-catalog-card-cta {
    opacity: 1 !important;
}

.game-catalog-grid {
    perspective: 1200px;
}

/* Stagger entrance */
.game-catalog-card {
    animation: riseIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.game-catalog-card:nth-child(1) { animation-delay: 0.05s; }
.game-catalog-card:nth-child(2) { animation-delay: 0.1s; }
.game-catalog-card:nth-child(3) { animation-delay: 0.15s; }
.game-catalog-card:nth-child(4) { animation-delay: 0.2s; }
.game-catalog-card:nth-child(5) { animation-delay: 0.25s; }
.game-catalog-card:nth-child(6) { animation-delay: 0.3s; }
.game-catalog-card:nth-child(n+7) { animation-delay: 0.35s; }

/* ── Metric cards — neon pulse ── */
.metric-card {
    overflow: hidden;
}

.metric-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(99, 102, 241, 0.08), transparent 30%);
    animation: holoSpin 6s linear infinite;
    pointer-events: none;
}

.metric-card strong {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem !important;
    letter-spacing: -0.02em;
    text-shadow: none;
}

.metric-card:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2), 0 12px 40px rgba(0, 0, 0, 0.3) !important;
}

/* ── Buttons — holographic CTA ── */
.btn-primary {
    position: relative;
    overflow: hidden;
    background-size: 200% auto !important;
    animation: shimmerSlide 4s linear infinite !important;
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.25) 50%, transparent 60%);
    transform: translateX(-100%);
    animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
    0%, 80%, 100% { transform: translateX(-100%); }
    40% { transform: translateX(100%); }
}

.auth-landing-pill-light,
.auth-landing-submit {
    animation: shimmerSlide 4s linear infinite !important;
    background-size: 200% auto !important;
}

/* ── Tables — cyber rows ── */
.accounts-table-wrap {
    position: relative;
    overflow: hidden;
}

.accounts-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(34, 211, 238, 0.05)) !important;
    box-shadow: inset 3px 0 0 var(--neon-cyan);
}

.accounts-table thead th {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04)) !important;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2) !important;
}

/* ── Auth landing — cinematic ── */
.auth-landing-hero h1 {
    font-size: clamp(1.85rem, 4vw, 2.75rem) !important;
    line-height: 1.2 !important;
    filter: none;
}

.auth-landing-showcase-frame {
    position: relative;
}

.auth-landing-showcase-frame::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(var(--holo-angle, 135deg), #6366f1, #22d3ee, #c084fc, #6366f1);
    z-index: -1;
    animation: holoSpin 6s linear infinite;
    opacity: 0.6;
}

.auth-landing-panel {
    box-shadow:
        0 0 0 1px rgba(99, 102, 241, 0.15),
        0 32px 80px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(99, 102, 241, 0.08) !important;
}

.auth-landing-main,
.auth-landing-nav {
    animation: riseIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) both;
}

@media (min-width: 901px) {
    body.app-interior .app-shell {
        animation: riseIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) both;
    }
}

/* ── Item tiles / seed cards ── */
.gag2-seed-card.is-active {
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.35), inset 0 0 16px rgba(99, 102, 241, 0.1) !important;
    border-color: rgba(34, 211, 238, 0.55) !important;
}

.gag2-seed-card:hover {
    transform: translateY(-3px) scale(1.02);
}

/* ── Status badges glow ── */
.status-online {
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.35) !important;
    animation: neonPulse 2.5s ease-in-out infinite;
}

/* ── Page header icon ── */
.page-game-icon {
    position: relative;
}

.page-game-icon::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(34, 211, 238, 0.3));
    filter: blur(12px);
    z-index: -1;
    opacity: 0.7;
}

/* ── Eyebrow neon ── */
.eyebrow {
    text-shadow: none;
}

/* ── Scan line (subtle) ── */
body.app-interior::after {
    display: block !important;
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.15), transparent);
    animation: scanLine 8s linear infinite;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.4;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .ambient-mesh,
    .ambient-glow,
    .page-header h1,
    .game-catalog-header h1,
    .auth-landing-hero h1,
    .btn-primary,
    .game-catalog-card,
    body.app-interior::after {
        animation: none !important;
    }

    .cursor-glow {
        display: none;
    }
}

@media (max-width: 900px) {
    .cursor-glow {
        display: none;
    }

    .ambient-glow--1,
    .ambient-glow--2 {
        width: 260px;
        height: 260px;
    }
}

/* ── Performance: disable heavy layers on app interior pages ── */
body.app-interior .ambient-mesh,
body.app-interior .ambient-grid,
body.app-interior .ambient-glow,
body.app-interior .particle-canvas,
body.app-interior .cursor-glow {
    display: none !important;
}

body.app-interior::after {
    display: none !important;
}

body.app-interior .panel::before {
    animation: none !important;
}

body.app-interior .btn-primary::after {
    animation: none !important;
}
