/* AdminLTE 3.2 Custom Theme, Smooth Load Animations & Mobile/Desktop Polish */
:root {
    --nc-primary: #6f42c1;
    --nc-primary-dark: #59359a;
    --nc-primary-soft: rgba(111, 66, 193, 0.12);
    --nc-ok: #16a34a;
    --nc-warn: #d97706;
    --nc-err: #dc2626;
    --nc-border: #dee2e6;
    --nc-muted: #6c757d;
    --nc-subtle: #f4f6f9;
    --nc-card: #ffffff;
    --nc-text: #1f2d3d;
}

body.dark-mode {
    --nc-border: #4b545c;
    --nc-muted: #adb5bd;
    --nc-subtle: #2b3035;
    --nc-card: #343a40;
    --nc-text: #f8f9fa;
    --nc-primary-soft: rgba(139, 92, 246, 0.22);
}

.hidden { display: none !important; }

/* Top Indeterminate Loading Bar */
.top-load-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    background: rgba(111, 66, 193, 0.15);
    overflow: hidden;
}
.top-load-bar.active { opacity: 1; }
.top-load-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #6f42c1, #a855f7, #38bdf8);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.75);
    animation: ncIndeterminate 1.05s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes ncIndeterminate {
    0% { left: -40%; width: 35%; }
    50% { left: 35%; width: 55%; }
    100% { left: 100%; width: 35%; }
}

/* Animated Splash Preloader */
.nc-preloader {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: linear-gradient(135deg, #1b1f3a 0%, #2d1b54 55%, #16213e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.nc-preloader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.nc-preloader-ring {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    background: linear-gradient(135deg, #7c3aed, #38bdf8);
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.65);
    animation: ncPulseGlow 1.5s ease-in-out infinite;
}
@keyframes ncPulseGlow {
    0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.65); }
    65% { transform: scale(1.05); box-shadow: 0 0 0 18px rgba(124, 58, 237, 0); }
    100% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

/* Login Screen Animation */
.nc-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at 18% 20%, rgba(124, 58, 237, 0.25), transparent 45%),
                radial-gradient(circle at 82% 80%, rgba(56, 189, 248, 0.2), transparent 45%),
                linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #111827 100%);
}
.nc-login-box {
    width: 100%;
    max-width: 400px;
    animation: ncFadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Page Switch & Card Stagger Animations */
@keyframes ncFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ncPopIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.page-pane.page-enter {
    animation: ncFadeUp 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.page-pane.page-enter .small-box,
.page-pane.page-enter .info-box,
.page-pane.page-enter .card {
    animation: ncFadeUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.page-pane.page-enter .row > div:nth-child(2) .small-box,
.page-pane.page-enter .row > div:nth-child(2) .info-box,
.page-pane.page-enter .row > div:nth-child(2) .card { animation-delay: 0.05s; }
.page-pane.page-enter .row > div:nth-child(3) .small-box,
.page-pane.page-enter .row > div:nth-child(3) .info-box { animation-delay: 0.1s; }
.page-pane.page-enter .row > div:nth-child(4) .small-box,
.page-pane.page-enter .row > div:nth-child(4) .info-box { animation-delay: 0.15s; }

/* Smooth Interactive Hover States */
.small-box,
.info-box,
.game-tile-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.small-box:hover,
.info-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.card {
    border-radius: 0.65rem;
    transition: box-shadow 0.2s ease;
}
.btn {
    transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }

/* Sidebar Brand & Nav Polish */
.main-sidebar {
    background: linear-gradient(180deg, #1b1e2f 0%, #141726 100%) !important;
}
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-indigo .nav-sidebar > .nav-item > .nav-link.active {
    background: linear-gradient(90deg, #6f42c1, #7c3aed) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}
.brand-mark-badge {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #38bdf8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    margin-right: 8px;
    font-size: 14px;
}

/* Metrics Ribbon (Scrollable on Mobile) */
.metrics-ribbon {
    background: var(--nc-card);
    border-bottom: 1px solid var(--nc-border);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px 18px;
    font-size: 12.5px;
    color: var(--nc-muted);
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.metrics-ribbon::-webkit-scrollbar { height: 4px; }
.metrics-ribbon::-webkit-scrollbar-thumb { background: rgba(111, 66, 193, 0.3); border-radius: 4px; }
.ribbon-item { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ribbon-item strong { color: var(--nc-text); font-weight: 700; }
.ribbon-palace {
    background: var(--nc-primary-soft);
    color: var(--nc-primary);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
}
.ribbon-link {
    background: none;
    border: 0;
    color: var(--nc-primary);
    font-weight: 700;
    font-size: 11.5px;
    cursor: pointer;
    padding: 0 3px;
}
.ribbon-link:hover { text-decoration: underline; }

/* Charts */
.chart-svg-wrap { width: 100%; height: 195px; }
.chart-svg-wrap.tall { height: 225px; }
.chart-big {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}
.trend-up { font-size: 12.5px; color: var(--nc-ok); font-weight: 700; }
.trend-down { font-size: 12.5px; color: var(--nc-err); font-weight: 700; }

/* Super Admin Wallet Cards */
.sa-big-num {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.sa-stat-mini {
    background: var(--nc-subtle);
    border: 1px solid var(--nc-border);
    border-radius: 8px;
    padding: 8px 10px;
}
.sa-stat-mini-lbl { font-size: 11px; color: var(--nc-muted); }
.sa-stat-mini-val { font-size: 14px; font-weight: 700; margin-top: 2px; }

/* Test Launch Game Visual Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: 12px;
}
.game-tile-card {
    background: var(--nc-card);
    border: 1px solid var(--nc-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.game-tile-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(111, 66, 193, 0.18);
    border-color: var(--nc-primary);
}
.game-tile-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.65);
    font-size: 24px;
}
.game-tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.game-tile-body {
    padding: 8px 10px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}
.game-tile-name {
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.game-tile-code {
    font-size: 11px;
    color: var(--nc-muted);
    word-break: break-all;
}
.launch-preview-frame {
    width: 100%;
    height: 520px;
    border: 1px solid var(--nc-border);
    border-radius: 10px;
    background: #0b0f19;
}

/* Custom Modals (CSP safe, smooth pop-in) */
.nc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1060;
}
.nc-modal-box {
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--nc-card);
    color: var(--nc-text);
    border: 1px solid var(--nc-border);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    animation: ncPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Animated Toast Notification */
.nc-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: 380px;
    background: #1f2937;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    border-left: 4px solid #8b5cf6;
    font-size: 13px;
    font-weight: 500;
    z-index: 9990;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
    animation: ncFadeUp 0.25s ease both;
}

/* Tables & Code */
pre {
    background: var(--nc-subtle);
    border: 1px solid var(--nc-border);
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    max-height: 280px;
    overflow: auto;
}
.table td, .table th { vertical-align: middle !important; font-size: 13px; }

/* Mobile & Tablet Responsive Refinements */
@media (max-width: 767.98px) {
    .content-header h1 { font-size: 1.35rem; }
    .sa-big-num { font-size: 22px; }
    .chart-big { font-size: 20px; }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .launch-preview-frame { height: 380px; }
    .nc-toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
    .navbar .nav-link { padding-left: 0.5rem; padding-right: 0.5rem; }
    .hide-xs { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
