/* ============================================
   BITALITY APP — DASHBOARD SHELL
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
*::selection { background: var(--cyan); color: var(--bg); }

:root {
    --bg: #050608;
    --bg-elev: #0a0c10;
    --bg-elev-2: #0e1116;
    --bg-hover: #14181f;
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.12);
    --border-cyan: rgba(0,243,255,0.25);
    --ink: #e8ecf0;
    --ink-dim: rgba(232,236,240,0.6);
    --ink-faint: rgba(232,236,240,0.35);
    --cyan: #00f3ff;
    --btc: #ff9500;
    --green: #00ff88;
    --red: #ff4757;
    --purple: #bd00ff;
    --yellow: #ffd60a;

    --glass: rgba(255,255,255,0.02);

    --font-display: 'Unbounded', sans-serif;
    --font-body: 'Figtree', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --sidebar-w: 240px;
    --topbar-h: 56px;
}

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}
.bg-glow {
    position: fixed;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(0,243,255,0.04), transparent 70%);
    top: -200px; left: -200px;
    pointer-events: none;
    z-index: 0;
}
.bg-glow.b2 {
    background: radial-gradient(circle, rgba(255,149,0,0.03), transparent 70%);
    top: auto; left: auto; bottom: -200px; right: -200px;
}

/* ============================================
   APP SHELL
   ============================================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.sb-brand {
    padding: 6px 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.sb-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sb-brand img {
    height: 22px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}
/* the wordmark already reads "BITALITY"; text is only a fallback if the image fails */
.sb-brand .brand-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
    display: none;
}
.sb-brand .brand-text .dot { color: var(--cyan); }
.sb-brand .env-badge {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 2px 6px;
    border: 1px solid var(--green);
    color: var(--green);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sb-nav { padding: 0 8px; flex: 1; }
.sb-section {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--ink-faint);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 14px 12px 8px;
}
.sb-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 0.86rem;
    color: var(--ink-dim);
    transition: all 0.15s;
    margin-bottom: 1px;
    position: relative;
}
.sb-link i {
    width: 16px;
    text-align: center;
    font-size: 0.92rem;
    color: var(--ink-faint);
    transition: color 0.15s;
}
.sb-link:hover {
    background: var(--bg-hover);
    color: var(--ink);
}
.sb-link:hover i { color: var(--cyan); }
.sb-link.active {
    background: rgba(0,243,255,0.06);
    color: var(--cyan);
}
.sb-link.active i { color: var(--cyan); }
.sb-link.active::before {
    content: '';
    position: absolute;
    left: -8px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 18px;
    background: var(--cyan);
    border-radius: 0 2px 2px 0;
}
.sb-link .badge {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    padding: 2px 6px;
    background: var(--btc);
    color: var(--bg);
    border-radius: 3px;
    font-weight: 700;
}
.sb-link .badge.dot {
    width: 6px; height: 6px; padding: 0;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.sb-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.sb-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
.sb-stat .label { color: var(--ink-faint); }
.sb-stat .val { color: var(--ink); }
.sb-stat .val.up { color: var(--green); }
.sb-stat .val.down { color: var(--red); }
.sb-network {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
.sb-network .ind {
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
}
.sb-network .net-name { color: var(--ink); }
.sb-network .block-num { margin-left: auto; color: var(--cyan); }

/* ============================================
   TOPBAR
   ============================================ */
.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    height: var(--topbar-h);
    background: rgba(10,12,16,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.tb-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.tb-search input {
    width: 100%;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 14px 8px 36px;
    color: var(--ink);
    font-size: 0.84rem;
    transition: border-color 0.15s;
}
.tb-search input:focus { outline: none; border-color: var(--border-cyan); }
.tb-search input::placeholder { color: var(--ink-faint); }
.tb-search i {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    font-size: 0.84rem;
}
.tb-search .kbd {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    padding: 2px 6px;
    border: 1px solid var(--border-strong);
    color: var(--ink-dim);
    border-radius: 3px;
}

.tb-spacer { flex: 1; }

.tb-actions { display: flex; align-items: center; gap: 8px; }
.tb-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elev-2);
    color: var(--ink-dim);
    transition: all 0.15s;
    position: relative;
}
.tb-btn:hover { color: var(--cyan); border-color: var(--border-cyan); }
.tb-btn .dot-notif {
    position: absolute;
    top: 6px; right: 6px;
    width: 6px; height: 6px;
    background: var(--btc);
    border-radius: 50%;
}

.tb-lang {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}
.tb-lang span {
    padding: 4px 8px;
    cursor: pointer;
    color: var(--ink-faint);
    border-radius: 3px;
    transition: all 0.15s;
}
.tb-lang span.active { background: var(--cyan); color: var(--bg); }

.tb-wallet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.tb-wallet:hover { border-color: var(--border-cyan); }
.tb-wallet .avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
}
.tb-wallet .addr {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink);
}
.tb-wallet .bal {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--cyan);
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.page-content {
    padding: 28px 32px 60px;
    max-width: 1600px;
    width: 100%;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title-block .crumb {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}
.page-title-block h1 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.page-title-block .desc {
    color: var(--ink-dim);
    font-size: 0.9rem;
    max-width: 600px;
}

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.15s;
    border: 1px solid var(--border);
    background: var(--bg-elev-2);
    color: var(--ink);
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn.primary {
    background: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
    font-weight: 600;
}
.btn.primary:hover { background: #00d0db; box-shadow: 0 0 24px rgba(0,243,255,0.3); }
.btn.btc { background: var(--btc); color: var(--bg); border-color: var(--btc); font-weight: 600; }
.btn.btc:hover { background: #e88600; }
.btn.danger { color: var(--red); border-color: rgba(255,71,87,0.3); }
.btn.danger:hover { background: rgba(255,71,87,0.08); border-color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 0.74rem; }
.btn.ghost { background: transparent; }
.btn i { font-size: 0.78rem; }

/* ============================================
   PANELS / CARDS
   ============================================ */
.panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.panel-head h3 {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.panel-head .live-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--green);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.panel-head .live-dot::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

/* ============================================
   STAT CARDS
   ============================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card .stat-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-card .stat-label i { color: var(--cyan); }
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 6px;
}
.stat-card .stat-value .unit {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--ink-faint);
    margin-left: 4px;
}
.stat-card .stat-change {
    font-family: var(--font-mono);
    font-size: 0.74rem;
}
.stat-card .stat-change.up { color: var(--green); }
.stat-card .stat-change.down { color: var(--red); }
.stat-card .stat-change.flat { color: var(--ink-faint); }

.stat-card .mini-spark {
    position: absolute;
    bottom: 0; right: 0;
    width: 70px; height: 24px;
    opacity: 0.5;
}

/* ============================================
   TABLES
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead th {
    text-align: left;
    padding: 10px 18px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table .mono { font-family: var(--font-mono); font-size: 0.78rem; }
.data-table .cyan { color: var(--cyan); }
.data-table .dim { color: var(--ink-dim); }

/* ============================================
   STATUS / TAGS
   ============================================ */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    padding: 3px 8px;
    border-radius: 3px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid;
    line-height: 1;
}
.tag.active { color: var(--green); border-color: rgba(0,255,136,0.3); background: rgba(0,255,136,0.06); }
.tag.pending { color: var(--btc); border-color: rgba(255,149,0,0.3); background: rgba(255,149,0,0.06); }
.tag.failed { color: var(--red); border-color: rgba(255,71,87,0.3); background: rgba(255,71,87,0.06); }
.tag.info { color: var(--cyan); border-color: rgba(0,243,255,0.3); background: rgba(0,243,255,0.06); }
.tag.neutral { color: var(--ink-dim); border-color: var(--border-strong); background: var(--glass); }
.tag.purple { color: var(--purple); border-color: rgba(189,0,255,0.3); background: rgba(189,0,255,0.06); }

/* ============================================
   INPUTS
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--ink);
    font-size: 0.88rem;
    transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--border-cyan);
}
.form-input.mono { font-family: var(--font-mono); }
.form-textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: 0.82rem; }
.form-hint { font-size: 0.74rem; color: var(--ink-faint); margin-top: 4px; }

.input-group { display: flex; align-items: center; gap: 8px; }
.input-suffix {
    padding: 10px 14px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--ink-dim);
}

/* ============================================
   PROGRESS / BARS
   ============================================ */
.progress {
    width: 100%;
    height: 6px;
    background: var(--bg-elev-2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.progress > div {
    height: 100%;
    background: var(--cyan);
    border-radius: 3px;
    transition: width 0.4s;
}
.progress > div.green { background: var(--green); }
.progress > div.btc { background: var(--btc); }
.progress > div.red { background: var(--red); }

/* ============================================
   GRID LAYOUTS
   ============================================ */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.col-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.col-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.col-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    padding: 60px 40px;
    text-align: center;
    color: var(--ink-faint);
}
.empty-state i {
    font-size: 2rem;
    color: var(--ink-faint);
    margin-bottom: 16px;
}
.empty-state h4 { font-family: var(--font-display); margin-bottom: 6px; color: var(--ink); }
.empty-state p { font-size: 0.84rem; }

/* ============================================
   MOBILE
   ============================================ */
.mobile-menu-toggle {
    display: none;
    width: 34px; height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elev-2);
    color: var(--ink);
}

@media (max-width: 992px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: 0; left: -260px;
        width: var(--sidebar-w);
        z-index: 100;
        transition: left 0.3s;
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .sidebar.open { left: 0; }
    .mobile-menu-toggle { display: flex; }
    .tb-search { max-width: none; }
    .col-2, .col-3, .col-2-1, .col-1-2 { grid-template-columns: 1fr; }
    .page-content { padding: 20px 16px 40px; }
}
@media (max-width: 640px) {
    .tb-search { display: none; }
    .tb-wallet .bal { display: none; }
    .stat-card .stat-value { font-size: 1.4rem; }
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}
.sidebar-backdrop.show { display: block; }

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-head h3 { font-family: var(--font-display); font-size: 1rem; }
.modal-close {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    color: var(--ink-faint);
    transition: all 0.15s;
}
.modal-close:hover { color: var(--ink); background: var(--bg-hover); }
.modal-body { padding: 20px; }
.modal-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================
   UTILITIES
   ============================================ */
.mono { font-family: var(--font-mono); }
.cyan { color: var(--cyan); }
.btc { color: var(--btc); }
.green { color: var(--green); }
.red { color: var(--red); }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.text-xs { font-size: 0.72rem; }
.text-sm { font-size: 0.82rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.4rem; font-family: var(--font-display); font-weight: 700; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
