/* EiEWG Directory — shared design system (public + admin) */

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

:root {
  --bg: #eef3fb;
  --bg-grad-a: #eef3fb;
  --bg-grad-b: #e3ecfb;
  --panel: #ffffff;
  --panel-soft: #f7faff;
  --ink: #0d1b35;
  --muted: #5d6c84;
  --muted-soft: #8a96ad;
  --line: #e1e8f5;
  --line-soft: #eef2fa;
  --primary: #2a5fd6;
  --primary-strong: #1d47ac;
  --primary-soft: #eaf0fe;
  --accent: #18b889;
  --accent-soft: #e4f8f0;
  --warn: #d6862a;
  --warn-soft: #fdf0e1;
  --danger: #d6453f;
  --danger-soft: #fde9e8;
  --shadow-sm: 0 2px 8px rgba(20, 39, 91, 0.06);
  --shadow-md: 0 10px 30px rgba(20, 39, 91, 0.10);
  --shadow-lg: 0 24px 60px rgba(20, 39, 91, 0.18);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --font: "Plus Jakarta Sans", Calibri, "Segoe UI", Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-grad-a: #0b1220;
  --bg-grad-b: #111c33;
  --panel: #121b2e;
  --panel-soft: #16213a;
  --ink: #eef3fc;
  --muted: #99a6c2;
  --muted-soft: #6e7da0;
  --line: #233252;
  --line-soft: #1b2740;
  --primary: #5b8cff;
  --primary-strong: #84a9ff;
  --primary-soft: #1a2746;
  --accent: #36d6a5;
  --accent-soft: #123a30;
  --warn: #f0a851;
  --warn-soft: #3a2a14;
  --danger: #ff6b66;
  --danger-soft: #3a1718;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-grad-a), var(--bg-grad-b));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background 250ms ease, color 250ms ease;
}

a { color: var(--primary); }

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 18px 40px;
}

/* ---------- Top bar ---------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-logo { height: 34px; width: auto; display: block; }

.top-bar-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.top-bar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms ease;
}

.icon-btn:hover { box-shadow: var(--shadow-md); }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- Hero ---------- */
.hero-panel {
  position: relative;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  overflow: hidden;
  background: linear-gradient(120deg, #1d47ac 0%, #2a5fd6 100%);
  color: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: -60% -10% auto auto;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 65%);
  pointer-events: none;
}

.hero-panel::after { content: none; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.14);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.hero-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  position: relative;
}

.hero-sub {
  margin: 6px 0 0;
  max-width: 560px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.8);
  position: relative;
}

.hero-stats {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hero-stat {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  min-width: 92px;
}

.hero-stat-value { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.hero-stat-label { font-size: 0.6875rem; color: rgba(255,255,255,0.75); margin-top: 1px; font-weight: 500; letter-spacing: 0.01em; }

/* ---------- Toolbar ---------- */
.toolbar-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.pill {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 160ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill:hover { border-color: var(--primary); color: var(--primary); }

.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pill .count {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.625rem;
}

.pill:not(.active) .count {
  background: var(--line-soft);
  color: var(--muted-soft);
}

.search-row { display: flex; gap: 8px; flex-wrap: wrap; }

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--muted-soft);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-family: inherit;
  background: var(--panel-soft);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.type-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--line);
  background-color: var(--panel-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 7px 30px 7px 12px;
  min-width: 112px;
  height: 32px;
  line-height: 1;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6c84' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 11px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.type-select::-ms-expand { display: none; }
.type-select:hover { border-color: var(--primary); background-color: var(--panel); }
.type-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.type-select option { color: var(--ink); background: var(--panel); }

.select-btn {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 150ms ease;
}

.select-btn:hover { border-color: var(--primary); }
.select-btn.is-set { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------- Card grid ---------- */
.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 8px;
}

.org-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(6px);
  animation: cardIn 320ms ease forwards;
}

.org-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.org-card-top { display: flex; align-items: center; gap: 8px; }

.org-avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.625rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.01em;
  background: var(--primary);
}

.org-avatar.cat-full { background: var(--primary); }
.org-avatar.cat-associate { background: var(--accent); }
.org-avatar.cat-observer { background: var(--warn); }

.org-card-head { flex: 1; min-width: 0; }

.org-name {
  font-weight: 600;
  font-size: 0.6875rem;
  line-height: 1.3;
  margin-bottom: 1px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.org-acronym {
  font-size: 0.6875rem;
  color: var(--muted-soft);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.badge-row { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1.5;
}

.badge.type-nngo { background: var(--line-soft); color: var(--muted); }
.badge.type-ingo { background: var(--line-soft); color: var(--muted); }
.badge.type-un { background: var(--line-soft); color: var(--muted); }
.badge.type-gov { background: var(--line-soft); color: var(--muted); }
.badge.type-other { background: var(--line-soft); color: var(--muted); }

.badge.cat-full { background: var(--primary-soft); color: var(--primary); }
.badge.cat-associate { background: var(--accent-soft); color: var(--accent); }
.badge.cat-observer { background: var(--warn-soft); color: var(--warn); }

.org-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.contact-count { font-size: 0.6875rem; color: var(--muted); font-weight: 500; }

.view-link {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.view-link svg { width: 12px; height: 12px; transition: transform 150ms ease; }
.org-card:hover .view-link svg { transform: translateX(3px); }

/* ---------- Empty / loading ---------- */
.state-panel {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  grid-column: 1 / -1;
}

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.skeleton-card {
  height: 132px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, var(--line-soft) 30%, var(--line) 50%, var(--line-soft) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 28, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.98);
  transition: transform 220ms ease;
}

.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.modal-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover { background: var(--line); color: var(--ink); }

.modal-body { padding: 18px 22px 22px; }

.modal-section-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted-soft);
  margin: 0 0 10px;
}

.contact-list { display: grid; gap: 8px; }

.contact-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--panel-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-name { font-weight: 700; font-size: 0.88rem; }
.contact-role { color: var(--muted); font-size: 0.78rem; margin-top: 1px; }
.contact-detail { font-size: 0.82rem; text-align: right; }
.contact-locked { font-size: 0.74rem; color: var(--muted-soft); font-style: italic; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { background: var(--primary-strong); }
.btn.full { width: 100%; justify-content: center; }
.btn.good { background: var(--accent); border-color: var(--accent); }
.btn.good:hover { background: var(--accent); filter: brightness(0.95); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }

/* ---------- Footer ---------- */
.footer-panel {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.footer-title { margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; }
.footer-text { margin: 0 0 6px; font-size: 0.6875rem; color: var(--muted); line-height: 1.45; }

.coord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.coord-card {
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.coord-name { font-weight: 600; font-size: 0.6875rem; }
.coord-org { font-size: 0.6875rem; color: var(--muted-soft); margin-bottom: 3px; }
.coord-meta { font-size: 0.6875rem; color: var(--muted); }

.footer-bottom {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.6875rem;
  color: var(--muted-soft);
}

@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 200;
  animation: toastIn 220ms ease;
}

@media (max-width: 720px) {
  .app-shell { padding: 12px 12px 32px; }
  .hero-panel { padding: 14px 16px; }
  .org-grid, .skeleton-grid { grid-template-columns: 1fr; }
  .search-row { flex-direction: column; }
}
