/* ============================================================
   CryptoGate Merchant Dashboard — dashboard.css
   ============================================================ */

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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1a1a2e;
  --border: rgba(255,255,255,0.08);
  --text: #f0f0f8;
  --text-muted: #8888aa;
  --accent: #6c63ff;
  --accent2: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-w: 240px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  font-size: 22px;
  background: linear-gradient(135deg, #6c63ff, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.logo-accent { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: rgba(108,99,255,0.08); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,0.14); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 1rem; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role { font-size: 0.72rem; color: var(--text-muted); }

.btn-logout {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--danger);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-logout:hover { background: rgba(239,68,68,0.2); }

/* ── Mobile header ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 90;
}

.hamburger-btn, .btn-logout-sm {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  max-width: 1100px;
}

/* ── Sections ── */
.section { display: none; }
.section.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.page-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }

.header-actions { display: flex; align-items: center; gap: 12px; }

.live-time {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover { border-color: rgba(108,99,255,0.3); transform: translateY(-2px); }

.stat-icon { font-size: 1.8rem; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }

.stat-card.loading .stat-value { color: var(--text-muted); }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 { font-size: 1rem; font-weight: 600; }

.btn-sm {
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.2);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.btn-sm:hover { background: rgba(108,99,255,0.2); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.loading-row { text-align: center; padding: 32px !important; color: var(--text-muted); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-COMPLETED { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-PENDING { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-CONFIRMING { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-EXPIRED { background: rgba(239,68,68,0.12); color: #ef4444; }
.badge-UNDERPAID { background: rgba(168,85,247,0.15); color: #a855f7; }
.badge-OVERPAID { background: rgba(16,185,129,0.12); color: #10b981; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 4px;
}

.page-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}

.page-btn:hover, .page-btn.current { border-color: var(--accent); color: var(--accent); }

/* ── Filter ── */
.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--accent); }

.key-row { display: flex; flex-direction: column; gap: 12px; }

.key-label-lg {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-public {
  background: rgba(16,185,129,0.15);
  color: #10b981;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.badge-private {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.key-desc { font-size: 0.84rem; color: var(--text-muted); }
.key-desc code { background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 4px; font-size: 0.78rem; }

.key-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}

.key-display code {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--accent2);
  word-break: break-all;
  flex: 1;
}

.copy-btn {
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.3);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.2s;
}

.copy-btn:hover { background: rgba(108,99,255,0.25); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  align-self: flex-start;
}

.btn-danger:hover { background: rgba(239,68,68,0.18); }

.new-secret-box { margin-bottom: 12px; }

.warning-banner {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--warning);
  margin-bottom: 10px;
}

/* ── Code blocks ── */
.code-block {
  background: #0d0d16;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: #a5f3c0;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
}

/* ── Integration guide ── */
.guide-steps { display: flex; flex-direction: column; gap: 20px; }

.guide-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.step-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.step-body h3 { font-size: 1rem; font-weight: 700; }
.step-body p { font-size: 0.85rem; color: var(--text-muted); }
.step-body code { background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 4px; font-size: 0.78rem; color: var(--accent2); }

.currency-list { display: flex; flex-wrap: wrap; gap: 8px; }

.cur-badge {
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.2);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── Settings ── */
.form-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
label { font-size: 0.83rem; font-weight: 600; color: var(--text); }

input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.12); }
input::placeholder { color: var(--text-muted); }
input:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.success-banner {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--accent2);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.error-banner {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--danger);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.4);
  }
  .sidebar-overlay.open { display: block; }
  .mobile-header { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 80px 16px 24px;
  }
  .guide-step { flex-direction: column; gap: 12px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.3rem; }
}
