/* ==========================================================================
   EpiGen PHEM Dashboard - EPHI Theme
   Public Health Emergency Management Information System
   ========================================================================== */

:root {
  --ephi-green: #1b7a4c;
  --ephi-green-dark: #115a36;
  --ephi-green-light: #e6f4ec;
  --ephi-teal: #17a2a3;
  --ephi-blue: #2563eb;
  --ephi-yellow: #f5a623;
  --ephi-red: #d9434f;
  --sidebar-bg: #0f2e22;
  --sidebar-bg-2: #123626;
  --sidebar-text: #b8d6c6;
  --body-bg: #f4f7f5;
  --card-border: #e3ebe6;
  --text-main: #23343a;
  --text-muted: #7b8d94;
  --shadow-sm: 0 1px 2px rgba(16, 42, 32, .06), 0 1px 3px rgba(16, 42, 32, .08);
  --shadow-md: 0 4px 14px rgba(16, 42, 32, .09);
  --radius: 14px;
}

* { scrollbar-width: thin; scrollbar-color: #b8d6c6 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #b8d6c6; border-radius: 8px; }

body {
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  margin: 0;
}

/* ================= APP SHELL ================= */
.app-shell { display: flex; min-height: 100vh; }

/* ================= SIDEBAR ================= */
.sidebar {
  width: 262px;
  min-width: 262px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
  transition: margin-left .25s ease;
}
.sidebar-brand {
  padding: 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
}
.brand-logo { width: 46px; height: 46px; object-fit: contain; margin-right: 12px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 1.15rem; color: #fff; letter-spacing: .3px; }
.brand-sub { font-size: .72rem; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: .8px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar-nav .nav-section {
  font-size: .68rem; text-transform: uppercase; letter-spacing: 1.1px;
  color: rgba(184,214,198,.55); padding: 14px 12px 6px; font-weight: 700;
}
.sidebar-nav .nav-link {
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: .92rem;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  transition: all .15s ease;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, var(--ephi-green), #20975c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27,122,76,.35);
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 22px; text-align: center; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ephi-teal), var(--ephi-green));
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 30px; height: 30px; font-size: .8rem; }
.sidebar-user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-user-name { color: #fff; font-size: .88rem; font-weight: 600; }
.sidebar-user-role { font-size: .72rem; color: var(--sidebar-text); }

.sidebar-backdrop { display: none; }

/* ================= TOPBAR ================= */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-title h1 { font-weight: 700; }
.topbar-date { font-size: .82rem; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-icon {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--card-border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-main);
  background: #fff; text-decoration: none; font-size: 1.1rem;
}
.topbar-icon:hover { background: var(--ephi-green-light); color: var(--ephi-green-dark); }

/* ================= CONTENT ================= */
.content { flex: 1; padding: 22px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ================= STAT CARDS ================= */
.stat-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.green { background: var(--ephi-green-light); color: var(--ephi-green); }
.stat-icon.teal  { background: #e0f4f4; color: var(--ephi-teal); }
.stat-icon.blue  { background: #e8effc; color: var(--ephi-blue); }
.stat-icon.yellow{ background: #fdf1dd; color: var(--ephi-yellow); }
.stat-icon.red   { background: #fde7e9; color: var(--ephi-red); }
.stat-meta { flex: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1.15; color: var(--text-main); }
.stat-sub { font-size: .78rem; color: var(--text-muted); }
.stat-trend { font-size: .76rem; font-weight: 600; }

/* ================= CARDS ================= */
.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: #fff;
}
.card-header-custom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--card-border);
  background: transparent;
}
.card-title-custom { font-weight: 700; font-size: 1rem; margin: 0; }
.card-body-custom { padding: 18px 20px; }
.card-tool a { color: var(--text-muted); }
.card-tool a:hover { color: var(--ephi-green); }

/* ================= TABLE ================= */
.table-custom { --bs-table-bg: transparent; font-size: .9rem; margin-bottom: 0; }
.table-custom thead th {
  background: #f7faf8; color: #55676e; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .5px; font-weight: 700; border-bottom: 1px solid var(--card-border);
  white-space: nowrap; padding: 11px 14px;
}
.table-custom tbody td { padding: 11px 14px; vertical-align: middle; border-bottom: 1px solid #edf3ef; }
.table-custom tbody tr:hover { background: #f9fcfb; }

/* ================= BADGES ================= */
.badge { font-weight: 600; letter-spacing: .3px; padding: .4em .6em; }

/* ================= ALERTS LIST ================= */
.alert-item {
  display: flex; gap: 12px; padding: 13px 4px; border-bottom: 1px solid #eef3f0; align-items: flex-start;
}
.alert-item:last-child { border-bottom: 0; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.alert-item .alert-title { font-weight: 600; font-size: .9rem; }
.alert-item .alert-desc { font-size: .82rem; color: var(--text-muted); }
.alert-item .alert-time { font-size: .74rem; color: var(--text-muted); }

/* ================= UPLOAD ================= */
.dropzone {
  border: 2px dashed #b9d3c6; border-radius: var(--radius); background: #fbfdfc;
  padding: 46px 20px; text-align: center; cursor: pointer; transition: all .2s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--ephi-green); background: var(--ephi-green-light); }
.dropzone .dz-icon { font-size: 2.6rem; color: var(--ephi-green); }
.dropzone .dz-text { font-weight: 600; color: var(--text-main); }
.dropzone .dz-sub { font-size: .82rem; color: var(--text-muted); }

/* ================= LOGIN ================= */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(27,122,76,.35), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(23,162,163,.25), transparent 60%),
    linear-gradient(160deg, #0f2e22, #123626 60%, #145a3b);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 430px; background: #fff; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden;
}
.auth-brand {
  background: linear-gradient(135deg, #145a3b, var(--ephi-green));
  color: #fff; text-align: center; padding: 28px 20px 24px;
}
.auth-brand img { width: 64px; height: 64px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.auth-brand h2 { font-weight: 800; margin-bottom: 2px; }
.auth-brand p { font-size: .82rem; opacity: .85; margin: 0; }
.auth-body { padding: 28px 30px 30px; }
.auth-footer { text-align: center; font-size: .78rem; color: var(--text-muted); padding: 14px; background: #f7faf8; border-top: 1px solid var(--card-border); }

/* ================= HOME / LANDING ================= */
.landing-hero {
  background:
    linear-gradient(rgba(10,40,28,.88), rgba(15,46,34,.9)),
    url('../img/dashboard-mockup.webp') center/cover;
  color: #fff; padding: 84px 0 70px;
}
.landing-hero .badge-hero { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); }
.feature-box {
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 24px 22px; height: 100%; box-shadow: var(--shadow-sm); transition: transform .15s ease;
}
.feature-box:hover { transform: translateY(-3px); }
.feature-box .fb-icon {
  width: 48px; height: 48px; border-radius: 12px; background: var(--ephi-green-light);
  color: var(--ephi-green); font-size: 1.35rem; display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 32px; }
.timeline li::before {
  content: ""; position: absolute; left: 8px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ephi-green); box-shadow: 0 0 0 4px var(--ephi-green-light);
}
.timeline li:not(:last-child)::after {
  content: ""; position: absolute; left: 13px; top: 20px; bottom: 2px; width: 2px; background: #d9e8e0;
}

/* ================= FOOTER ================= */
.app-footer {
  background: #fff; border-top: 1px solid var(--card-border);
  padding: 14px 22px; font-size: .82rem; color: var(--text-muted);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; margin-left: -262px; }
  .sidebar.open { margin-left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(10,20,16,.5); z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
}

@media (max-width: 575.98px) {
  .content { padding: 14px; }
  .stat-value { font-size: 1.3rem; }
}

/* ================= MISC ================= */
.auth-required-hint { font-size: .78rem; color: var(--text-muted); }
.text-ephi { color: var(--ephi-green); }
.bg-ephi { background: var(--ephi-green); }
.btn-ephi {
  background: var(--ephi-green); color: #fff; font-weight: 600; border: none;
}
.btn-ephi:hover { background: var(--ephi-green-dark); color: #fff; }
.btn-outline-ephi { border-color: var(--ephi-green); color: var(--ephi-green); }
.btn-outline-ephi:hover { background: var(--ephi-green); color: #fff; }
.progress-thin { height: 6px; }
.filter-bar { background: #f7faf8; border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; }
.filter-label { font-weight: 700; font-size: .82rem; letter-spacing: .2px; margin-bottom: 2px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state i { font-size: 2.6rem; color: #c8d8d0; }
.page-heading { margin-bottom: 18px; }
.page-heading h3 { font-weight: 800; margin: 0; }
.page-heading p { color: var(--text-muted); font-size: .88rem; margin: 0; }
.chart-box { position: relative; height: 300px; }
.role-badge { font-size: .72rem; font-weight: 700; padding: .35em .7em; border-radius: 8px; }
