/* ============================================================
   Finsova B2B Partner Portal — Light Theme Design System
   ============================================================ */

:root {
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;

  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #c7d2fe;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0ea5e9;
  --secondary-light: #e0f2fe;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  --ink-heading: #0f172a;
  --ink-body: #334155;
  --ink-muted: #64748b;
  --ink-light: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 45px -10px rgba(15, 23, 42, 0.12);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--ink-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.sidebar-brand-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink-heading);
}

.sidebar-badge {
  font-size: 10.5px;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid #c7d2fe;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 14px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-body);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-link i {
  font-size: 20px;
  color: var(--ink-muted);
  transition: color 0.2s ease;
}

.sidebar-link:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.sidebar-link:hover i {
  color: var(--primary);
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c7d2fe;
}

.sidebar-link.active i {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.merchant-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.merchant-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.merchant-info h5 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-heading);
}

.merchant-info p {
  font-size: 11px;
  color: var(--ink-muted);
}

/* ── Main Workspace ── */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top Header Bar ── */
.topbar {
  height: 70px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-heading);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wallet-badge-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  padding: 6px 16px;
  border-radius: 30px;
}

.wallet-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.wallet-details {
  display: flex;
  flex-direction: column;
}

.wallet-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.wallet-amount {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.btn-topbar-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--ink-body);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.btn-topbar-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #c7d2fe;
}

.dot-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-surface);
}

/* ── Content Container ── */
.content-body {
  padding: 28px;
  flex: 1;
}

/* ── Module Views (Tabs) ── */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Metric Cards Grid ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.metric-info .m-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.metric-info .m-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--ink-heading);
}

.metric-info .m-sub {
  font-size: 11.5px;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

.metric-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

/* ── Cards & Section Wrappers ── */
.portal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.card-title-bar h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Form Controls ── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-heading);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--ink-heading);
  font-family: var(--font-body);
  font-size: 13.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ── Buttons ── */
.btn-portal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--secondary-light);
  color: var(--secondary);
  border: 1px solid #bae6fd;
}

.btn-secondary:hover {
  background: #bae6fd;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--ink-heading);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--ink-muted);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
}

.btn-block {
  width: 100%;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
  color: var(--ink-heading);
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* ── Status Pills ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}

.status-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.status-pending {
  background: var(--warning-light);
  color: #d97706;
  border: 1px solid #fde68a;
}

.status-failed {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* ── Code Display Box ── */
.code-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
}

/* ── QR Display Card ── */
.qr-preview-box {
  background: var(--bg-subtle);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.qr-canvas {
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Visual Bar Graph Component for Reports ── */
.bar-chart-container {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  height: 180px;
  padding-top: 20px;
  border-bottom: 2px solid var(--border-color);
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  transition: height 0.4s ease;
  position: relative;
}

.bar-fill:hover {
  filter: brightness(1.1);
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: 8px;
  text-transform: uppercase;
}

.bar-val {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

/* ── Responsive ── */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.active { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .content-body { padding: 16px; }
}
