﻿/* =========================================
   LAYOUT CƠ BẢN – DÙNG CHUNG TOÀN WEB
========================================= */

/* ----- Container căn giữa ----- */

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- Card 3D chung ----- */

.card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-soft-sm);
    transition: var(--transition-normal);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

/* ----- SECTION CHUNG ----- */

section {
    padding: var(--space-8) 0;
}

.section-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto var(--space-6);
}

.section-header h2 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.section-header p {
    color: var(--text-soft);
    font-size: 0.98rem;
}

/* ----- BUTTON CHUẨN ----- */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-alt));
    color: #ffffff;
    font-weight: 600;
    border-radius: 999px;
    transition: var(--transition-fast);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.95rem;
    gap: 6px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.7);
    filter: brightness(1.05);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 999px;
    background: rgba(36, 37, 38, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(55, 65, 81, 0.9);
}

/* ----- INPUT CHUNG ----- */

.input-field {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    color: var(--text-main);
}

.input-field::placeholder {
    color: var(--text-soft);
}

/* ----- GRID CHUNG ----- */

.grid {
    display: grid;
    gap: 20px;
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

/* ----- FLEX UTILS ----- */

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

/* ----- SPACING UTILS ----- */

.mt-1 {
    margin-top: var(--space-1);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-5 {
    margin-top: var(--space-5);
}

.mb-1 {
    margin-bottom: var(--space-1);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-5 {
    margin-bottom: var(--space-5);
}

/* ----- GLASS EFFECT NHẸ (nếu cần) ----- */

.glass {
    background: rgba(36, 37, 38, 0.8);
    backdrop-filter: blur(14px);
    border-radius: var(--radius-lg);
}

/* ----- SCROLLBAR DARK ----- */

::-webkit-scrollbar {
    width: 9px;
}

::-webkit-scrollbar-track {
    background: #18191a;
}

::-webkit-scrollbar-thumb {
    background: #3a3b3c;
    border-radius: 10px;
}

/* =====================================================
   PAGE TRANSITION – HIỆU ỨNG CHUYỂN TRANG
===================================================== */

/* 1. ENTRY: body fade-in khi mỗi trang load */
@keyframes kgame-page-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
}

body {
    animation: kgame-page-enter 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* 2. EXIT OVERLAY – màn che tối khi rời trang */
#kgame-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: radial-gradient(ellipse at 38% 42%,
        #1e1b4b 0%, #0f172a 50%, #020617 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#kgame-overlay.kgo-show {
    opacity: 1;
    pointer-events: all;
}

/* Brand mark bên trong overlay */
#kgame-overlay .kgo-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transform: scale(0.8) translateY(12px);
    transition: opacity 0.26s ease 0.1s,
                transform 0.36s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
}

#kgame-overlay.kgo-show .kgo-inner {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.kgo-mark {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow:
        0 0 0 1px rgba(99,102,241,0.35),
        0 0 28px rgba(99,102,241,0.7),
        0 0 70px rgba(99,102,241,0.22);
}

.kgo-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kgo-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: -0.01em;
}

/* Dot loader */
.kgo-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.kgo-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #6366f1;
    animation: kgo-dot-pulse 1.1s ease-in-out infinite;
}

.kgo-dots span:nth-child(2) { animation-delay: 0.18s; background: #8b5cf6; }
.kgo-dots span:nth-child(3) { animation-delay: 0.36s; background: #38bdf8; }

@keyframes kgo-dot-pulse {
    0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* 3. PROGRESS BAR – thanh mảnh ở đầu trang */
#kgame-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2.5px;
    width: 0%;
    z-index: 100000;
    background: linear-gradient(90deg, #6366f1 0%, #a78bfa 55%, #38bdf8 100%);
    box-shadow: 0 0 10px rgba(99,102,241,0.9), 0 0 4px rgba(56,189,248,0.5);
    border-radius: 0 2px 2px 0;
    opacity: 0;
}

#kgame-progress.kgp-enter {
    opacity: 1;
    width: 82%;
    transition: width 0.38s ease, opacity 0.2s ease;
}

#kgame-progress.kgp-done {
    opacity: 0;
    width: 100%;
    transition: width 0.18s ease, opacity 0.32s ease 0.18s;
}

/* Tắt animation nếu user bật giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
    body { animation: none; }
    #kgame-overlay, #kgame-progress { display: none !important; }
}

/* Sidebar ẩn theo mặc định trên màn hình nhỏ, hiện khi có .is-open */
.dash-sidebar,
.dashboard-sidebar {
    position: fixed;
    top: 64px;
    /* chiều cao header của bạn, chỉnh nếu khác */
    right: -320px;
    /* đẩy ra ngoài màn hình */
    width: 280px;
    height: calc(100vh - 64px);
    background: #242526;
    box-shadow: -20px 0 60px rgba(15, 23, 42, 0.9);
    transition: right 0.25s ease, opacity 0.25s ease;
    z-index: 60;
}

/* Khi mở */
.dash-sidebar.is-open,
.dashboard-sidebar.is-open {
    right: 0;
}

/* Overlay che nền */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 55;
}

.sidebar-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Trên màn hình rộng, nếu bạn muốn sidebar luôn hiện (optional) */
@media (min-width: 1100px) {

    .dash-sidebar,
    .dashboard-sidebar {
        position: static;
        height: auto;
        right: auto;
        box-shadow: none;
    }

    .sidebar-overlay {
        display: none;
    }
}

/* Khóa cuộn khi mở menu 3 gạch / popup */
body.no-scroll {
    overflow: hidden;
}