/* ==========================================
   Zee Bet — Design System
   ========================================== */

:root {
    --zb-bg:           #f8fafc;
    --zb-surface:      #ffffff;
    --zb-border:       #e2e8f0;
    --zb-text:         #1e293b;
    --zb-muted:        #64748b;
    --zb-nav:          #0f172a;
    --zb-primary:      #4f46e5;
    --zb-primary-lt:   #eef2ff;
    --zb-success:      #16a34a;
    --zb-danger:       #dc2626;
    --zb-warning-bg:   #fffbeb;
    --zb-warning-text: #92400e;
    --zb-shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.06);
    --zb-radius:       12px;
}

/* ---- Base -------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--zb-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--zb-text);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---- Navbar ------------------------------ */
.zb-navbar {
    background: var(--zb-nav);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(255,255,255,.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.zb-navbar .navbar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.zb-navbar .nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Cards ------------------------------- */
.zb-card {
    background: var(--zb-surface);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius);
    box-shadow: var(--zb-shadow);
    overflow: hidden;
}

.zb-card-header {
    padding: 12px 16px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--zb-muted);
    border-bottom: 1px solid var(--zb-border);
    background: #f8fafc;
}

/* ---- Stat Cards -------------------------- */
.stat-card {
    background: var(--zb-surface);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius);
    box-shadow: var(--zb-shadow);
    padding: 14px 12px;
    text-align: center;
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

.stat-icon   { font-size: 1.4rem; line-height: 1; margin-bottom: 6px; }
.stat-value  { font-size: 1.4rem; font-weight: 800; line-height: 1.1; margin-bottom: 2px; }
.stat-label  { font-size: .7rem; color: var(--zb-muted); text-transform: uppercase; letter-spacing: .5px; }

@media (min-width: 576px) {
    .stat-value { font-size: 1.75rem; }
    .stat-icon  { font-size: 1.6rem; }
}

/* ---- Commission Cards -------------------- */
.comm-card {
    background: var(--zb-surface);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius);
    box-shadow: var(--zb-shadow);
    padding: 22px 20px;
}

.comm-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--zb-muted); margin-bottom: 6px; }
.comm-value { font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.comm-sub   { font-size: .78rem; color: var(--zb-muted); }

/* ---- Tables ------------------------------ */
.zb-table { width: 100%; border-collapse: collapse; }

.zb-table thead th {
    padding: 10px 14px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--zb-muted);
    border-bottom: 1px solid var(--zb-border);
    background: #f8fafc;
    white-space: nowrap;
}

.zb-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.zb-table tbody tr:last-child td { border-bottom: none; }

/* ---- User Rows --------------------------- */
.user-row { cursor: pointer; transition: background .12s; }
.user-row:hover { background: #f1f5f9 !important; }

.user-name { font-weight: 600; font-size: .95rem; color: var(--zb-text); }
.user-area { font-size: .78rem; color: var(--zb-muted); margin-top: 1px; }

/* ---- Balance Colors ---------------------- */
.balance-positive, .text-zb-success { color: var(--zb-success) !important; font-weight: 700; }
.balance-negative, .text-zb-danger  { color: var(--zb-danger)  !important; font-weight: 700; }
.balance-zero                        { color: var(--zb-muted)   !important; font-weight: 700; }

/* ---- Tabs -------------------------------- */
.zb-tabs {
    display: flex;
    border-bottom: 2px solid var(--zb-border);
    margin-bottom: 20px;
    gap: 0;
}

.zb-tab {
    padding: 10px 20px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--zb-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s;
}

.zb-tab:hover { color: var(--zb-primary); }
.zb-tab.active { color: var(--zb-primary); border-bottom-color: var(--zb-primary); }

/* ---- Search Input ------------------------ */
.zb-search {
    height: 46px;
    font-size: .95rem;
    border-radius: 8px;
    border: 1px solid var(--zb-border);
    padding: 0 14px;
    width: 100%;
    outline: none;
    background: var(--zb-surface);
    color: var(--zb-text);
    transition: border-color .15s, box-shadow .15s;
}

.zb-search::placeholder { color: var(--zb-muted); }

.zb-search:focus {
    border-color: var(--zb-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

/* ---- Buttons ----------------------------- */
.btn { min-height: 40px; font-weight: 500; }

.zb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    min-height: 40px;
    white-space: nowrap;
}

.zb-btn-primary   { background: var(--zb-primary); color: #fff; }
.zb-btn-primary:hover { background: #4338ca; color: #fff; }

.zb-btn-success   { background: var(--zb-success); color: #fff; }
.zb-btn-success:hover { background: #15803d; color: #fff; }

.zb-btn-danger    { background: var(--zb-danger); color: #fff; }
.zb-btn-danger:hover { background: #b91c1c; color: #fff; }

.zb-btn-ghost {
    background: transparent;
    color: var(--zb-muted);
    border: 1px solid var(--zb-border);
}
.zb-btn-ghost:hover { background: #f1f5f9; color: var(--zb-text); }

.zb-btn-warning { background: #f59e0b; color: #fff; }
.zb-btn-warning:hover { background: #d97706; color: #fff; }

.zb-btn-outline-danger {
    background: transparent;
    color: var(--zb-danger);
    border: 1px solid var(--zb-danger);
}
.zb-btn-outline-danger:hover { background: #fef2f2; }

.zb-btn-sm { padding: 5px 12px; font-size: .8rem; min-height: 32px; }
.zb-btn-lg { padding: 13px 20px; font-size: 1rem; min-height: 48px; }
.zb-btn-full { width: 100%; }

/* ---- Form Controls ----------------------- */
.zb-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--zb-text);
    margin-bottom: 6px;
}

.zb-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--zb-border);
    border-radius: 8px;
    font-size: .95rem;
    color: var(--zb-text);
    background: var(--zb-surface);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.zb-input:focus {
    border-color: var(--zb-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.zb-input-lg { height: 50px; font-size: 1.05rem; }
.zb-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.field-group { margin-bottom: 18px; }
.field-hint  { font-size: .78rem; color: var(--zb-muted); margin-top: 5px; }

/* ---- Profile Page ------------------------ */
.profile-card {
    background: var(--zb-surface);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius);
    box-shadow: var(--zb-shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.profile-name     { font-size: 1.35rem; font-weight: 700; color: var(--zb-text); }
.profile-area     { color: var(--zb-muted); font-size: .88rem; margin-top: 2px; }
.profile-balance  { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.commission-val   { font-size: .9rem; font-weight: 700; color: var(--zb-success); }
.tx-note          { font-size: .75rem; color: var(--zb-muted); margin-top: 3px; }
.badge-type       { font-size: .68rem; font-weight: 700; padding: 3px 7px; border-radius: 4px; }

@media (max-width: 576px) {
    .profile-balance { font-size: 1.9rem; }
    .hide-mobile     { display: none !important; }
}

/* ---- Form Page --------------------------- */
.form-page {
    max-width: 520px;
    margin: 0 auto;
}

.form-card {
    background: var(--zb-surface);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius);
    box-shadow: var(--zb-shadow);
    padding: 28px 24px;
}

/* ---- Mode Selector ----------------------- */
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.mode-opt input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.mode-opt label {
    display: block;
    cursor: pointer;
    position: relative;
}
.mode-label {
    display: block;
    padding: 14px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    font-size: .9rem;
    text-align: center;
    background: #f8fafc;
    transition: all .15s;
    color: #64748b;
}
.mode-opt input[type="radio"]:checked ~ .mode-label,
.mode-opt input[type="radio"]:checked + .mode-label { border-color: var(--zb-primary); background: #eef2ff; color: var(--zb-primary); }
.mode-opt input[type="radio"]:checked ~ .mode-label.mode-sub,
.mode-opt input[type="radio"]:checked + .mode-label.mode-sub { border-color: var(--zb-danger); background: #fef2f2; color: var(--zb-danger); }
.mode-opt.subtract input[type="radio"]:checked ~ .mode-label,
.mode-opt.subtract input[type="radio"]:checked + label { border-color: var(--zb-danger); background: #fef2f2; color: var(--zb-danger); }
.mode-opt.set-mode input[type="radio"]:checked ~ .mode-label,
.mode-opt.set-mode input[type="radio"]:checked + label { border-color: #475569; background: #f1f5f9; color: #334155; }

/* ---- Admin Badge ------------------------- */
.role-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: .3px;
}
.role-super { background: var(--zb-warning-bg); color: var(--zb-warning-text); }
.role-admin { background: var(--zb-primary-lt); color: var(--zb-primary); }

/* ---- Login Page -------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
    background: var(--zb-surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
}

.login-logo  { font-size: 2.8rem; line-height: 1; margin-bottom: 8px; }
.login-title { font-size: 1.5rem; font-weight: 800; color: var(--zb-text); }
.login-sub   { font-size: .88rem; color: var(--zb-muted); }

/* ---- Alert variants ---------------------- */
.zb-alert {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: .88rem;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.zb-alert-success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.zb-alert-danger  { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.zb-alert-warning { background: var(--zb-warning-bg); border-color: #fde68a; color: var(--zb-warning-text); }

/* ---- Back link --------------------------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--zb-muted);
    text-decoration: none;
    font-size: .87rem;
    margin-bottom: 16px;
    transition: color .12s;
}
.back-link:hover { color: var(--zb-text); }

/* ---- Page title -------------------------- */
.page-title { font-size: 1.15rem; font-weight: 700; color: var(--zb-text); margin: 0 0 16px; }

/* ---- Divider ----------------------------- */
.zb-divider { border: none; border-top: 1px solid var(--zb-border); margin: 20px 0; }

/* ---- Danger box (delete page) ------------ */
.danger-box {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

/* ---- Responsive container ---------------- */
.zb-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 16px;
}

.zb-container-sm {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px;
}
