/* ===========================================================================
   Ethiopia Human Rights Monitor — global styles
   =========================================================================== */

:root {
  --green: #1f7a4d;
  --green-dark: #155e3a;
  --gold: #d4a017;
  --red: #c0392b;
  --ink: #14201a;
  --slate: #4a5a52;
  --bg: #f6f8f7;
  --card: #ffffff;
  --border: #e2e8e4;
  --shadow: 0 1px 3px rgba(20, 32, 26, .08), 0 8px 24px rgba(20, 32, 26, .06);
  --radius: 14px;

  --sev-low: #2e8b57;
  --sev-medium: #d4a017;
  --sev-high: #e07b2e;
  --sev-critical: #c0392b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--green-dark); }

.container { width: min(1140px, 92%); margin: 0 auto; }

/* ---- Header / nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  display: grid; place-items: center; color: #fff; font-weight: 700;
}
.brand .logo svg { width: 22px; height: 22px; }
.brand-logo { width: 46px; height: 46px; border-radius: 8px; object-fit: contain; background: #fff; flex-shrink: 0; }
.login-card .brand-logo { width: 96px; height: 96px; border-radius: 14px; }
.sidebar .brand-logo { width: 40px; height: 40px; }
.brand strong { font-size: 1.05rem; display: block; line-height: 1.2; }
.brand span { font-size: .76rem; color: var(--slate); }

.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  text-decoration: none; color: var(--slate); font-weight: 500;
  padding: 8px 12px; border-radius: 8px; font-size: .95rem;
}
.nav-links a:hover { background: var(--bg); color: var(--ink); }
.nav-links a.active { color: var(--green-dark); background: #e9f3ee; }

.nav-toggle { display: none; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--ink); }

.lang-switch { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; }
.lang-switch-label { font-size: .7rem; font-weight: 700; color: var(--slate); letter-spacing: .04em; }
.lang-select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: .85rem; background: #fff; color: var(--ink); cursor: pointer;
}
.lang-select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,122,77,.12); }
.sidebar .lang-switch { display: flex; margin-bottom: 10px; }
.sidebar .lang-switch-label { color: #9fb3a8; }
.sidebar .lang-select { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.18); flex: 1; }
.login-card .lang-switch { display: flex; justify-content: center; margin-bottom: 16px; }

/* Secondary-language text shown directly beneath the English text. */
.i18n-sub {
  display: block; font-size: .8em; font-weight: 400; font-style: normal;
  opacity: .85; line-height: 1.3; margin-top: 1px;
}
.hero h1 .i18n-sub { font-size: .5em; opacity: .88; margin-top: 4px; }
.hero p .i18n-sub { font-size: .85em; opacity: .85; margin-top: 4px; }
.eyebrow .i18n-sub { font-size: .9em; }
.section-head h2 .i18n-sub, .card h3 .i18n-sub, .modal-head h3 .i18n-sub { font-size: .62em; }
.section-head p .i18n-sub { font-size: .88em; }
.btn .i18n-sub { font-size: .8em; opacity: .9; margin-top: 0; }
.nav-links a .i18n-sub { font-size: .72em; }
.field label .i18n-sub, .kpi .label .i18n-sub, th .i18n-sub { font-size: .85em; }
th .i18n-sub { text-transform: none; letter-spacing: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid transparent; cursor: pointer;
  padding: 11px 20px; border-radius: 10px; font-size: .95rem; font-weight: 600;
  text-decoration: none; transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-gold { background: var(--gold); color: #2a2102; }
.btn-gold:hover { filter: brightness(.95); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--green); color: var(--green-dark); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--slate); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }

/* ---- Hero ---- */
.hero {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(212,160,23,.18), transparent),
    linear-gradient(160deg, #0f3d27, #1f7a4d);
  color: #fff; padding: 84px 0 90px;
}
/* Hero is centered for a clean, professional landing. */
.hero .container { text-align: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.12; margin: 0 auto 18px; max-width: 24ch; }
.hero p { font-size: 1.12rem; max-width: 58ch; opacity: .95; margin: 0 auto 30px; }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.eyebrow {
  display: inline-block; text-transform: uppercase; letter-spacing: .12em;
  font-size: .76rem; font-weight: 700; color: var(--gold);
  background: rgba(255,255,255,.08); padding: 6px 12px; border-radius: 999px; margin-bottom: 20px;
}

/* ---- Sections ---- */
section { padding: 64px 0; }
.section-head { text-align: center; max-width: 64ch; margin: 0 auto 40px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 12px; }
.section-head p { color: var(--slate); margin: 0; }

/* ---- Stat cards ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; text-align: center; box-shadow: var(--shadow);
}
.stat .num { font-size: 2.4rem; font-weight: 800; color: var(--green-dark); line-height: 1; }
.stat .label { color: var(--slate); margin-top: 8px; font-size: .92rem; }

/* ---- Feature / card grid ---- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; }
.card .icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: #e9f3ee; color: var(--green-dark); margin-bottom: 14px;
}
.card .icon svg { width: 24px; height: 24px; }

/* Homepage feature/why cards are centered for a cohesive, professional look. */
.grid .card { text-align: center; }
.grid .card .icon { margin-left: auto; margin-right: auto; }

/* ---- Incident cards ---- */
.incident {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.incident .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.incident h3 { margin: 0; font-size: 1.08rem; }
.incident .desc { color: var(--slate); font-size: .94rem; margin: 0; }
.incident .footer { display: flex; justify-content: space-between; color: var(--slate); font-size: .82rem; margin-top: auto; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: #eef2f0; color: var(--slate);
}
.badge-cat { background: #e9f3ee; color: var(--green-dark); }
.sev-low { background: #e4f3ea; color: var(--sev-low); }
.sev-medium { background: #fbf2d9; color: #8a6700; }
.sev-high { background: #fdebdc; color: #a8531a; }
.sev-critical { background: #fae1de; color: var(--sev-critical); }

.status-pending { background: #eef2f0; color: var(--slate); }
.status-under_review { background: #fbf2d9; color: #8a6700; }
.status-verified { background: #e4f3ea; color: var(--sev-low); }
.status-rejected { background: #fae1de; color: var(--sev-critical); }

/* ---- Forms ---- */
.form-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow); max-width: 720px; margin: 0 auto;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field .hint { font-weight: 400; color: var(--slate); font-size: .82rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,122,77,.12);
}
.field textarea { min-height: 130px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: auto; margin-top: 4px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check-grid .check {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0;
  background: #fbfdfc; cursor: pointer;
}
@media (max-width: 560px) { .check-grid { grid-template-columns: 1fr; } }

/* ---- Alerts ---- */
.alert { padding: 14px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; display: none; }
.alert.show { display: block; }
.alert-success { background: #e4f3ea; color: var(--green-dark); border: 1px solid #bfe0cd; }
.alert-error { background: #fae1de; color: #8a241b; border: 1px solid #f0c4bf; }
.alert-info { background: #eaf1f7; color: #29527a; border: 1px solid #cfe0ee; }

/* ---- Filters bar ---- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; align-items: end; }
.filters .field { margin: 0; }

/* ---- Banners ---- */
.notice {
  background: #fff7e6; border: 1px solid #f0dca8; color: #6b5410;
  border-radius: 10px; padding: 12px 16px; font-size: .9rem; margin-bottom: 22px;
}

/* ---- Footer ---- */
.site-footer { background: #0f2419; color: #cdd9d2; padding: 48px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; margin: 0 0 12px; font-size: .95rem; }
.site-footer a { color: #cdd9d2; text-decoration: none; display: block; padding: 4px 0; font-size: .9rem; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 32px; padding-top: 20px; font-size: .82rem; opacity: .8; }

/* ===========================================================================
   Dashboard
   =========================================================================== */
.dash { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0f2419; color: #cdd9d2; padding: 22px 16px; display: flex; flex-direction: column; }
.sidebar .brand { color: #fff; margin-bottom: 26px; }
.sidebar .brand strong { color: #fff; }
.sidebar .brand span { color: #9fb3a8; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; color: #cdd9d2; text-decoration: none;
  padding: 10px 12px; border-radius: 9px; margin-bottom: 4px; font-size: .92rem;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .user-box { margin-top: auto; font-size: .82rem; color: #9fb3a8; padding-top: 20px; }

.dash-main { padding: 28px 32px; overflow-x: auto; }
.dash-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.dash-head h1 { margin: 0; font-size: 1.5rem; }

/* Auto-fit keeps KPI cards responsive without per-row column overrides. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.kpi .num { font-size: 1.8rem; font-weight: 800; }
.kpi .label { color: var(--slate); font-size: .82rem; margin-top: 4px; }

.tr-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

/* ---- Table ---- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; font-size: .9rem; border-bottom: 1px solid var(--border); }
th { background: #f1f5f3; color: var(--slate); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #f8faf9; cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 16px; }

/* ---- Traffic: bar chart & mini tables ---- */
.bar-chart { display: flex; align-items: flex-end; gap: 2px; height: 160px; overflow-x: auto; }
.bar-chart .bar {
  flex: 1 1 0; min-width: 2px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  transition: opacity .12s ease; align-self: flex-end;
}
.bar-chart .bar:hover { opacity: .75; }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: .88rem; }
.mini-table td:first-child { word-break: break-all; }
.mini-table td:last-child { text-align: right; color: var(--slate); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.mini-table tr:last-child td { border-bottom: 0; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,36,25,.5); display: none;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); max-width: 680px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 24px; }
.modal-foot { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.close-x { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--slate); line-height: 1; }

/* Evidence display in the report detail modal */
.evidence-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.evidence-item { display: inline-block; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.evidence-item img { width: 110px; height: 110px; object-fit: cover; display: block; }
.evidence-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #f8faf9; text-decoration: none; color: var(--green-dark);
  font-size: .85rem; word-break: break-all;
}
.evidence-file:hover { border-color: var(--green); }

/* File input styling */
input[type="file"] {
  width: 100%; padding: 10px; border: 1px dashed var(--border); border-radius: 10px;
  background: #fbfdfc; font: inherit; font-size: .9rem; cursor: pointer;
}
input[type="file"]:focus { outline: none; border-color: var(--green); }

.detail-row { display: flex; padding: 8px 0; border-bottom: 1px dashed var(--border); gap: 16px; }
.detail-row .k { width: 150px; color: var(--slate); font-size: .85rem; flex-shrink: 0; }
.detail-row .v { font-size: .92rem; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, #0f3d27, #1f7a4d); }
.login-card { background: #fff; border-radius: 18px; padding: 36px; width: min(420px, 100%); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-card .brand { justify-content: center; margin-bottom: 8px; }
.login-card h1 { text-align: center; font-size: 1.4rem; margin: 8px 0 4px; }
.login-card .sub { text-align: center; color: var(--slate); font-size: .9rem; margin: 0 0 24px; }

.muted { color: var(--slate); }
.center { text-align: center; }
.mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.hidden { display: none !important; }
.spinner { display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Legal pages ---- */
.legal { max-width: 820px; margin: 0 auto; }
.legal h1 { font-size: 1.9rem; margin: 0 0 6px; }
.legal .effective { color: var(--slate); font-size: .9rem; margin: 0 0 8px; }
.legal h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.legal h3 { font-size: 1rem; margin: 18px 0 6px; }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-left: 20px; }
.legal address { font-style: normal; }
.legal .note {
  background: #f8faf9; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: .9rem; color: var(--slate); margin: 18px 0;
}

/* ---- Footer legal area ---- */
.footer-legal { text-align: center; }
.org-identity { color: #9fb3a8; font-size: .85rem; max-width: 72ch; margin: 0 auto 12px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-bottom: 12px; }
.legal-links a { color: #cdd9d2; text-decoration: none; padding: 2px 0; }
.legal-links a:hover { color: #fff; }
.footer-copy { font-size: .82rem; opacity: .8; margin: 0; }

/* ---- Consent / privacy banner ---- */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: #0f2419; color: #e6ece9; padding: 13px 18px;
  display: flex; gap: 14px 20px; align-items: center; justify-content: center; flex-wrap: wrap;
  box-shadow: 0 -4px 18px rgba(0,0,0,.2); font-size: .88rem;
}
.consent-banner > span { max-width: 70ch; }
.consent-banner a { color: var(--gold); }
.consent-actions { display: flex; gap: 12px; align-items: center; }
.consent-banner .i18n-sub { opacity: .78; }

/* ---- Accessibility ---- */
.skip-link {
  position: absolute; left: 8px; top: -64px; z-index: 999;
  background: var(--green-dark); color: #fff; padding: 10px 16px;
  border-radius: 0 0 10px 10px; text-decoration: none; font-weight: 600;
  transition: top .15s ease;
}
.skip-link:focus { top: 0; }
/* Always-visible keyboard focus indicator */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, .lang-select:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
/* Screen-reader-only text */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .field-row { grid-template-columns: 1fr; }

  /* Collapsing top navigation */
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0; background: #fff;
    flex-direction: column; align-items: stretch; padding: 12px; gap: 4px;
    border-bottom: 1px solid var(--border); display: none;
    box-shadow: var(--shadow); max-height: calc(100vh - 68px); overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links .lang-switch { margin: 6px 0 0; }
  .nav-toggle { display: block; }

  /* Dashboard: turn the sidebar into a horizontal, scrollable top bar */
  .dash { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; align-items: center; gap: 8px;
    padding: 10px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    position: sticky; top: 0; z-index: 30;
  }
  .sidebar .brand { display: none; }
  .sidebar nav { display: flex; flex-direction: row; gap: 4px; flex: 1; }
  .sidebar nav a { white-space: nowrap; padding: 8px 12px; margin: 0; }
  .sidebar .user-box {
    margin: 0; padding: 0; display: flex; align-items: center; gap: 8px;
    border: 0; white-space: nowrap;
  }
  .sidebar .user-box #who { display: none; }
  .sidebar .lang-switch { margin: 0; }
  .dash-main { padding: 18px 16px; }
  .dash-head h1 { font-size: 1.25rem; }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .container { width: 92%; }
  section { padding: 44px 0; }
  .form-card { padding: 22px 18px; }
  .modal-overlay { padding: 16px 10px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-row .k { width: auto; }
  .brand strong { font-size: .98rem; }
  .brand > span > span { display: none; } /* hide tagline on very small screens */
  .hero { padding: 60px 0 64px; }
  .consent-banner { padding: 11px 14px; font-size: .82rem; gap: 10px; max-height: 52vh; overflow-y: auto; text-align: center; }
  .consent-actions { width: 100%; justify-content: center; }
}
