/* CaissePro – Credit Union Management System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary:       #1e40af;
  --primary-dark:  #1e3a8a;
  --primary-light: #dbeafe;
  --amber:         #f59e0b;
  --amber-light:   #fef3c7;
  --success:       #16a34a;
  --danger:        #dc2626;
  --sidebar-w:     260px;
  --topbar-h:      60px;
  --sidebar-bg:    #ffffff;
  --sidebar-border:#e5e7eb;
  --body-bg:       #f1f5f9;
  --card-bg:       #ffffff;
  --text-main:     #1e293b;
  --text-muted:    #64748b;
  --radius:        12px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--body-bg); color: var(--text-main); font-size: .9rem; }

/* ─── Topbar ─── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--primary); color: #fff; display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1rem; z-index: 1050; box-shadow: 0 2px 8px rgba(30,64,175,.3);
}
#topbar .brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.3px; white-space: nowrap; }
#topbar .brand span { color: var(--amber); }
#topbar .spacer { flex: 1; }
#sidebar-toggle { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background .15s; }
#sidebar-toggle:hover { background: rgba(255,255,255,.15); }
.topbar-user { display: flex; align-items: center; gap: .6rem; }
.topbar-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.topbar-info .tname { font-size: .85rem; font-weight: 600; }
.topbar-info .trole { font-size: .7rem; opacity: .8; }
.topbar-btn { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 8px; padding: .35rem .75rem; font-size: .8rem; text-decoration: none; display: flex; align-items: center; gap: .4rem; transition: background .15s; }
.topbar-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ─── Layout ─── */
#layout { display: flex; min-height: 100vh; padding-top: var(--topbar-h); }

/* ─── Sidebar ─── */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: fixed;
  top: var(--topbar-h); left: 0; bottom: 0;
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  overflow-y: auto; overflow-x: hidden; transition: width .25s ease;
  z-index: 1040; display: flex; flex-direction: column;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-section { padding: .5rem 1.25rem .3rem; font-size: .63rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #94a3b8; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .5rem 1.25rem; color: var(--text-muted); text-decoration: none; transition: all .15s; font-weight: 500; font-size: .84rem; position: relative; margin: 1px 8px; border-radius: 8px; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: -8px; top: 20%; bottom: 20%; width: 3px; background: var(--primary); border-radius: 0 4px 4px 0; }
.nav-icon { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: .95rem; flex-shrink: 0; }
.ni-blue   { background: #dbeafe; color: #1e40af; }
.ni-green  { background: #dcfce7; color: #16a34a; }
.ni-amber  { background: #fef3c7; color: #d97706; }
.ni-purple { background: #f3e8ff; color: #7c3aed; }
.ni-red    { background: #fee2e2; color: #dc2626; }
.ni-teal   { background: #ccfbf1; color: #0d9488; }
.ni-indigo { background: #e0e7ff; color: #4338ca; }
.ni-gray   { background: #f1f5f9; color: #475569; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .63rem; padding: 1px 7px; font-weight: 700; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--sidebar-border); }
.sidebar-footer a { display: flex; align-items: center; gap: .6rem; color: var(--text-muted); text-decoration: none; font-size: .82rem; padding: .4rem .5rem; border-radius: 8px; }
.sidebar-footer a:hover { background: #fee2e2; color: var(--danger); }

/* ─── Toggled ─── */
body.sidebar-closed #sidebar { width: 0; }
body.sidebar-closed #main { margin-left: 0; }

/* ─── Main content ─── */
#main { flex: 1; margin-left: var(--sidebar-w); transition: margin-left .25s ease; min-height: calc(100vh - var(--topbar-h)); padding: 1.75rem; }

/* ─── Page header ─── */
.page-header { margin-bottom: 1.5rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.3rem; font-weight: 700; margin: 0; }
.breadcrumb { margin: .2rem 0 0; background: none; padding: 0; font-size: .76rem; }
.breadcrumb-item + .breadcrumb-item::before { content: '›'; }

/* ─── Cards ─── */
.card { background: var(--card-bg); border: 1px solid #e2e8f0; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { padding: .9rem 1.25rem; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; gap: .75rem; background: #fafafa; border-radius: var(--radius) var(--radius) 0 0; }
.card-header h5, .card-header h6 { margin: 0; font-weight: 600; font-size: .92rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; border-top: 1px solid #f1f5f9; background: #fafafa; border-radius: 0 0 var(--radius) var(--radius); }

/* ─── Stat cards ─── */
.stat-card { border: none; border-radius: var(--radius); overflow: hidden; }
.stat-card .card-body { padding: 1.4rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .9rem; background: rgba(255,255,255,.25); color: #fff; }
.stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1; color: #fff; }
.stat-label { font-size: .76rem; margin-top: .3rem; color: rgba(255,255,255,.85); }
.stat-sub { font-size: .73rem; margin-top: .4rem; color: rgba(255,255,255,.7); }
.grad-blue   { background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); }
.grad-green  { background: linear-gradient(135deg, #14532d 0%, #22c55e 100%); }
.grad-amber  { background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%); }
.grad-purple { background: linear-gradient(135deg, #5b21b6 0%, #a855f7 100%); }
.grad-red    { background: linear-gradient(135deg, #991b1b 0%, #ef4444 100%); }
.grad-teal   { background: linear-gradient(135deg, #134e4a 0%, #14b8a6 100%); }

/* ─── Tables ─── */
.table { font-size: .84rem; }
.table th { font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: #f8fafc; white-space: nowrap; border-bottom: 2px solid #e2e8f0; }
.table td { vertical-align: middle; border-color: #f1f5f9; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ─── Buttons ─── */
.btn { font-size: .84rem; font-weight: 500; border-radius: 8px; padding: .45rem .9rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { font-size: .76rem; padding: .28rem .6rem; border-radius: 6px; }
.btn-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 6px; }

/* ─── Forms ─── */
.form-label { font-weight: 500; font-size: .82rem; margin-bottom: .3rem; }
.form-control, .form-select { font-size: .84rem; border-radius: 8px; border-color: #d1d5db; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,64,175,.12); }
.form-text { font-size: .75rem; }

/* ─── Badges ─── */
.badge { font-size: .71rem; font-weight: 600; padding: .3em .62em; border-radius: 6px; }
.bg-success-subtle  { background: #dcfce7 !important; }
.bg-danger-subtle   { background: #fee2e2 !important; }
.bg-warning-subtle  { background: #fef3c7 !important; }
.bg-info-subtle     { background: #e0f2fe !important; }
.bg-primary-subtle  { background: #dbeafe !important; }
.bg-secondary-subtle{ background: #f1f5f9 !important; }
.bg-dark-subtle     { background: #e2e8f0 !important; }
.bg-indigo-subtle   { background: #e0e7ff !important; }
.bg-teal-subtle     { background: #ccfbf1 !important; }
.text-indigo { color: #4338ca !important; }
.text-teal   { color: #0d9488 !important; }

/* ─── Alerts ─── */
.alert { border-radius: var(--radius); border: none; font-size: .84rem; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-danger  { background: #fee2e2; color: #dc2626; }
.alert-warning { background: #fef3c7; color: #b45309; }
.alert-info    { background: #e0f2fe; color: #0369a1; }

/* ─── Login page ─── */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; box-shadow: 0 24px 64px rgba(0,0,0,.28); padding: 2.5rem; }
.login-logo { width: 60px; height: 60px; background: linear-gradient(135deg, #1e40af, #3b82f6); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; margin: 0 auto 1.2rem; }
.login-title { font-size: 1.4rem; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--text-muted); font-size: .83rem; margin-bottom: 1.75rem; }
.login-footer { text-align: center; font-size: .74rem; color: var(--text-muted); margin-top: 1.25rem; }

/* ─── Progress ─── */
.progress { height: 6px; border-radius: 999px; background: #e2e8f0; }
.progress-bar { border-radius: 999px; background: var(--primary); }

/* ─── Echeancier ─── */
tr.row-paid  { background: #f0fdf4; }
tr.row-late  { background: #fef2f2; }
tr.row-next  { background: #eff6ff; font-weight: 600; }

/* ─── Modals ─── */
.modal-content { border: none; border-radius: var(--radius); }
.modal-header  { border-bottom: 1px solid #f1f5f9; }
.modal-footer  { border-top:    1px solid #f1f5f9; }

/* ─── Responsive ─── */
@media (max-width: 992px) {
  #sidebar { width: 0; }
  #main { margin-left: 0; }
  body.sidebar-open #sidebar { width: var(--sidebar-w); box-shadow: var(--shadow-md); }
}
@media (max-width: 576px) { #main { padding: 1rem; } }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
