/* shared.css - Ibimina Shared Styles */
:root {
  --forest: #1a3a2a;
  --forest-mid: #2d5a40;
  --forest-light: #4a8c63;
  --forest-pale: #e8f5ee;
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-pale: #fdf6e3;
  --cream: #faf6ef;
  --cream-dark: #ede5d5;
  --text-dark: #1a1a1a;
  --text-mid: #4a4a4a;
  --text-light: #8a8a8a;
  --white: #ffffff;
  --red: #c0392b;
  --red-pale: #fdecea;
  --blue: #2563eb;
  --blue-pale: #eff6ff;
  --orange: #d97706;
  --orange-pale: #fffbeb;
  --sidebar-w: 260px;
  --header-h: 64px;
  --shadow: 0 2px 12px rgba(26,58,42,0.08);
  --shadow-md: 0 4px 24px rgba(26,58,42,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--forest);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .icon {
  width: 42px; height: 42px;
  background: var(--gold);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sidebar-brand .name {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.sidebar-brand .sub {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-section {
  padding: 20px 12px 8px;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0 8px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}
.nav-item.active {
  background: var(--gold);
  color: var(--forest);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
}
.sidebar-user .avatar {
  width: 36px; height: 36px;
  background: var(--forest-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
}
.logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 18px;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--red); }

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

.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--cream-dark);
  display: flex;
  align-items: center;
  padding: 0 32px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--forest);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-badge {
  padding: 6px 14px;
  background: var(--forest-pale);
  color: var(--forest);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

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

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--forest);
  margin-bottom: 4px;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--forest-light);
  position: relative;
  overflow: hidden;
}
.stat-card.gold { border-left-color: var(--gold); }
.stat-card.red { border-left-color: var(--red); }
.stat-card.blue { border-left-color: var(--blue); }
.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-light);
}
.stat-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  opacity: 0.1;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  background: var(--cream);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-mid);
  border-bottom: 2px solid var(--cream-dark);
}
tbody tr {
  border-bottom: 1px solid var(--cream-dark);
  transition: background 0.15s;
}
tbody tr:hover { background: var(--cream); }
tbody td {
  padding: 13px 16px;
  color: var(--text-dark);
  vertical-align: middle;
}
tbody tr:last-child { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge.green { background: var(--forest-pale); color: var(--forest); }
.badge.red { background: var(--red-pale); color: var(--red); }
.badge.gold { background: var(--gold-pale); color: #92650a; }
.badge.blue { background: var(--blue-pale); color: var(--blue); }
.badge.gray { background: var(--cream-dark); color: var(--text-mid); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--forest);
  color: var(--white);
}
.btn-primary:hover { background: var(--forest-mid); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,42,0.2); }
.btn-gold {
  background: var(--gold);
  color: var(--forest);
}
.btn-gold:hover { background: var(--gold-light); }
.btn-outline {
  background: transparent;
  color: var(--forest);
  border: 2px solid var(--cream-dark);
}
.btn-outline:hover { border-color: var(--forest); background: var(--forest-pale); }
.btn-danger {
  background: var(--red);
  color: white;
}
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 6px; background: var(--cream); border: 1px solid var(--cream-dark); cursor: pointer; transition: all 0.2s; color: var(--text-mid); font-size: 14px; }
.btn-icon:hover { background: var(--forest-pale); color: var(--forest); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 720px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--forest);
  margin-bottom: 4px;
}
.modal-subtitle { color: var(--text-light); font-size: 13px; margin-bottom: 24px; }
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--cream-dark);
}

/* Form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--cream-dark);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--cream);
  transition: all 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--forest-light);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(74,140,99,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Misc */
.divider { border: none; border-top: 1px solid var(--cream-dark); margin: 20px 0; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

.amount-rwf {
  font-weight: 700;
  color: var(--forest);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--forest);
}

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--forest);
  color: white;
  padding: 14px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  animation: toastIn 0.3s ease;
  display: none;
}
.toast.show { display: block; }
.toast.success { background: var(--forest-light); }
.toast.error { background: var(--red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .two-col, .form-row { grid-template-columns: 1fr; }
}
