/* JMF LLP Portal - Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --primary: #1a3c5e;
  --primary-light: #2563a8;
  --primary-dark: #0f2440;
  --accent: #e8a020;
  --accent-light: #fbbf24;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --text: #1e2d3d;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-w: 250px;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

html { font-size: 15px; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

/* ── LAYOUT ────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s;
}

.sidebar-logo {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; }

.logo-placeholder {
  width: 40px; height: 40px; background: var(--accent);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0;
}

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-text strong { font-size: 15px; font-weight: 700; display: block; }
.sidebar-logo-text span { font-size: 11px; opacity: .6; }

.sidebar-nav { flex: 1; padding: 14px 0; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: .45; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; color: rgba(255,255,255,.75);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); border-left-color: var(--accent); }
.nav-item .icon { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: rgba(255,255,255,.5);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-title { font-size: 17px; font-weight: 600; color: var(--text); }

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

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 50px;
  padding: 5px 14px 5px 5px;
  font-size: 13px; font-weight: 500;
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.page-content { padding: 24px; flex: 1; }

/* ── CARDS ─────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

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

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #dcfce7; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.red { background: #fee2e2; }
.stat-icon.purple { background: #ede9fe; }

.stat-info { flex: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; font-family: 'DM Mono', monospace; color: var(--text); }

/* ── TABLES ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 11px 14px;
  background: #f8fafc; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ─────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 50px; font-size: 11.5px; font-weight: 600;
}
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-orange { background: #fef3c7; color: #d97706; }
.badge-gray { background: #f1f5f9; color: #64748b; }

/* ── FORMS ──────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: #fff; transition: border .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,168,.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: all .2s;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 5px; }
.btn-outline { background: transparent; border: 1.5px solid currentColor; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; }

/* ── ALERTS ──────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ── LOGIN PAGE ──────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo img { height: 60px; margin-bottom: 10px; }
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--primary); }
.login-logo p { font-size: 13px; color: var(--text-muted); }

/* ── RECEIPT ──────────────────────────────── */
.receipt {
  max-width: 600px; margin: 0 auto;
  background: #fff; border: 2px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.receipt-header {
  background: var(--primary); color: #fff;
  padding: 24px; text-align: center;
}
.receipt-header h2 { font-size: 20px; margin-bottom: 4px; }
.receipt-body { padding: 24px; }
.receipt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.receipt-row:last-child { border-bottom: none; }
.receipt-row .label { font-size: 13px; color: var(--text-muted); }
.receipt-row .value { font-size: 14px; font-weight: 600; }
.receipt-amount {
  background: #f0fdf4; border-radius: 10px;
  padding: 16px; text-align: center; margin: 16px 0;
}
.receipt-amount .amt { font-size: 32px; font-weight: 700; color: var(--success); font-family: 'DM Mono', monospace; }
.receipt-footer {
  background: #f8fafc; padding: 16px; text-align: center;
  font-size: 12px; color: var(--text-muted);
  border-top: 2px dashed var(--border);
}

/* ── MODAL ──────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 0;
  width: 100%; max-width: 500px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── MISC ──────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-mono { font-family: 'DM Mono', monospace; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 3px; }

.amount-credit { color: var(--success); font-weight: 600; font-family: 'DM Mono', monospace; }
.amount-debit { color: var(--danger); font-weight: 600; font-family: 'DM Mono', monospace; }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Mobile */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; font-size: 22px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .table-wrap { font-size: 12.5px; }
  .topbar { padding: 0 14px; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin: 0; }
  .receipt { box-shadow: none; border: 1px solid #ddd; }
}
