/* =========================================================
   Portal Formulir — Tatalogam Group
   Bahasa desain disamakan dengan Mockup Form Penilaian Investigator
   (biru #0054a4 · lime #9cc814 · Montserrat + Source Sans 3)
   ========================================================= */

:root {
  --blue: #0054a4;
  --blue-dark: #003b7a;
  --navy: #0b2a4a;
  --lime: #9cc814;
  --lime-soft: #eef7d2;
  --lime-ink: #4d6a05;
  --bg: #eef3f9;
  --card: #ffffff;
  --ink: #12263f;
  --muted: #5a6f88;
  --line: #c4d3e6;
  --line-soft: #e3ebf4;
  --chip-bg: #e6eef8;
  --amber-soft: #fff3d4;
  --amber-ink: #8a5a00;
  --err: #c0392b;
  --err-soft: #fdeceb;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(0, 60, 120, 0.08);
  --shadow-strong: 0 18px 44px rgba(0, 60, 120, 0.16);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-display: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:focus-visible { outline: 3px solid rgba(0, 84, 164, 0.35); outline-offset: 2px; }

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 4px solid var(--lime);
  transition: box-shadow 0.3s ease;
}
.top.scrolled { box-shadow: 0 8px 24px rgba(0, 60, 120, 0.12); }
.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.top .logo { height: 60px; width: auto; display: block; }
.top-divider { width: 1px; height: 36px; background: #d5dfec; }
.top-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  padding: 60px 0 118px;
}
.hero-shape { position: absolute; right: -20px; bottom: 0; max-width: 60%; height: auto; }
.hero-inner { position: relative; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.hero-tag {
  display: inline-block;
  background: var(--lime);
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
}
.hero h1 {
  margin: 16px 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 44px;
  line-height: 1.1;
  max-width: 640px;
}
.hero p { margin: 0; max-width: 540px; font-size: 18px; color: #d6e6f7; }
.hero-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.chip {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 14px;
  backdrop-filter: blur(2px);
}
.chip b { font-family: var(--font-display); font-weight: 800; margin-right: 2px; }

/* ---------- Layout ---------- */
.wrap {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin: -64px auto 0;
  padding: 0 24px 70px;
  flex: 1;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 8px 30px rgba(0, 60, 120, 0.12);
}
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.search-box input::placeholder { color: #8a9bb0; }
.search-box input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 84, 164, 0.12);
}
.search-ico {
  position: absolute;
  left: 14px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
  transition: stroke 0.2s ease;
}
.search-box:focus-within .search-ico { stroke: var(--blue); }
.count-label { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }

/* Tombol utama (pill + lingkaran lime, sama seperti "Kirim penilaian") */
.add-btn, .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 999px;
  padding: 11px 12px 11px 22px;
  cursor: pointer;
  white-space: nowrap;
}
.add-btn .arrow, .btn-primary .arrow {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--navy);
  font-style: normal;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.loading, .empty { color: var(--muted); font-size: 15px; margin: 0; }

/* ---------- Cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 22px;
}
.empty-state {
  grid-column: 1 / -1;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state strong { display: block; font-family: var(--font-display); font-weight: 800; color: var(--blue); font-size: 18px; margin-bottom: 4px; }

.form-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
/* garis lime di atas kartu yang "menyala" saat hover */
.form-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--blue), var(--lime));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}
.form-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-strong); }
.form-card:hover::before { transform: scaleX(1); }
.form-card:active { transform: translateY(-2px) scale(0.99); }

.form-card.enter {
  animation: fadeUp 0.7s var(--ease) backwards;
  animation-delay: calc(0.35s + var(--i, 0) * 0.08s);
}

.card-head { display: flex; justify-content: space-between; align-items: center; }
.card-num {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  transition: background 0.3s ease, color 0.3s ease, transform 0.35s var(--ease);
}
.form-card:hover .card-num { background: var(--lime); color: var(--navy); transform: rotate(-6deg) scale(1.08); }
.form-card.enter .card-num { animation: numPop 0.55s var(--ease) backwards; animation-delay: calc(0.6s + var(--i, 0) * 0.08s); }

.form-card h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.3;
  color: var(--blue);
}
.form-card p.desc {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

/* Status */
.pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 5px 11px;
  border-radius: 999px;
}
.pill-ok { background: var(--lime-soft); color: var(--lime-ink); }
.pill-ok::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lime);
  margin-right: 7px;
  animation: dotPulse 2.2s infinite;
}
.pill-warn { background: var(--amber-soft); color: var(--amber-ink); }

/* Tombol di kartu */
.card-links { display: flex; gap: 8px; }
.card-links a, .card-links span.disabled-link {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 15px;
  border-radius: 999px;
  text-decoration: none;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-links a { transition: transform 0.2s var(--ease), box-shadow 0.25s ease, background 0.2s ease, color 0.2s ease; }
.card-links a.link-form { background: var(--blue); color: #fff; border: 1.5px solid var(--blue); }
.card-links a.link-form::after { content: "→"; transition: transform 0.25s var(--ease); }
.card-links a.link-form:hover { background: var(--blue-dark); border-color: var(--blue-dark); box-shadow: 0 8px 16px rgba(0, 84, 164, 0.28); transform: translateY(-2px); }
.card-links a.link-form:hover::after { transform: translateX(3px); }
.card-links a.link-admin { background: #fff; color: var(--blue); border: 1.5px solid #b9cfe8; }
.card-links a.link-admin:hover { background: var(--chip-bg); border-color: var(--blue); transform: translateY(-2px); }
.card-links a:active { transform: scale(0.96); }
.card-links span.disabled-link { background: #f3f6fa; color: #9fb0c4; border: 1.5px dashed #cfdbe9; cursor: not-allowed; }

/* Menu titik tiga */
.card-menu { position: relative; }
.menu-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted);
  font-size: 19px;
  width: 34px; height: 34px;
  border-radius: 10px;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, transform 0.3s var(--ease);
}
.menu-btn:hover { background: var(--chip-bg); color: var(--blue); transform: rotate(90deg); }
.menu-dropdown {
  position: absolute; right: 0; top: 38px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 60, 120, 0.18);
  min-width: 150px;
  padding: 6px;
  z-index: 20;
  display: none;
  transform-origin: top right;
}
.menu-dropdown.open { display: block; animation: popIn 0.2s var(--ease) both; }
.menu-dropdown button {
  display: block; width: 100%;
  text-align: left;
  background: none; border: none;
  padding: 9px 12px;
  font: inherit; font-size: 14.5px; font-weight: 600;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, padding-left 0.2s var(--ease);
}
.menu-dropdown button:hover { background: var(--chip-bg); padding-left: 16px; }
.menu-dropdown button.danger { color: var(--err); }
.menu-dropdown button.danger:hover { background: var(--err-soft); }

/* Skeleton loading */
.skeleton {
  height: 214px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #fff 30%, #f3f7fc 50%, #fff 70%);
  background-size: 220% 100%;
  box-shadow: var(--shadow);
  animation: shimmer 1.4s linear infinite;
}

/* ---------- Footer ---------- */
.foot {
  background: var(--navy);
  color: #b9cde4;
  border-top: 4px solid var(--lime);
  padding: 26px 20px;
  text-align: center;
  font-size: 13.5px;
}

/* ---------- Notifikasi ---------- */
#alertBox { margin-top: 16px; }
#alertBox:empty { margin: 0; }
.msg {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  animation: slideIn 0.35s var(--ease) both;
}
.msg.leaving { animation: slideOut 0.3s ease forwards; }
.msg-ok { background: var(--lime-soft); color: var(--lime-ink); border: 1px solid #d3e79a; }
.msg-err { background: var(--err-soft); color: var(--err); border: 1px solid #f0c6b8; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 42, 74, 0.5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fadeIn 0.22s ease both;
}
.modal-backdrop.closing { animation: fadeOut 0.18s ease forwards; }
.modal-backdrop.closing .modal { animation: popOut 0.18s ease forwards; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-top: 4px solid var(--lime);
  box-shadow: 0 30px 70px rgba(0, 30, 70, 0.35);
  animation: popIn 0.32s var(--ease) both;
}
.modal-sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-badge {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}
.modal-badge-danger { background: var(--err); }
.modal h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--blue);
}
.modal .desc { color: var(--muted); font-size: 15.5px; margin: 0 0 20px; line-height: 1.55; }
.modal .field { margin-bottom: 16px; }
.modal .field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.modal .field label .hint { font-weight: 400; color: var(--muted); }
.modal .field input[type="text"],
.modal .field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}
.modal .field textarea { resize: vertical; }
.modal .field input[type="text"]:focus,
.modal .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 84, 164, 0.12); }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; }

.btn {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}
.btn-primary { padding: 9px 10px 9px 22px; }
.btn-ghost { background: transparent; color: var(--blue); border: 1.5px solid #b9cfe8; }
.btn-ghost:hover { background: var(--chip-bg); }
.btn-danger-solid { background: var(--err); color: #fff; }
.btn-danger-solid:hover { background: #a93226; box-shadow: 0 8px 16px rgba(192, 57, 43, 0.3); }
.btn[disabled], .add-btn[disabled] { opacity: 0.7; cursor: progress; }

/* ---------- Interaksi tombol ---------- */
.add-btn, .btn { transition: transform 0.2s var(--ease), box-shadow 0.25s ease, background 0.2s ease; }
.add-btn:hover, .btn-primary:hover { background: var(--blue-dark); box-shadow: 0 10px 20px rgba(0, 84, 164, 0.3); transform: translateY(-2px); }
.add-btn:active, .btn:active { transform: scale(0.96); }
.add-btn .arrow, .btn-primary .arrow { transition: transform 0.35s var(--ease); }
.add-btn:hover .arrow { transform: rotate(90deg); }
.btn-primary:hover .arrow { transform: translateX(3px); }

/* ---------- Keyframes ---------- */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; } }
@keyframes popIn    { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes popOut   { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.96) translateY(6px); } }
@keyframes slideIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes numPop   { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 rgba(156, 200, 20, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(156, 200, 20, 0); } 100% { box-shadow: 0 0 0 0 rgba(156, 200, 20, 0); } }
@keyframes shimmer  { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes shapeIn  { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes floaty   { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-10px, -8px); } }
@keyframes logoIn   { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }

/* Header & hero masuk berurutan */
.top .logo { animation: logoIn 0.6s var(--ease) both; }
.top-divider, .top-label { animation: fadeIn 0.6s 0.15s ease both; }
.hs { animation: shapeIn 1s var(--ease) both; }
.hs-2 { animation-delay: 0.12s; }
.hs-3 { animation: shapeIn 1s 0.24s var(--ease) both, floaty 9s 1.4s ease-in-out infinite; }
.hero-tag   { animation: fadeUp 0.6s 0.10s var(--ease) both; }
.hero h1    { animation: fadeUp 0.6s 0.18s var(--ease) both; }
.hero p     { animation: fadeUp 0.6s 0.26s var(--ease) both; }
.chip       { animation: fadeUp 0.6s var(--ease) both; }
.chip:nth-child(1) { animation-delay: 0.34s; }
.chip:nth-child(2) { animation-delay: 0.42s; }
.chip:nth-child(3) { animation-delay: 0.50s; }
.toolbar    { animation: fadeUp 0.7s 0.3s var(--ease) both; }

/* ---------- Responsif ---------- */
@media (max-width: 720px) {
  .top-inner { padding: 8px 16px; gap: 12px; }
  .top .logo { height: 48px; }
  .top-divider { display: none; }
  .top-label { font-size: 11px; }
  .hero { padding: 30px 0 84px; }
  .hero-inner { padding: 0 16px; }
  .hero-shape { width: 200px; max-width: none; right: -10px; }
  .hero h1 { font-size: 28px; max-width: 250px; }
  .hero p { font-size: 15.5px; }
  .hero-chips { margin-top: 18px; gap: 8px; }
  .chip { font-size: 13px; padding: 5px 12px; }
  .wrap { margin-top: -48px; padding: 0 12px 50px; }
  .toolbar { flex-wrap: wrap; padding: 14px; }
  .search-box { flex-basis: 100%; }
  .count-label { order: 2; flex-basis: 100%; }
  .add-btn { order: 3; width: 100%; justify-content: space-between; }
  .cards-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-card { padding: 20px 18px 16px; }
  .modal { padding: 22px 18px 18px; }
}

/* Hormati pengguna yang mematikan animasi di perangkatnya */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
