/* ============================================================
   FILE: assets/css/style.css
   CHỨC NĂNG: CSS chính toàn bộ project
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 80px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

/* ===== HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-header);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.5px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.username {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.balance {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-success);
    background: rgba(0, 208, 132, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-admin {
    background: var(--color-error);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.lang-switch {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 2px;
}

.lang-btn {
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--color-primary);
    color: var(--bg-primary);
}

.header-spacer {
    height: 60px;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-nav);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 72px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.25s ease;
    position: relative;
    min-width: 56px;
}

.nav-icon {
    font-size: 22px;
    transition: transform 0.2s;
    line-height: 1;
}

.nav-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.nav-item.active .nav-label {
    color: var(--color-primary);
}

.nav-item.active .nav-icon {
    transform: scale(1.05);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 0 0 4px 4px;
    box-shadow: var(--glow-primary);
}

.bottom-nav-spacer {
    height: 72px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255,255,255,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:active {
    transform: scale(0.98);
}

.card-glow {
    box-shadow: var(--shadow-sm), var(--glow-primary);
}

/* ===== GRID ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--bg-primary);
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: var(--glow-primary);
}

.btn-secondary {
    background: rgba(0, 229, 255, 0.12);
    color: var(--color-primary);
    border: 1px solid rgba(0, 229, 255, 0.2);
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-danger {
    background: var(--color-error);
    color: #fff;
}

.btn-warning {
    background: var(--color-warning);
    color: #1a1a1a;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.05) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: toast-in 0.35s ease;
}

.toast.fade-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.toast-close {
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-primary); }

/* ===== CHAT FAB ===== */
.chat-fab {
    position: fixed;
    bottom: 88px;
    right: 16px;
    z-index: 900;
}

.fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg), var(--glow-primary);
    transition: transform 0.25s ease;
}

.fab-btn:active {
    transform: scale(0.9);
}

.chat-menu {
    position: absolute;
    bottom: 68px;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 8px 0;
    min-width: 150px;
    display: none;
    animation: toast-in 0.25s ease;
}

.chat-menu.open {
    display: block;
}

.chat-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.chat-option:hover {
    background: rgba(255,255,255,0.05);
}

.chat-option span:first-child {
    font-size: 18px;
}

/* ===== BANNER ===== */
.banner-container {
    padding: 0 16px;
    margin: 12px 0;
}

.banner-slider {
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/7;
    background: var(--bg-card);
}

.banner-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== GAME GRID ===== */
.game-grid {
    padding: 0 16px;
    margin: 12px 0;
}

.game-grid-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.game-item {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 14px 12px;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
}

.game-item:active {
    transform: scale(0.96);
    border-color: var(--color-primary);
}

.game-icon {
    font-size: 36px;
    margin-bottom: 6px;
    display: block;
}

.game-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-count {
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 420px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .header-right .balance {
        font-size: 13px;
        padding: 2px 10px;
    }
    .nav-item {
        padding: 4px 6px;
        min-width: 48px;
    }
    .nav-icon {
        font-size: 20px;
    }
    .nav-label {
        font-size: 9px;
    }
}