/* ============================================================
   KOOPERATIBA MANAGEMENT SYSTEM — Main Stylesheet
   Aesthetic: Professional Filipino cooperative — Clean,
   trustworthy, with green accent (growth/agriculture)
   ============================================================ */

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

:root {
  --primary:        #1a6b3a;
  --primary-light:  #2d9e5c;
  --primary-dark:   #0f4224;
  --accent:         #f4b400;
  --accent-light:   #fde68a;
  --danger:         #dc2626;
  --warning:        #d97706;
  --info:           #0ea5e9;
  --success:        #16a34a;

  --bg-base:        #f0f4f1;
  --bg-card:        #ffffff;
  --bg-sidebar:     #0f3d22;

  --text-primary:   #1a2e1f;
  --text-secondary: #5a7060;
  --text-muted:     #9ab09f;
  --text-white:     #ffffff;

  --border:         #d1ddd4;
  --border-light:   #eaf0ec;
  --shadow-sm:      0 1px 3px rgba(15,62,34,0.08);
  --shadow-md:      0 4px 16px rgba(15,62,34,0.10);
  --shadow-lg:      0 8px 32px rgba(15,62,34,0.14);

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;

  --sidebar-w:      250px;
  --font:           'Plus Jakarta Sans', sans-serif;
  --font-mono:      'DM Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .coop-name {
  font-size: 13px; font-weight: 800;
  color: var(--text-white); letter-spacing: 0.5px;
  line-height: 1.3;
}
.sidebar-logo .coop-sub {
  font-size: 10px; color: rgba(255,255,255,0.45);
  font-family: var(--font-mono); letter-spacing: 1px;
  text-transform: uppercase; margin-top: 2px;
}
.sidebar-logo .badge-cda {
  display: inline-block; margin-top: 8px;
  background: var(--accent); color: #1a2e1f;
  font-size: 9px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: 0.5px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 9px; font-weight: 700;
  color: rgba(255,255,255,0.30);
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 16px 20px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.10);
  border-left-color: var(--accent);
}
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; color: rgba(255,255,255,0.4);
}
.sidebar-footer .user-name { color: rgba(255,255,255,0.8); font-weight: 600; font-size: 13px; }

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

/* ── TOPBAR ── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-title span { color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ── PAGE CONTENT ── */
.page-content { padding: 24px 28px; flex: 1; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* ── 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: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; right: 0; width: 60px; height: 60px;
  border-radius: 0 var(--radius-lg) 0 60px;
  opacity: 0.08;
}
.stat-card.green::before  { background: var(--primary); }
.stat-card.yellow::before { background: var(--accent); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.blue::before   { background: var(--info); }

.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-value { font-size: 26px; font-weight: 800; margin: 6px 0 2px; font-family: var(--font-mono); }
.stat-card.green  .stat-value { color: var(--primary); }
.stat-card.yellow .stat-value { color: var(--warning); }
.stat-card.red    .stat-value { color: var(--danger); }
.stat-card.blue   .stat-value { color: var(--info); }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border-light); transition: background 0.12s; }
tbody tr:hover { background: #f7fbf8; }
tbody td { padding: 12px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef9c3; color: #b45309; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-muted   { background: #f1f5f2; color: #64748b; }
.badge-primary { background: #dcfce7; color: var(--primary); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-md);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.15s ease;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-base); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: var(--accent); color: #1a2e1f; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
input, select, textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,58,0.10);
}
input.is-invalid { border-color: var(--danger); }
.form-error { font-size: 11px; color: var(--danger); margin-top: 2px; }

/* ── AUTOMATION TOGGLE ── */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc; border-radius: 26px;
  transition: 0.3s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
input:checked + .toggle-slider { background: var(--primary); }
input:checked + .toggle-slider:before { transform: translateX(22px); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  border-left: 4px solid;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-danger  { background: #fef2f2; border-color: var(--danger); color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: var(--info); color: #075985; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,62,34,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── PAGINATION ── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 16px; }
.page-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-primary); text-decoration: none;
  transition: all 0.12s;
}
.page-btn:hover { background: var(--bg-base); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── SEARCH BAR ── */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-base); border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
}
.search-bar input { border: none; background: transparent; padding: 0; font-size: 13px; flex: 1; }
.search-bar input:focus { outline: none; box-shadow: none; }

/* ── LOAN SCHEDULE TABLE ── */
.schedule-table td { font-family: var(--font-mono); font-size: 12px; }

/* ── NOTIFICATION BELL ── */
.notif-badge {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-base); cursor: pointer;
  border: 1px solid var(--border);
  font-size: 18px;
}
.notif-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

/* ── UTILS ── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); font-size: 12px; }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.font-mono    { font-family: var(--font-mono); }
.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; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.divider { border: none; border-top: 1px solid var(--border-light); margin: 16px 0; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, #1a5c36 60%, #2d8a52 100%);
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.login-logo p  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.login-box .form-group { margin-bottom: 16px; }
.login-box .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
.inp{padding:9px 12px;border:1.5px solid var(--border-color,#d0ddd4);border-radius:6px;font-family:var(--bs-font-sans-serif,system-ui);font-size:13px;color:#0f1f13;background:#fff;transition:border-color .15s,box-shadow .15s;width:100%}.inp:focus{outline:none;border-color:#166534;box-shadow:0 0 0 3px rgba(22,101,52,.10)}
