/* ── NexSMS Custom Styles ─────────────────────────────────────── */

/* Dark mode (default) */
:root,
[data-theme="dark"] {
    --bg-primary:   #0f1117;
    --bg-card:      #1a1d29;
    --bg-elevated:  #20243a;
    --border-color: rgba(255,255,255,.08);
    --text-muted:   #6b7280;
    --brand:        #6366f1;
    --brand-light:  #818cf8;
    --text-default: #e2e8f0;
    --text-secondary: #94a3b8;
    --input-bg:     #20243a;
}

/* Light mode */
[data-theme="light"] {
    --bg-primary:   #f0f2f5;
    --bg-card:      #ffffff;
    --bg-elevated:  #f8f9fc;
    --border-color: rgba(0,0,0,.1);
    --text-muted:   #6b7280;
    --brand:        #6366f1;
    --brand-light:  #4f52cc;
    --text-default: #111827;
    --text-secondary: #374151;
    --input-bg:     #ffffff;
}

[data-theme="light"] body {
    color: var(--text-default);
}
[data-theme="light"] .sidebar {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="light"] .sidebar-link { color: #374151; }
[data-theme="light"] .sidebar-link:hover { color: #111827; background: rgba(0,0,0,.05); }
[data-theme="light"] .sidebar-link.active { color: #fff; background: var(--brand); border-color: var(--brand); }
[data-theme="light"] .top-navbar { background: rgba(255,255,255,.9); }
[data-theme="light"] .card-dark { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="light"] .stat-card { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="light"] .table-dark { --bs-table-bg: transparent; --bs-table-color: #111827; }
[data-theme="light"] .table-dark td, [data-theme="light"] .table-dark th { border-color: var(--border-color); color: #111827; }
[data-theme="light"] .text-secondary { color: #374151 !important; }
[data-theme="light"] .stat-label { color: #6b7280; }
[data-theme="light"] .form-control, [data-theme="light"] .form-select {
    background: var(--input-bg);
    color: #111827;
    border-color: var(--border-color);
}
[data-theme="light"] .alert-success { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.3); color: #16a34a; }
[data-theme="light"] .alert-danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); color: #dc2626; }
[data-theme="light"] .page-link { background: var(--bg-card); color: #374151; border-color: var(--border-color); }
[data-theme="light"] .sidebar-section-title { color: #6b7280; }
[data-theme="light"] .balance-pill { color: #4f52cc; }
[data-theme="light"] footer { background: var(--bg-card); border-color: var(--border-color); }

body {
    background: var(--bg-primary);
    color: var(--text-default, #e2e8f0);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
    width: 248px;
    min-height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    transition: transform .25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.brand-link:hover { opacity: .9; }

.sidebar-link {
    color: #94a3b8;
    border-radius: 8px;
    padding: .45rem .75rem;
    font-size: .875rem;
    transition: all .15s;
    white-space: nowrap;
}
.sidebar-link:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,.06);
}
.sidebar-link.active {
    color: #fff;
    background: rgba(99,102,241,.18);
    border: 1px solid rgba(99,102,241,.25);
}
.sidebar-link.active i { color: var(--brand-light); }

.sidebar-section-title {
    font-size: .65rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 600;
}

.avatar-circle {
    width: 32px; height: 32px;
    background: var(--brand);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .875rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

.sidebar-logout {
    font-size: 1rem;
    padding: .25rem;
    border-radius: 6px;
    transition: color .15s;
}
.sidebar-logout:hover { color: #ef4444 !important; }

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
    min-height: 100vh;
    background: var(--bg-primary);
    overflow-x: hidden;
}

.wrapper { min-height: 100vh; }

/* ── Top Navbar ────────────────────────────────────────────────── */
.top-navbar {
    background: rgba(26,29,41,.8);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.balance-pill {
    display: flex; align-items: center; gap: .5rem;
    background: rgba(99,102,241,.12);
    border: 1px solid rgba(99,102,241,.25);
    border-radius: 20px;
    padding: .25rem .75rem;
    font-size: .8rem;
    color: #c7d2fe;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card-dark {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.card-dark-header {
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* ── Stat Cards ────────────────────────────────────────────────── */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: border-color .2s;
}
.stat-card:hover { border-color: rgba(99,102,241,.3); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-label { font-size: .78rem; color: var(--text-muted); margin-bottom: .15rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }

/* ── Table overrides ───────────────────────────────────────────── */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(255,255,255,.03);
    font-size: .875rem;
}
.table-dark thead tr { border-bottom: 1px solid var(--border-color); }
.table-dark td, .table-dark th { border-color: var(--border-color); padding: .75rem 1rem; vertical-align: middle; }

/* ── Badges ────────────────────────────────────────────────────── */
.status-processing { background: rgba(234,179,8,.15);  color: #fbbf24; border: 1px solid rgba(234,179,8,.3); }
.status-completed  { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.status-failed     { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.status-pending    { background: rgba(148,163,184,.15);color: #94a3b8; border: 1px solid rgba(148,163,184,.3); }
.status-scheduled  { background: rgba(99,102,241,.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,.3); }
.status-cancelled  { background: rgba(107,114,128,.15);color: #9ca3af; border: 1px solid rgba(107,114,128,.3); }

.badge-role-admin    { background: rgba(239,68,68,.15); color:#f87171; border:1px solid rgba(239,68,68,.3); }
.badge-role-reseller { background: rgba(234,179,8,.15); color:#fbbf24; border:1px solid rgba(234,179,8,.3); }
.badge-role-customer { background: rgba(34,197,94,.15); color:#4ade80; border:1px solid rgba(34,197,94,.3); }

.badge-tx-sms-charge   { background: rgba(239,68,68,.15); color:#f87171; }
.badge-tx-transfer-in  { background: rgba(34,197,94,.15); color:#4ade80; }
.badge-tx-transfer-out { background: rgba(234,179,8,.15); color:#fbbf24; }
.badge-tx-topup        { background: rgba(99,102,241,.15);color:#a5b4fc; }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}

/* ── Drop Zone ─────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed rgba(99,102,241,.35);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    color: #94a3b8;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--brand);
    background: rgba(99,102,241,.06);
    color: #c7d2fe;
}

/* ── Alerts ────────────────────────────────────────────────────── */
.alert-success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.alert-secondary { background: var(--bg-elevated); border-color: var(--border-color); }

/* ── Pagination ────────────────────────────────────────────────── */
.page-link {
    background: var(--bg-elevated);
    border-color: var(--border-color);
    color: #94a3b8;
    border-radius: 6px !important;
    margin: 0 2px;
}
.page-link:hover { background: rgba(99,102,241,.15); color: #fff; border-color: var(--brand); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Page Content ──────────────────────────────────────────────── */
.page-content { max-width: 1400px; }

/* ── Mobile Sidebar ────────────────────────────────────────────── */
@media (max-width: 1199px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 1050;
        transform: translateX(-100%);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { width: 100%; }
}

/* ── Modal overrides ───────────────────────────────────────────── */
.modal-content { border-radius: 12px; }
.btn-close-white { filter: invert(1); }

/* ── Utilities ─────────────────────────────────────────────────── */
.font-monospace { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: .85em; }
.text-primary { color: var(--brand-light) !important; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: #4f52d0; border-color: #4f52d0; }
.btn-outline-primary { color: var(--brand-light); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); color: #fff; }

footer { background: var(--bg-card); border-top: 1px solid var(--border-color); }
