@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Theme: light green as main */
  --primary:       #52C97A; /* main light green */
  --primary-mid:   #2E8B57; /* darker accent */
  --primary-light: #A8D5B5; /* pale */
  --primary-pale:  #E6F7EE;
  --primary-bg:    #F6FFF7;
  --surface:       #FFFFFF;
  --surface-2:     #F4FAF6;
  --border:        #DFF3E6;
  --text-dark:     #06391F;
  --text-mid:      #2E6A45;
  --text-muted:    #4F8B66;
  --danger:        #E53E3E;
  --danger-light:  #FFF5F5;
  --warning:       #D69E2E;
  --warning-light: #FFFFF0;
  --info:          #3182CE;
  --info-light:    #EBF8FF;
  --shadow-sm:     0 1px 3px rgba(27,107,58,0.08);
  --shadow-md:     0 4px 12px rgba(27,107,58,0.12);
  --shadow-lg:     0 8px 30px rgba(27,107,58,0.18);
  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     18px;
  --radius-xl:     24px;
  --transition:    all 0.2s ease;
}

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

html { font-size: 16px; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--primary-bg);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--primary-bg); }
::-webkit-scrollbar-thumb { background: var(--primary-pale); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-mid); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px;
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1rem;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(82,201,122,0.08); }
.btn-primary:hover { background: var(--primary-mid); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success { background: var(--primary-light); color: var(--primary); }
.btn-success:hover { background: var(--primary-mid); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary-pale); }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 13px 26px; font-size: 1rem; font-weight: 600; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); font-family: 'Poppins', sans-serif;
  font-size: 0.9rem; color: var(--text-dark); background: var(--surface);
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(46,139,87,0.12); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

button, select, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--info);
  outline-offset: 2px;
}

/* Cards */
.card {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; color: var(--primary);
}
.card-body { padding: 20px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #d4edda; color: #1B6B3A; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-info    { background: #cce5ff; color: #004085; }
.badge-muted   { background: #e2e8f0; color: #4a5568; }
.badge-primary { background: var(--primary); color: #fff; }

/* Tables */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th { background: var(--primary); color: #fff; padding: 12px 14px; text-align: left; font-weight: 600; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
tbody tr:hover { background: var(--primary-bg); }
tbody td { padding: 11px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px; backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 2px; }
.modal-close:hover { color: var(--danger); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-success { color: var(--primary); }
.text-danger  { color: var(--danger); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; } .flex-1 { flex: 1; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.w-full { width: 100%; }

/* Stat cards */
.stat-card {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; }

/* Toasts */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border-radius: var(--radius-sm); padding: 12px 20px;
  box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary);
  font-size: 0.875rem; font-weight: 500; max-width: 320px;
  animation: slideUp 0.25s ease;
}
.toast-success { border-color: var(--primary); color: var(--primary); }
.toast-error   { border-color: var(--danger); color: var(--danger); }
.toast-warning { border-color: var(--warning); color: var(--warning); }

/* Print only */
@media print { body * { visibility: hidden; } #print-area, #print-area * { visibility: visible; } #print-area { position: fixed; inset: 0; } }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
