/* === Base Styles === */
:root {
    --bg-dark: #0a0e17;
    --bg-card: #131a2b;
    --bg-glass: rgba(20, 30, 50, 0.7);
    --border-glass: rgba(100, 140, 255, 0.15);
    --text-primary: #e8ecf4;
    --text-secondary: #8b95a8;
    --text-muted: #5a6477;
    --accent: #4f8cff;
    --accent-glow: rgba(79, 140, 255, 0.3);
    --green: #2ecc71;
    --red: #e74c3c;
    --orange: #f39c12;
    --gold: #ffd700;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Utility === */
.hidden { display: none !important; }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { background: #6ba0ff; box-shadow: 0 4px 20px var(--accent-glow); }

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover { background: rgba(255,255,255,0.14); }

.btn-accent {
    background: linear-gradient(135deg, var(--gold), var(--orange));
    color: #1a1a1a;
}
.btn-accent:hover { filter: brightness(1.1); }

.btn-danger {
    background: var(--red);
    color: white;
}
.btn-danger:hover { background: #c0392b; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.input-field {
    padding: 10px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border var(--transition);
    width: 100%;
}
.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 24px;
}

/* === Lobby === */
.lobby-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    gap: 10px;
    align-items: center;
}
.user-info .input-field { width: 180px; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(79, 140, 255, 0.1);
    border: 1px solid var(--accent);
    border-radius: 20px;
    font-weight: 600;
}
.chip-icon { color: var(--gold); }

/* Currency tabs */
.currency-tabs { display: flex; gap: 4px; }
.cur-tab {
    padding: 8px 18px; border: 1px solid var(--border-glass); border-radius: 8px;
    background: transparent; color: var(--text-secondary); font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.cur-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.cur-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

.tables-header-right { display: flex; gap: 8px; }

/* Balance badges in header */
.badge-balances { display: flex; gap: 10px; font-size: 12px; font-weight: 600; }
.bal-play { color: #4fc3f7; }
.bal-real { color: var(--gold); }

/* Table card currency badge */
.table-card-badge {
    font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: 600;
}
.table-card-badge.play { background: rgba(79,195,247,0.15); color: #4fc3f7; }
.table-card-badge.real { background: rgba(255,215,0,0.15); color: var(--gold); }

/* Mode toggle in create modal */
.mode-toggle { display: flex; gap: 4px; }
.mode-btn {
    flex: 1; padding: 10px; border: 1px solid var(--border-glass); border-radius: 8px;
    background: transparent; color: var(--text-secondary); font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all 0.15s; text-align: center;
}
.mode-btn:hover { border-color: var(--accent); }
.mode-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Game mode tabs (Cash/Zoom/Tournaments) */
.mode-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.mode-tab {
    padding: 10px 20px; border: 1px solid var(--border-glass); border-radius: 10px;
    background: transparent; color: var(--text-secondary); font-size: 14px;
    font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.mode-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.mode-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

.mode-section { display: none; }
.mode-section.active { display: block; }

/* Tournament status badges */
.t-badge {
    font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: 600;
    text-transform: capitalize;
}
.t-badge.registering { background: rgba(79,195,247,0.15); color: #4fc3f7; }
.t-badge.late_reg { background: rgba(255,215,0,0.15); color: var(--gold); }
.t-badge.running { background: rgba(46,204,113,0.15); color: var(--green); }
.t-badge.finished { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.t-badge.cancelled { background: rgba(231,76,60,0.15); color: var(--red); }
.balance-text {
    color: var(--gold);
    font-weight: 700;
    font-size: 14px;
}
.badge-link {
    color: inherit;
    text-decoration: none;
}
.badge-link:hover { text-decoration: underline; }

.tables-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.tables-header h2 { font-size: 20px; }

.tables-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.table-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    transition: all var(--transition);
    cursor: pointer;
}
.table-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

.table-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.table-card-name {
    font-size: 16px;
    font-weight: 600;
}
.table-card-details {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
}
.table-card-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.table-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.loading-text {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 15px;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal {
    width: 420px;
    max-width: 90vw;
}
.modal h3 {
    font-size: 18px;
    margin-bottom: 20px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-group { flex: 1; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* === Responsive === */
@media (max-width: 600px) {
    .lobby-header { flex-direction: column; align-items: flex-start; }
    .user-info { width: 100%; }
    .user-info .input-field { flex: 1; }
    .table-card { flex-direction: column; gap: 12px; align-items: flex-start; }
    .table-card-actions { width: 100%; }
    .table-card-actions .btn { flex: 1; }
}
