/*
 * File: assets/css/account.css
 * Description: Front-end styles for the Nister Account dashboard UI.
 * Notes:
 * - Mirrors the inline CSS in templates/account.php, but extracted so sites can cache it.
 * - Uses system fonts and avoids external assets.
 * - Provides accessible focus states and reduced-motion fallbacks.
 */

/* Root defaults */
:root {
  --nister-text: #0f172a;
  --nister-muted: #475569;
  --nister-border: #e5e7eb;
  --nister-border-strong: #dbe2ea;
  --nister-bg: #ffffff;
  --nister-bg-soft: #f8fafc;
  --nister-shadow: 0 8px 24px rgba(16,38,105,0.06);

  --nister-blue: #2563eb;
  --nister-blue-50: #e7f0ff;
  --nister-green: #065f46;
  --nister-green-50: #e6fbf4;
  --nister-warn: #b45309;
  --nister-warn-50: #fff7ed;
  --nister-danger: #991b1b;
  --nister-danger-50: #fef2f2;
  --nister-danger-border: #fecaca;

  --nister-radius: 16px;
  --nister-radius-sm: 12px;

  --nister-focus: 2px solid rgba(37, 99, 235, 0.6);
}

/* Container */
.nister-wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--nister-text);
}

/* Header */
.nister-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.nister-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.nister-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  background: #e5e7eb;
  color: var(--nister-text);
  white-space: nowrap;
  text-decoration: none;
}
.badge.blue  { background: var(--nister-blue-50);  color: #1e40af; }
.badge.green { background: var(--nister-green-50); color: var(--nister-green); }
.badge.warn  { background: var(--nister-warn-50);  color: var(--nister-warn); }

/* Tabs */
.nister-tabs {
  margin: 14px 0 10px;
  display: flex;
  gap: 10px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: center;
}
.nister-tabs::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--nister-radius-sm);
  border: 1px solid var(--nister-border-strong);
  background: var(--nister-bg-soft);
  color: var(--nister-text);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  transition: border-color .15s, box-shadow .15s, background .15s, color .15s;
  white-space: nowrap;
  text-decoration: none;
}
.tab:hover { border-color: #94a3b8; }
.tab[aria-selected="true"] {
  background: var(--nister-bg);
  border-color: var(--nister-blue);
  color: var(--nister-blue);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.08) inset;
}
.tab svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* Layout grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 18px; }
}

/* Cards */
.card {
  border: 1px solid var(--nister-border);
  border-radius: var(--nister-radius);
  background: var(--nister-bg);
  overflow: hidden;
  box-shadow: var(--nister-shadow);
}
.card h3 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  background: var(--nister-bg-soft);
  font-size: 18px;
  font-weight: 800;
}
.body { padding: 16px; }

/* Fields */
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--nister-radius-sm);
  background: var(--nister-bg-soft);
  outline: none;
}
.field textarea { min-height: 90px; resize: vertical; }

.hint,
.subtle { color: var(--nister-muted); font-size: 12px; }
.subtle { font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--nister-radius-sm);
  border: 0;
  background: var(--nister-blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
}
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--nister-bg); border: 1px solid #cbd5e1; color: var(--nister-text); }
.btn.red   { background: #dc2626; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .actions .btn { flex: 0 0 auto; } }

/* Alerts */
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  margin: 10px 0;
  font-weight: 700;
  border: 1px solid transparent;
}
.alert.success { background: #ecfdf5; color: var(--nister-green); border-color: #a7f3d0; }
.alert.error   { background: var(--nister-danger-50); color: var(--nister-danger); border-color: var(--nister-danger-border); }
.alert.warn    { background: var(--nister-warn-50); color: var(--nister-warn); border-color: #fed7aa; }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #eef2f7;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--nister-muted);
}

/* KPI blocks */
.kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.kpi .box {
  border: 1px solid var(--nister-border);
  border-radius: var(--nister-radius-sm);
  padding: 12px;
  background: #fbfdff;
}
.kpi .box .label { font-size: 12px; color: var(--nister-muted); }
.kpi .box .value { font-weight: 900; font-size: 18px; margin-top: 4px; }

/* Code-like chips */
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  border-radius: 8px;
  display: inline-block;
  word-break: break-all;
}

/* Wallet blocks */
.wallet-block {
  border: 1px dashed #cbd5e1;
  border-radius: var(--nister-radius-sm);
  padding: 12px;
  background: #fbfdff;
}
.wallet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Brokers list */
.broker-list { list-style: none; padding: 0; margin: 0; }
.broker-list li {
  border: 1px solid var(--nister-border);
  border-radius: var(--nister-radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--nister-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.broker-list .meta { font-size: 12px; color: var(--nister-muted); }

/* Panels (hidden by JS toggling [hidden]) */
.tab-panel[hidden] { display: none !important; }

/* Focus states */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
.btn:focus,
.tab:focus,
.code:focus {
  outline: var(--nister-focus);
  outline-offset: 2px;
  box-shadow: none;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Print tweaks */
@media print {
  .nister-tabs, .btn, .actions, .alert { display: none !important; }
  .card { box-shadow: none; border-color: #cbd5e1; }
}
