:root {
    --bg-base: #080b12;
    --bg-card: rgba(15, 22, 36, 0.78);
    --bg-card-hover: rgba(22, 32, 52, 0.9);
    --bg-input: rgba(8, 12, 20, 0.85);
    --border-card: rgba(255, 255, 255, 0.09);
    --border-hover: rgba(56, 189, 248, 0.4);
    --border-focus: #38bdf8;
    
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.35);
    --primary-gradient: linear-gradient(135deg, #0284c7, #38bdf8);
    --accent: #ec4899;
    --accent-glow: rgba(236, 72, 153, 0.35);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.35);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(245, 158, 11, 0.35);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --danger-border: rgba(239, 68, 68, 0.35);
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.12);
    --info-border: rgba(14, 165, 233, 0.35);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.14) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 65%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   HEADER
   ========================================== */
header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-card);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 11, 18, 0.85);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text-main);
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #38bdf8, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
    transition: transform 0.2s ease;
}

.brand:hover .brand-logo {
    transform: scale(1.05);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.server-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.4rem 0.95rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.server-badge.online {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.server-badge.online .status-dot {
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 2s infinite;
}

.server-badge.offline {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.server-badge.offline .status-dot {
    background: #ef4444;
}

.server-badge.checking, .server-badge.warning {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.server-badge.checking .status-dot, .server-badge.warning .status-dot {
    background: #f59e0b;
    animation: pulse 1s infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-header-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-card);
    color: var(--text-muted);
    padding: 0.4rem 0.65rem;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-header-icon:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-hover);
}

/* ==========================================
   CONTAINER & TABS
   ========================================== */
.container {
    max-width: 960px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.25rem;
    flex: 1;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 22, 36, 0.65);
    padding: 0.4rem;
    border-radius: 16px;
    border: 1px solid var(--border-card);
    margin-bottom: 1.75rem;
    backdrop-filter: blur(14px);
}

.tab-btn {
    flex: 1;
    padding: 0.85rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.badge-count {
    background: var(--accent);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    margin-left: 2px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   GLASS CARD
   ========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 2.25rem;
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.55);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    letter-spacing: -0.5px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

/* ==========================================
   INLINE ALERT BANNER (PHẢN HỒI RÕ RÀNG TRỰC TIẾP)
   ========================================== */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: slideDown 0.3s ease;
    backdrop-filter: blur(10px);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-banner.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: #a7f3d0;
}
.alert-banner.alert-success .alert-icon { color: #34d399; font-size: 1.25rem; }

.alert-banner.alert-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: #fecaca;
}
.alert-banner.alert-error .alert-icon { color: #f87171; font-size: 1.25rem; }

.alert-banner.alert-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: #fde68a;
}
.alert-banner.alert-warning .alert-icon { color: #fbbf24; font-size: 1.25rem; }

.alert-banner.alert-info {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: #bae6fd;
}
.alert-banner.alert-info .alert-icon { color: #38bdf8; font-size: 1.25rem; }

.alert-body {
    flex: 1;
}

.alert-message code {
    background: rgba(0, 0, 0, 0.25);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.88em;
}

.alert-close {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* ==========================================
   FORM CONTROLS
   ========================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: #e2e8f0;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(12, 17, 28, 0.95);
}

.form-input::placeholder {
    color: #475569;
}

.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 4px;
}

.btn-toggle-pwd:hover {
    opacity: 1;
}

.input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.btn-primary {
    width: 100%;
    padding: 0.95rem 1.5rem;
    border: none;
    border-radius: 14px;
    background: var(--primary-gradient);
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 1.5rem;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.45);
    filter: brightness(1.08);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   GIFTCODE GRID & CARDS
   ========================================== */
.giftcode-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.search-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: var(--text-main);
    font-size: 0.88rem;
    outline: none;
}

.search-input:focus {
    border-color: var(--border-focus);
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-card);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-refresh:hover {
    background: var(--primary);
    color: #000;
}

.btn-refresh.rotating span.refresh-icon {
    animation: spin 0.6s linear infinite;
}

.giftcode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.25rem;
}

.giftcode-card {
    background: rgba(8, 12, 20, 0.7);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.giftcode-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.giftcode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.code-tag {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    border: 1px dashed rgba(56, 189, 248, 0.35);
    letter-spacing: 0.5px;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-card);
    color: var(--text-main);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-copy:hover {
    background: var(--primary);
    color: #000000;
}

.btn-copy.copied {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

.giftcode-desc {
    font-size: 0.86rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    line-height: 1.45;
}

.giftcode-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-card);
    padding-top: 0.75rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
}

.meta-highlight {
    color: #34d399;
    font-weight: 700;
}

/* Skeleton Loading */
.giftcode-skeleton {
    background: rgba(8, 12, 20, 0.5);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 1.25rem;
    min-height: 140px;
}

.skeleton-line {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
}

.shimmer {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmerAnim 1.5s infinite;
}

@keyframes shimmerAnim {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Empty / Error States */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.empty-state h3 {
    color: var(--text-main);
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.88rem;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
}

.error-state h3 {
    color: #f87171;
}

.error-detail {
    color: #fca5a5 !important;
    font-family: monospace;
    font-size: 0.82rem !important;
    margin-top: 0.5rem !important;
}

/* ==========================================
   GUIDE STEPS (HƯỚNG DẪN VÀO GAME)
   ========================================== */
.guide-step {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    background: rgba(8, 12, 20, 0.6);
    border-radius: 14px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-card);
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 0.98rem;
    margin-bottom: 0.35rem;
}

.step-content p {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.step-content code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    color: #38bdf8;
    font-family: monospace;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    min-width: 320px;
    max-width: 440px;
    padding: 0.9rem 1.15rem;
    border-radius: 14px;
    color: white;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    backdrop-filter: blur(14px);
}

.toast-icon { font-size: 1.15rem; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-message { line-height: 1.4; }
.toast-close {
    background: transparent;
    border: none;
    color: white;
    opacity: 0.6;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px;
}
.toast-close:hover { opacity: 1; }

.toast.success { background: rgba(16, 185, 129, 0.95); border: 1px solid #34d399; }
.toast.error { background: rgba(239, 68, 68, 0.95); border: 1px solid #f87171; }
.toast.warning { background: rgba(245, 158, 11, 0.95); border: 1px solid #fbbf24; }
.toast.info { background: rgba(14, 165, 233, 0.95); border: 1px solid #38bdf8; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
    padding: 1.75rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border-card);
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}
.footer-link:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
    header { padding: 1rem; }
    .container { padding: 0 0.85rem; margin: 1.25rem auto; }
    .card { padding: 1.35rem; }
    .tabs { flex-direction: column; gap: 0.25rem; }
    #toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
    .toast { min-width: unset; width: 100%; }
    footer { flex-direction: column; text-align: center; }
}
