@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ==========================================
   VARIABLES
   ========================================== */
:root {
  --g900: #0d2b1a;
  --g800: #1b4332;
  --g700: #2d6a4f;
  --g600: #40916c;
  --g500: #52b788;
  --g300: #95d5b2;
  --g200: #b7e4c7;
  --g100: #d8f3dc;
  --g50:  #f0faf4;

  --y500: #f4c430;
  --y400: #fdd835;
  --y300: #ffe082;
  --y100: #fffde7;

  --bg:       #f1f4f2;
  --surface:  #ffffff;
  --text:     #182820;
  --text2:    #4a6351;
  --text3:    #7a9183;
  --border:   #dce8e0;

  --sidebar-w:  255px;
  --topbar-h:   58px;
  --radius:     10px;
  --radius-sm:  7px;
  --radius-xs:  5px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  padding-bottom: 60px; /* account for somee.com ad bar */
  background: var(--g800);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--y500), var(--y400));
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
  width: 38px; height: 38px;
  background: var(--y500);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(244,196,48,.35);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.brand-tag {
  font-size: .67rem;
  color: var(--g300);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0 8px;
  overflow-y: auto;
}

.nav-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--g500);
  padding: 10px 20px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--g200);
  font-size: .92rem;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: all .18s ease;
}

.sidebar-link i {
  font-size: .95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: .85;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  border-left-color: var(--g300);
}

.sidebar-link.active {
  background: rgba(244,196,48,.10);
  color: var(--y500);
  border-left-color: var(--y500);
  font-weight: 600;
}

.sidebar-link.active i { opacity: 1; }

/* sidebar footer */
.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--g600), var(--g700));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(244,196,48,.3);
}

.user-info .uname {
  font-size: .82rem;
  font-weight: 600;
  color: #e8f5ea;
  display: block;
  line-height: 1.2;
}

.user-info .urole {
  font-size: .68rem;
  color: var(--g300);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-xs);
  color: var(--g200);
  font-family: 'Outfit', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  text-decoration: none;
}

.btn-logout:hover {
  background: rgba(220,53,69,.18);
  border-color: rgba(220,53,69,.4);
  color: #ff9090;
}

/* ==========================================
   SIDEBAR OVERLAY (mobile)
   ========================================== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1039;
  backdrop-filter: blur(1px);
}

.sidebar-overlay.open { display: block; }

/* ==========================================
   MAIN LAYOUT
   ========================================== */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 14px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.btn-hamburger {
  display: none;
  align-items: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  line-height: 1;
  transition: background .15s;
}

.btn-hamburger:hover { background: var(--g50); color: var(--g700); }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.page-body {
  flex: 1;
  padding: 22px;
}

/* ==========================================
   MOBILE
   ========================================== */
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }

  .main-wrap { margin-left: 0; }
  .btn-hamburger { display: flex; }
  .page-body { padding: 10px; }
  .topbar { padding: 0 14px; }

  .page-header { flex-wrap: wrap; }

  /* stat cards: 2 per row, tighter */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card { padding: 12px 14px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.1rem; }
  .stat-count { font-size: 1.4rem; }
  .stat-label { font-size: .68rem; }

  /* welcome banner tighter */
  .welcome-banner { padding: 14px 16px; margin-bottom: 12px; }
  .welcome-title { font-size: 1rem; }
  .welcome-sub { font-size: .75rem; }

  /* dashboard charts: 2 per row */
  .dash-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dash-chart-card { padding: 12px 14px; }
  .dash-chart-wrap { height: 140px; }
  .dash-chart-title { font-size: .72rem; margin-bottom: 8px; }
  .mb-4 { margin-bottom: 10px !important; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-row  { grid-template-columns: 1fr; }
  .table-responsive { font-size: .8rem; }
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* ==========================================
   CONTENT CARD
   ========================================== */
.content-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ==========================================
   FILTER BAR
   ========================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: var(--g50);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-bar .filter-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3);
  white-space: nowrap;
}

/* ==========================================
   TABLE
   ========================================== */
.table { margin: 0; font-size: .88rem; }

.table thead th {
  background: var(--g800) !important;
  color: var(--g100) !important;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 11px 16px;
  border: none !important;
  white-space: nowrap;
}

.table tbody td {
  padding: 10px 16px;
  vertical-align: middle;
  border-color: var(--border) !important;
  color: var(--text);
}

.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--g50); }
.table tbody tr:last-child td { border-bottom: none !important; }

/* ==========================================
   STATUS BADGE
   ========================================== */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-active   { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all .18s ease;
  font-size: .875rem;
}

.btn-primary {
  background: var(--g700);
  border-color: var(--g700);
  color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--g800);
  border-color: var(--g800);
  box-shadow: 0 3px 10px rgba(27,67,50,.28);
  color: #fff;
}

.btn-warning {
  background: var(--y500);
  border-color: var(--y500);
  color: var(--g900);
}

.btn-warning:hover, .btn-warning:focus {
  background: #ddb120;
  border-color: #ddb120;
  color: var(--g900);
  box-shadow: 0 3px 10px rgba(244,196,48,.35);
}

.btn-danger:hover { box-shadow: 0 3px 10px rgba(220,53,69,.28); }

.btn:focus, .btn:active:focus {
  box-shadow: 0 0 0 3px rgba(82,183,136,.25) !important;
}

/* ==========================================
   FORM CONTROLS
   ========================================== */
.form-control, .form-select, textarea.form-control {
  font-family: 'Outfit', sans-serif;
  font-size: .88rem;
  border-color: var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
}

.form-control:focus, .form-select:focus {
  border-color: var(--g500);
  box-shadow: 0 0 0 3px rgba(82,183,136,.18);
}

/* ==========================================
   MODALS
   ========================================== */
.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(135deg, var(--g800) 0%, var(--g700) 100%);
  padding: 14px 20px;
  border-bottom: none;
}

.modal-header h5 {
  font-size: .98rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.modal-header .btn-close {
  filter: invert(1) brightness(2);
  opacity: .75;
}

.modal-header .btn-close:hover { opacity: 1; }
.modal-body { padding: 20px; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--g50);
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
  border-radius: var(--radius-xs);
  font-size: .88rem;
  border: none;
  margin-bottom: 16px;
}

.alert-danger {
  background: #fff5f5;
  color: #7d1f1f;
  border-left: 4px solid #dc3545;
}

/* ==========================================
   DASHBOARD
   ========================================== */
.welcome-banner {
  background: linear-gradient(135deg, var(--g800) 0%, var(--g700) 100%);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::after {
  content: '☘';
  position: absolute;
  right: 22px; top: 50%;
  transform: translateY(-50%);
  font-size: 5.5rem;
  opacity: .07;
  pointer-events: none;
}

.welcome-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 3px;
}

.welcome-sub {
  font-size: .82rem;
  color: var(--g200);
  margin: 0;
}

.welcome-role {
  background: var(--y500);
  color: var(--g900);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  border-color: var(--g300);
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-info {}

.stat-count {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--g800);
  line-height: 1;
  margin-bottom: 1px;
  display: block;
}

.stat-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.sc-g::before  { background: linear-gradient(90deg, var(--g600), var(--g500)); }
.sc-g .stat-icon { background: var(--g100); color: var(--g700); }

.sc-y::before  { background: linear-gradient(90deg, var(--y500), var(--y400)); }
.sc-y .stat-icon { background: var(--y100); color: #7a5200; }

.sc-t::before  { background: linear-gradient(90deg, #0d9488, #14b8a6); }
.sc-t .stat-icon { background: #ccfbf1; color: #0d6e66; }

.sc-b::before  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.sc-b .stat-icon { background: #dbeafe; color: #1d4ed8; }

.sc-p::before  { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.sc-p .stat-icon { background: #ede9fe; color: #5b21b6; }

/* ==========================================
   NAV TABS
   ========================================== */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: 2px;
}

.nav-tabs .nav-link {
  font-family: 'Outfit', sans-serif;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text3);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
  padding: 10px 18px;
  transition: all .18s;
  background: none;
}

.nav-tabs .nav-link:hover {
  color: var(--g700);
  border-bottom-color: var(--g300);
  background: var(--g50);
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}

.nav-tabs .nav-link.active {
  color: var(--g800);
  border-bottom-color: var(--y500);
  font-weight: 600;
  background: none;
}

.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.show.active { display: block; }

/* ==========================================
   AMAL FILL TABLE
   ========================================== */
.amal-fill-table thead th {
  background: var(--g800);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.amal-fill-table tbody td { vertical-align: middle; }
.amal-fill-table tbody tr:hover td { background: var(--g50); }

/* ==========================================
   DASHBOARD CHARTS
   ========================================== */
.dash-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.dash-chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.dash-chart-wide {
  width: 100%;
}

.dash-chart-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text3);
  margin-bottom: 14px;
}

.dash-chart-wrap {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mb-4 { margin-bottom: 18px !important; }

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--g500); }
