/* Wallet Admin Panel — walletadmin.apideals.org */
/* Airbnb design system */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Surfaces */
    --bg:             #f7f7f7;
    --surface:        #ffffff;
    --surface2:       #f7f7f7;

    /* Text */
    --text:           #222222;
    --text-secondary: #6a6a6a;
    --text-disabled:  rgba(0,0,0,0.24);

    /* Borders */
    --border:         #dddddd;
    --border-strong:  #b0b0b0;

    /* Brand / accent */
    --accent:         #ff385c;   /* Rausch Red */
    --accent-hover:   #e00b41;

    /* Semantic */
    --green:          #008489;
    --green-bg:       rgba(0,132,137,0.10);
    --red:            #c13515;
    --red-bg:         rgba(193,53,21,0.10);
    --orange:         #c45c00;
    --orange-bg:      rgba(196,92,0,0.10);
    --blue:           #428bff;
    --blue-bg:        rgba(66,139,255,0.10);

    /* Shadows */
    --shadow-card:    rgba(0,0,0,0.02) 0px 0px 0px 1px,
                      rgba(0,0,0,0.04) 0px 2px 6px,
                      rgba(0,0,0,0.10) 0px 4px 8px;
    --shadow-hover:   rgba(0,0,0,0.08) 0px 4px 12px;

    /* Radii */
    --radius-sm:   8px;
    --radius-badge: 14px;
    --radius-card:  20px;
    --radius-lg:    32px;
}

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

body {
    font-family: 'Inter', Circular, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────── */
#app { max-width: 1200px; margin: 0 auto; padding: 24px; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}
header h1 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
header .user-info { display: flex; align-items: center; gap: 12px; }

/* ── Login ───────────────────────────────────────────── */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-card);
    padding: 40px;
    width: 400px;
    box-shadow: var(--shadow-card);
}
.login-card h2 {
    margin-bottom: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 1.375rem;
    letter-spacing: -0.02em;
}

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

input, select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 400;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: auto;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--text);
}
input::placeholder { color: var(--text-secondary); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
/* Primary: dark → Rausch Red on hover */
.btn-primary { background: #222222; color: #fff; }
.btn-primary:hover { background: var(--accent); box-shadow: var(--shadow-hover); }

/* Danger: Rausch Red (debit / destructive) */
.btn-danger { background: var(--accent); color: #fff; }
.btn-danger:hover { background: var(--accent-hover); }

/* Success: teal (credit / positive) */
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #006e73; }

/* Outline */
.btn-outline {
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    color: var(--text);
}
.btn-outline:hover { background: var(--surface2); box-shadow: var(--shadow-hover); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Navigation tabs ─────────────────────────────────── */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
    flex-wrap: wrap;
    background: var(--surface);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    padding: 0 4px;
    box-shadow: var(--shadow-card);
}
.nav-tab {
    padding: 14px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

/* ── Cards ───────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-card);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-badge);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-red    { background: var(--red-bg);    color: var(--red);    }
.badge-blue   { background: var(--blue-bg);   color: var(--blue);   }
.badge-gray   { background: rgba(0,0,0,0.06); color: var(--text-secondary); }

/* ── Mono ────────────────────────────────────────────── */
.mono { font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace; font-size: 0.78rem; }
.truncate { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* ── Grids ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    #app { padding: 16px; }
}

/* ── Filter bar ──────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ── Pagination ──────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 2px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ── Loading ─────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
    color: var(--text-secondary);
    gap: 12px;
    font-size: 0.875rem;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 500;
}
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(193,53,21,0.2); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(0,132,137,0.2); }

/* ── Modals ──────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius-card);
    padding: 28px;
    width: 460px;
    max-width: 90vw;
    box-shadow: var(--shadow-hover);
}
.modal h3 { margin-bottom: 20px; font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ── Utility ─────────────────────────────────────────── */
.text-dim   { color: var(--text-secondary); }
.text-right { text-align: right; }
.mb-4       { margin-bottom: 16px; }
.mt-4       { margin-top: 16px; }
.hidden     { display: none !important; }

/* ── Address display ─────────────────────────────────── */
.address-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    margin-bottom: 8px;
}
.address-display .addr { font-family: 'SF Mono', monospace; font-size: 0.78rem; word-break: break-all; }

/* ── Stat box ────────────────────────────────────────── */
.stat-box {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-card);
}
.stat-box .value { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stat-box .label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Login card top row ───────────────────────────────── */
.login-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.login-card-top h2 { margin-bottom: 0; text-align: left; }

/* ── Theme toggle button ─────────────────────────────── */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.btn-theme-toggle:hover { background: var(--surface2); }

/* Show moon in daylight, sun in dark */
.btn-theme-toggle .icon-sun  { display: none; }
.btn-theme-toggle .icon-moon { display: flex; }
html[data-theme="dark"] .btn-theme-toggle .icon-sun  { display: flex; }
html[data-theme="dark"] .btn-theme-toggle .icon-moon { display: none; }

/* Sun glows amber in dark mode */
html[data-theme="dark"] .btn-theme-toggle { color: #fcd34d; }
html[data-theme="dark"] .btn-theme-toggle:hover { background: #334155; }

/* ── Dark mode variable overrides ────────────────────── */
html[data-theme="dark"] {
    --bg:             #0f172a;
    --surface:        #1e293b;
    --surface2:       #334155;
    --border:         #334155;
    --border-strong:  #475569;
    --text:           #f1f5f9;
    --text-secondary: #94a3b8;
    --text-disabled:  rgba(255,255,255,0.24);

    /* Lighter semantic colors for dark backgrounds */
    --green:      #34d399;
    --green-bg:   rgba(52,211,153,0.12);
    --red:        #f87171;
    --red-bg:     rgba(248,113,113,0.12);
    --orange:     #fb923c;
    --orange-bg:  rgba(251,146,60,0.12);
    --blue:       #60a5fa;
    --blue-bg:    rgba(96,165,250,0.12);

    /* Stronger shadows on dark backgrounds */
    --shadow-card:  rgba(0,0,0,0.4) 0px 0px 0px 1px,
                    rgba(0,0,0,0.25) 0px 2px 6px,
                    rgba(0,0,0,0.35) 0px 4px 8px;
    --shadow-hover: rgba(0,0,0,0.5) 0px 4px 12px;
}

/* Dark mode component adjustments */
html[data-theme="dark"] input,
html[data-theme="dark"] select {
    background: var(--surface2);
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,56,92,0.25);
}
html[data-theme="dark"] .btn-primary {
    background: #f1f5f9;
    color: #222222;
}
html[data-theme="dark"] .btn-primary:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-hover);
}
html[data-theme="dark"] .btn-outline {
    border-color: var(--border-strong);
    color: var(--text);
}
html[data-theme="dark"] .btn-outline:hover {
    background: var(--surface2);
    box-shadow: none;
}
html[data-theme="dark"] .spinner {
    border-color: var(--border);
    border-top-color: var(--text-secondary);
}
