/* ============================================================
   GENKEY — GAMING THEME
   ============================================================ */
:root {
    --bg:          #0a0d14;
    --bg-2:        #0f131f;
    --card:        #131824;
    --card-2:      #1a2030;
    --border:      rgba(124, 58, 237, 0.18);
    --border-2:    rgba(124, 58, 237, 0.35);
    --text:        #e4e7eb;
    --text-muted:  #94a3b8;
    --text-dim:    #64748b;
    --primary:     #7c3aed;
    --primary-2:   #a855f7;
    --accent:      #06b6d4;
    --accent-2:    #22d3ee;
    --success:     #22c55e;
    --danger:      #ef4444;
    --warn:        #f59e0b;
    --glow-v:      0 0 24px rgba(124, 58, 237, 0.45);
    --glow-c:      0 0 24px rgba(6, 182, 212, 0.45);
    --glow-g:      0 0 24px rgba(34, 197, 94, 0.45);
    --radius:      14px;
    --radius-sm:   10px;
    --radius-lg:   20px;
    --shadow:      0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-lg:   0 20px 60px rgba(0, 0, 0, 0.65);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    margin: 0; padding: 0; min-height: 100vh;
    background: var(--bg); color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px; line-height: 1.5; overflow-x: hidden;
}
body {
    background-image:
        radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.15), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(6, 182, 212, 0.12), transparent 50%),
        radial-gradient(ellipse at center, rgba(168, 85, 247, 0.06), transparent 60%);
    background-attachment: fixed;
}
a { color: var(--primary-2); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 12px 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
p  { margin: 0 0 12px 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px; }
.container-narrow { max-width: 520px; margin: 0 auto; padding: 20px; }
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

.card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.card::before {
    content: ''; position: absolute; inset: 0;
    border-radius: inherit; padding: 1px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), rgba(6, 182, 212, 0.3), rgba(124, 58, 237, 0.5));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none; opacity: 0.7;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 17px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px 20px;
    border: none; border-radius: var(--radius);
    font-size: 15px; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none; text-align: center; user-select: none;
    position: relative; overflow: hidden; letter-spacing: 0.02em;
}
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn:not(:disabled):hover  { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: var(--glow-v); }
.btn-primary:not(:disabled):hover { box-shadow: 0 0 32px rgba(168, 85, 247, 0.65); }
.btn-accent { background: linear-gradient(135deg, #1e293b, #334155); color: #fff; border: 1px solid var(--border-2); }
.btn-accent:not(:disabled):hover { border-color: var(--primary-2); box-shadow: 0 0 20px rgba(124, 58, 237, 0.35); }
.btn-success { background: linear-gradient(135deg, #059669, var(--success)); color: #fff; box-shadow: var(--glow-g); }
.btn-success:not(:disabled):hover { box-shadow: 0 0 32px rgba(34, 197, 94, 0.65); }
.btn-danger { background: linear-gradient(135deg, #991b1b, var(--danger)); color: #fff; }
.btn-danger:not(:disabled):hover { box-shadow: 0 0 24px rgba(239, 68, 68, 0.5); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }
.btn + .btn { margin-top: 10px; }

label {
    display: block; margin: 14px 0 6px;
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
}
input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="file"], textarea, select {
    width: 100%; padding: 12px 14px;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 15px; font-family: inherit; transition: all 0.2s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
textarea {
    resize: vertical; min-height: 100px;
    font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 13px;
}
input[type="file"] { padding: 10px; cursor: pointer; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border-left: 3px solid; }
.alert-success { background: rgba(34, 197, 94, 0.1); border-color: var(--success); color: #86efac; }
.alert-danger  { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); color: #fca5a5; }
.alert-warn    { background: rgba(245, 158, 11, 0.1); border-color: var(--warn); color: #fcd34d; }
.alert-info    { background: rgba(6, 182, 212, 0.1); border-color: var(--accent); color: #67e8f9; }

.keybox {
    margin-top: 16px; padding: 16px;
    background: var(--bg-2);
    border: 1px dashed var(--success);
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 15px; word-break: break-all; color: var(--success);
    text-align: center; line-height: 1.6;
    box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.08);
}
.keybox strong { display: inline-block; margin-top: 6px; font-size: 17px; letter-spacing: 0.05em; color: #4ade80; }
.note { color: var(--text-dim); font-size: 13px; margin-top: 10px; text-align: center; }

.game-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px; margin-top: 20px;
}
.game-card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
}
.game-card:hover {
    transform: translateY(-4px); border-color: var(--border-2);
    box-shadow: var(--shadow-lg), var(--glow-v);
}
.game-thumb {
    width: 100%; aspect-ratio: 16 / 9;
    object-fit: cover; display: block;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.game-thumb-placeholder {
    width: 100%; aspect-ratio: 16 / 9;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bg-2), #1a2030);
    color: var(--text-dim); font-size: 40px;
    border-bottom: 1px solid var(--border);
}
.game-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.game-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); text-align: center; }
.game-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }

.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; background: var(--card);
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px; border-radius: 0 0 var(--radius) var(--radius);
}
.admin-header h1 {
    margin: 0; font-size: 18px;
    background: linear-gradient(135deg, var(--primary-2), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.admin-card h2 {
    font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--accent); margin: 0 0 16px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.game-item-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; gap: 10px;
}

.section-block {
    margin-top: 20px;
    padding: 16px;
    background: rgba(10, 13, 20, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}

.image-upload-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.image-preview-box {
    width: 200px;
    aspect-ratio: 16 / 9;
    background: var(--bg);
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.image-preview-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-preview-box .no-image {
    color: var(--text-dim);
    font-size: 13px;
    text-align: center;
    padding: 10px;
}
.image-upload-form { flex: 1; min-width: 220px; }
.image-upload-form input[type="file"] { font-size: 13px; }

.links-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.link-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.link-num {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.link-item input { flex: 1; }

.logs-wrap { max-height: 480px; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table.logs { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
table.logs th {
    background: var(--bg); padding: 10px 12px; text-align: left;
    color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em;
    font-size: 11px; position: sticky; top: 0; border-bottom: 1px solid var(--border);
}
table.logs td {
    padding: 8px 12px; border-bottom: 1px solid rgba(124, 58, 237, 0.08);
    color: var(--text-muted); word-break: break-word;
}
table.logs tr:hover td { background: rgba(124, 58, 237, 0.05); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-danger  { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info    { background: rgba(6, 182, 212, 0.15); color: var(--accent-2); }

.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.03em;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--primary-2);
    border-bottom-color: var(--primary-2);
    text-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    .container, .container-narrow { padding: 14px; }
    .card, .admin-card { padding: 18px; border-radius: var(--radius); }
    h1 { font-size: 22px; } h2 { font-size: 18px; }
    .game-grid { grid-template-columns: 1fr; gap: 16px; }
    .btn { padding: 15px 20px; font-size: 15px; min-height: 48px; }
    .admin-header { flex-direction: column; gap: 12px; text-align: center; }
    .admin-nav { justify-content: center; width: 100%; }
    table.logs th, table.logs td { padding: 8px 8px; font-size: 11px; }
    .image-upload-row { flex-direction: column; }
    .image-preview-box { width: 100%; max-width: 320px; }
    .tab { padding: 10px 14px; font-size: 13px; }
    .section-block { padding: 12px; }
}
@media (max-width: 380px) {
    .card { padding: 14px; }
    h1 { font-size: 19px; }
}

/* ============================================================
   SOCIAL FLOAT BUTTONS — DẠNG BUTTON NGANG
   ============================================================ */
.social-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    z-index: 999;
    pointer-events: none;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px 12px 14px;
    border-radius: 999px;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 800;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-btn .social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.3);
}
.social-btn .social-icon svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.social-btn .social-label {
    font-size: 14px;
    line-height: 1;
}

.social-btn.channel {
    background: linear-gradient(135deg, #0088cc, #00aaff, #00cfff);
    background-size: 200% 200%;
    animation: pulseChannel 2.4s ease-in-out infinite,
               gradientShift 4s ease infinite;
    box-shadow: 0 8px 24px rgba(0, 136, 204, 0.55),
                0 0 0 0 rgba(0, 170, 255, 0.7);
}

.social-btn.group {
    background: linear-gradient(135deg, #7c3aed, #a855f7, #22d3ee);
    background-size: 200% 200%;
    animation: pulseGroup 2.4s ease-in-out infinite,
               gradientShift 4s ease infinite;
    animation-delay: 1.2s, 0s;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.55),
                0 0 0 0 rgba(168, 85, 247, 0.7);
}

@keyframes pulseChannel {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 8px 24px rgba(0, 136, 204, 0.55),
                    0 0 0 0 rgba(0, 170, 255, 0.7);
    }
    50% {
        transform: translateY(-3px) scale(1.04);
        box-shadow: 0 14px 34px rgba(0, 136, 204, 0.85),
                    0 0 0 12px rgba(0, 170, 255, 0);
    }
}
@keyframes pulseGroup {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 8px 24px rgba(124, 58, 237, 0.55),
                    0 0 0 0 rgba(168, 85, 247, 0.7);
    }
    50% {
        transform: translateY(-3px) scale(1.04);
        box-shadow: 0 14px 34px rgba(124, 58, 237, 0.85),
                    0 0 0 12px rgba(168, 85, 247, 0);
    }
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.social-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(100deg,
        transparent,
        rgba(255, 255, 255, 0.55),
        transparent);
    transform: skewX(-20deg);
    animation: shine 3.5s ease-in-out infinite;
    pointer-events: none;
}
.social-btn.group::before {
    animation-delay: 1.8s;
}
@keyframes shine {
    0%   { left: -120%; }
    55%  { left: 130%; }
    100% { left: 130%; }
}

.social-btn:hover {
    transform: translateY(-4px) scale(1.07) !important;
    filter: brightness(1.15);
}
.social-btn:hover::before {
    animation: shine 1.2s ease-in-out infinite;
}

@media (max-width: 640px) {
    .social-float {
        bottom: 14px;
        right: 14px;
        gap: 10px;
    }
    .social-btn {
        padding: 9px 16px 9px 10px;
        font-size: 12px;
        gap: 8px;
    }
    .social-btn .social-icon {
        width: 26px;
        height: 26px;
    }
    .social-btn .social-icon svg {
        width: 16px;
        height: 16px;
    }
    .social-btn .social-label {
        font-size: 12px;
    }
}