/* admin.css - Đơn giản, sạch, không gradient/glassmorphism thừa */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f5f6f8;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ===== Login ===== */
.login-body {
    background: #2c3e50;
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: #fff; padding: 2rem 2.4rem;
    width: 340px; border-radius: 6px;
}
.login-brand { font-size: 20px; font-weight: 700; text-align: center; }
.login-sub { font-size: 12px; color: #888; text-align: center; margin-bottom: 1.5rem; }
.login-form { display: flex; flex-direction: column; gap: .7rem; }
.login-form input {
    padding: .65rem .8rem; border: 1px solid #ccc; border-radius: 4px;
    font-size: 14px; outline: none;
}
.login-form input:focus { border-color: #2c3e50; }
.login-form button {
    padding: .7rem; background: #2c3e50; color: #fff;
    border: none; border-radius: 4px; font-size: 14px;
    font-weight: 600; cursor: pointer;
}
.login-err { color: #e74c3c; font-size: 13px; }

/* ===== Layout ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
    width: 220px; background: #2c3e50; color: #bdc3c7;
    flex-shrink: 0; display: flex; flex-direction: column;
    overflow-y: auto;
}
.sb-brand {
    padding: 1rem 1.2rem; border-bottom: 1px solid #1f2d3d;
    font-weight: 700; color: #fff; font-size: 15px;
}
.sb-brand-sub { font-size: 11px; color: #7f8c8d; font-weight: 400; margin-top: 2px; }
.sb-nav { padding: .5rem 0; flex: 1; display: flex; flex-direction: column; }
.sb-link {
    display: block; padding: .55rem 1.2rem;
    color: #bdc3c7; cursor: pointer; font-size: 14px;
    border-left: 3px solid transparent;
}
.sb-link:hover { background: #1f2d3d; color: #fff; }
.sb-link.active { background: #1f2d3d; color: #fff; border-left-color: #3498db; }
.sb-icon { display: inline-block; width: 20px; }
.sb-group-title {
    padding: .8rem 1.2rem .3rem;
    font-size: 11px; color: #7f8c8d;
    text-transform: uppercase;
}
.sb-spacer { flex: 1; }
.sb-logout { color: #e74c3c; }

/* ===== Main ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.hd-bar {
    height: 50px; background: #fff; border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1rem;
}
.hd-toggle {
    width: 28px; height: 28px; border: 1px solid #ddd;
    background: #fff; border-radius: 4px; cursor: pointer;
}
.hd-title { font-size: 16px; font-weight: 600; }
.hd-user { display: flex; align-items: center; gap: .6rem; font-size: 13px; }
.hd-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #2c3e50; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

/* ===== Content ===== */
.content { flex: 1; overflow: auto; padding: 1rem; background: #f5f6f8; }
.loading, .empty {
    padding: 2rem; text-align: center; color: #888;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 4px;
}

/* ===== Panel ===== */
.panel {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 4px;
    margin-bottom: 1rem;
}
.panel-head {
    padding: .8rem 1rem; border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center; justify-content: space-between;
    background: #fafbfc;
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-body { padding: 1rem; }

/* ===== Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .8rem; margin-bottom: 1rem;
}
.stat-card {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 4px;
    padding: 1rem;
}
.stat-label { font-size: 12px; color: #888; }
.stat-val { font-size: 22px; font-weight: 700; margin-top: 4px; color: #2c3e50; }

/* ===== Buttons ===== */
.btn {
    padding: .45rem .9rem; border: 1px solid #ccc; background: #fff;
    color: #2c3e50; border-radius: 4px; cursor: pointer;
    font-size: 13px; font-weight: 500;
}
.btn:hover { background: #ecf0f1; }
.btn-primary { background: #3498db; color: #fff; border-color: #3498db; }
.btn-primary:hover { background: #2980b9; }
.btn-danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: .25rem .6rem; font-size: 12px; }
.btn-row { display: flex; gap: .4rem; }

/* ===== Form ===== */
.form-row { margin-bottom: .8rem; display: flex; gap: .8rem; }
.form-row .field { flex: 1; }
.field { margin-bottom: .8rem; }
.field label {
    display: block; font-size: 12px; font-weight: 600;
    color: #555; margin-bottom: 4px;
}
.field input, .field select, .field textarea {
    width: 100%; padding: .5rem .7rem; border: 1px solid #ccc;
    border-radius: 4px; font-size: 13px; outline: none;
    background: #fff; color: #2c3e50;
    font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: #3498db;
}
.field textarea { resize: vertical; min-height: 60px; }
.hint { font-size: 11px; color: #999; margin-top: 4px; }

/* ===== Table ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
    padding: .6rem .8rem; text-align: left;
    border-bottom: 1px solid #ecf0f1;
}
.tbl th { background: #fafbfc; font-weight: 600; color: #555; font-size: 12px; }
.tbl tr:hover { background: #fafbfc; }
.tbl code {
    background: #ecf0f1; padding: 1px 5px; border-radius: 3px;
    font-size: 12px; color: #c0392b;
}
.tag {
    display: inline-block; padding: 2px 7px; border-radius: 3px;
    font-size: 11px; font-weight: 600;
}
.tag-on { background: #d5f4e6; color: #1e8449; }
.tag-off { background: #fadbd8; color: #c0392b; }
.tag-default { background: #ecf0f1; color: #7f8c8d; }
.tag-room { background: #d6eaf8; color: #2874a6; }

/* ===== Modal ===== */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-card {
    background: #fff; border-radius: 4px; width: 640px;
    max-width: 90vw; max-height: 85vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
    padding: .8rem 1rem; border-bottom: 1px solid #e0e0e0;
    display: flex; justify-content: space-between; align-items: center;
    background: #fafbfc;
    flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close {
    width: 28px; height: 28px; border: none; background: transparent;
    font-size: 20px; cursor: pointer; color: #888;
}
.modal-body { padding: 1rem; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot {
    padding: .8rem 1rem; border-top: 1px solid #e0e0e0;
    text-align: right; background: #fafbfc; flex-shrink: 0;
}
.modal-foot .btn { margin-left: .4rem; }

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #2c3e50; color: #fff; padding: .6rem 1.2rem;
    border-radius: 4px; font-size: 13px; font-weight: 500;
    opacity: 0; pointer-events: none; transition: opacity .2s;
    z-index: 2000;
}
.toast.show { opacity: 1; }
.toast.err { background: #e74c3c; }

/* ===== Withdraw Notification (góc phải dưới) ===== */
.wd-notif {
    position: fixed; right: 16px; bottom: 16px;
    width: 320px; max-width: calc(100vw - 32px);
    background: #fff; border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    border-left: 4px solid #e74c3c;
    padding: .8rem 1rem; z-index: 1500;
    font-size: 13px; cursor: pointer;
    transition: all .3s ease;
    display: none;
}
.wd-notif.show { display: block; animation: wdNotifIn .35s ease-out; }
.wd-notif:hover { box-shadow: 0 6px 24px rgba(0,0,0,.2); transform: translateY(-2px); }
.wd-notif .wd-notif-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .4rem;
}
.wd-notif .wd-notif-title {
    font-weight: 600; color: #e74c3c; font-size: 14px;
}
.wd-notif .wd-notif-close {
    background: none; border: none; cursor: pointer;
    color: #888; font-size: 16px; padding: 0; line-height: 1;
}
.wd-notif .wd-notif-close:hover { color: #333; }
.wd-notif .wd-notif-body {
    color: #555; line-height: 1.5;
}
.wd-notif .wd-notif-body strong { color: #2c3e50; }
.wd-notif .wd-notif-cta {
    margin-top: .5rem; color: #e74c3c; font-weight: 500;
    font-size: 12px;
}
@keyframes wdNotifIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { position: fixed; height: 100%; z-index: 100; transform: translateX(-100%); }
    body.sb-collapsed .sidebar { transform: translateX(0); }
    .form-row { flex-direction: column; gap: 0; }
}

/* ===== Misc ===== */
hr.sep { border: none; border-top: 1px dashed #e0e0e0; margin: 1rem 0; }
.text-muted { color: #888; }
.mb-1 { margin-bottom: .5rem; }
.mt-1 { margin-top: .5rem; }

/* ===== Dashboard: Trading & Statistics ===== */
.dash-row { display: grid; gap: 1rem; margin-bottom: 1rem; }
.dash-row.cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.dash-row.charts { grid-template-columns: 2fr 1fr; }
.dash-row.charts-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
    .dash-row.charts, .dash-row.charts-2 { grid-template-columns: 1fr; }
}

.dash-card {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 1rem; display: flex; flex-direction: column;
    transition: box-shadow .15s;
}
.dash-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.dash-card .dc-label {
    font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: .5px;
}
.dash-card .dc-val {
    font-size: 24px; font-weight: 700; color: #2c3e50; margin-top: .25rem;
}
.dash-card .dc-sub { font-size: 11px; color: #aaa; margin-top: 2px; }
.dash-card.dc-blue   { border-top: 3px solid #3498db; }
.dash-card.dc-green  { border-top: 3px solid #2ecc71; }
.dash-card.dc-red    { border-top: 3px solid #e74c3c; }
.dash-card.dc-orange { border-top: 3px solid #f39c12; }
.dash-card.dc-purple { border-top: 3px solid #9b59b6; }
.dash-card.dc-teal   { border-top: 3px solid #1abc9c; }
.dash-card.dc-gold   { border-top: 3px solid #f1c40f; }
.dash-card.dc-pink   { border-top: 3px solid #e91e63; }

.dash-card .dc-val.dc-profit-pos { color: #27ae60; }
.dash-card .dc-val.dc-profit-neg { color: #e74c3c; }

.dash-panel {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
    margin-bottom: 1rem;
}
.dash-panel .panel-head {
    padding: .75rem 1rem; border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center; justify-content: space-between;
    background: #fafbfc; border-radius: 6px 6px 0 0;
}
.dash-panel .panel-title {
    font-size: 14px; font-weight: 600; color: #2c3e50;
    text-transform: uppercase; letter-spacing: .5px;
}
.dash-panel .panel-body { padding: 1rem; }
.dash-panel .panel-body.no-pad { padding: 0; }

.chart-wrap { position: relative; height: 300px; }
.chart-wrap-sm { position: relative; height: 220px; }

/* Recent bets list */
.recent-bets { width: 100%; border-collapse: collapse; font-size: 13px; }
.recent-bets th, .recent-bets td { padding: .55rem .8rem; text-align: left; }
.recent-bets th {
    background: #fafbfc; font-weight: 600; color: #555;
    border-bottom: 1px solid #e0e0e0; font-size: 12px; text-transform: uppercase;
}
.recent-bets td { border-bottom: 1px solid #f0f0f0; }
.recent-bets tr:last-child td { border-bottom: none; }
.recent-bets .badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
}
.recent-bets .badge-win  { background: #d4edda; color: #155724; }
.recent-bets .badge-lose { background: #f8d7da; color: #721c24; }
.recent-bets .badge-fake { background: #e2e3e5; color: #6c757d; }
.recent-bets .pos { color: #27ae60; font-weight: 600; }
.recent-bets .neg { color: #e74c3c; font-weight: 600; }

/* By-game stats table */
.by-game-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.by-game-tbl th, .by-game-tbl td { padding: .55rem .8rem; text-align: left; }
.by-game-tbl th {
    background: #fafbfc; font-weight: 600; color: #555;
    border-bottom: 1px solid #e0e0e0; font-size: 12px;
}
.by-game-tbl td { border-bottom: 1px solid #f0f0f0; }
.by-game-tbl tr:last-child td { border-bottom: none; }
.by-game-tbl .pos { color: #27ae60; font-weight: 600; }
.by-game-tbl .neg { color: #e74c3c; font-weight: 600; }
.by-game-tbl td.num, .by-game-tbl th.num { text-align: right; }

/* Progress bar (win rate) */
.winrate-bar {
    background: #e0e0e0; border-radius: 10px; height: 6px;
    width: 80px; display: inline-block; overflow: hidden; vertical-align: middle;
    margin-right: 6px;
}
.winrate-bar > span { display: block; height: 100%; background: #2ecc71; }
.winrate-bar.lose > span { background: #e74c3c; }

/* Section heading */
.dash-section-title {
    font-size: 14px; font-weight: 700; color: #2c3e50;
    margin: 1rem 0 .5rem 0; text-transform: uppercase; letter-spacing: .5px;
    border-left: 3px solid #3498db; padding-left: .5rem;
}

/* Refresh button */
.dash-refresh {
    background: #fafbfc; border: 1px solid #e0e0e0; color: #555;
    padding: .3rem .75rem; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.dash-refresh:hover { background: #f0f0f0; }
.dash-refresh:disabled { opacity: .5; cursor: not-allowed; }

/* Period selector */
.period-tabs { display: inline-flex; border: 1px solid #e0e0e0; border-radius: 4px; overflow: hidden; }
.period-tabs button {
    background: #fff; border: none; padding: .3rem .75rem; cursor: pointer;
    font-size: 12px; color: #555; border-right: 1px solid #e0e0e0;
}
.period-tabs button:last-child { border-right: none; }
.period-tabs button.active { background: #3498db; color: #fff; }
.period-tabs button:hover:not(.active) { background: #f0f0f0; }

/* ===== Admin management (pages/admins.php) ===== */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .5rem;
    margin-top: .25rem;
    max-height: 320px;
    overflow-y: auto;
    padding: .5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafbfc;
}
.perm-cell {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .55rem;
    background: #fff;
    border: 1px solid #ecf0f1;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    transition: border-color .12s, background .12s;
}
.perm-cell:hover {
    border-color: #3498db;
    background: #f0f8ff;
}
.perm-cell input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #3498db;
}
.perm-cell code {
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 4px;
}
.perm-actions { display: flex; gap: .4rem; }