/* ==========================================================================
   PPAPI — kegiatan.css
   Komponen kegiatan (webinar, pelatihan, seminar): panel pendaftaran/daftar
   hadir/sertifikat (.kg-*), bagian "Kegiatan Saya" (.kgs-*), dan bagian
   Konsol Admin "Kegiatan" termasuk perancang sertifikat (.kga-*).
   Dipakai agenda.html, dasbor, dan admin.html. Hanya token main.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   PANEL PESERTA
   -------------------------------------------------------------------------- */
.kg-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(18px, 3vw, 28px);
  position: relative;
}
.kg-panel::before { content: ""; position: absolute; left: -1px; top: -1px; width: 2px; height: 48px; background: var(--metal); }
.kg-panel--compact { border: 0; background: transparent; padding: 0; }
.kg-panel--compact::before { display: none; }
.kg-panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 18px; }
.kg-panel__eyebrow { font-family: var(--f-cond); font-weight: 600; font-size: .78rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin: 0; }

.kg-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: kg; }
.kg-step {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; row-gap: 6px;
  padding: 16px 0; border-top: 1px solid var(--line);
}
.kg-step:first-child { border-top: 0; padding-top: 0; }
.kg-step:last-child { padding-bottom: 0; }
.kg-step > :not(.kg-step__num) { grid-column: 2; }
.kg-step__num {
  grid-row: 1 / span 6; align-self: start;
  width: 40px; height: 40px; display: grid; place-items: center;
  font-family: var(--f-cond); font-weight: 600; font-size: .95rem; letter-spacing: .06em;
  border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface);
}
.kg-step.is-done .kg-step__num { background: var(--text-strong); color: var(--surface); border-color: var(--text-strong); }
.kg-step.is-current .kg-step__num { border-color: var(--text-strong); color: var(--text-strong); box-shadow: inset 0 0 0 1px var(--text-strong); }
.kg-step.is-closed .kg-step__num { opacity: .55; }
.kg-step__title { font-family: var(--f-cond); font-weight: 600; font-size: .95rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-strong); align-self: center; min-height: 22px; }
.kg-step__text { margin: 0; color: var(--text); font-size: .95rem; line-height: 1.6; }
.kg-step__text .badge { vertical-align: 1px; }
.kg-step__text .icon { vertical-align: -3px; color: var(--muted); }
.kg-step.is-locked .kg-step__text, .kg-step.is-closed .kg-step__text { color: var(--muted); }
.kg-step__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; }
.kg-step__actions .btn--link { min-height: 44px; }
.kg-step__actions .locked__actions, .kg-step__actions > div { display: contents; }
.kg-step__foot { margin: 4px 0 0; }
.kg-dim { color: var(--muted); font-size: .9rem; }
.kg-note { font-size: .85rem; }
.kg-no { font-family: var(--f-cond); font-weight: 600; letter-spacing: .06em; white-space: nowrap; }
.kg-name strong { font-weight: 600; color: var(--text-strong); }
.kg-inline-btn {
  appearance: none; border: 0; background: none; padding: 0 2px; margin-left: 4px; min-height: 32px;
  font: inherit; font-size: .88rem; color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.kg-inline-btn--muted { color: var(--muted); margin-left: 0; }
.kg-inline-btn:hover { text-decoration-thickness: 2px; }
.kg-inline-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.kg-field { margin: 6px 0 0; max-width: 520px; }
.kg-attend[disabled] { cursor: not-allowed; }

/* hitung mundur */
.kg-cd {
  display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  margin: 4px 0 0; padding: 8px 12px; border: 1px dashed var(--line-strong); width: fit-content; max-width: 100%;
}
.kg-cd__label { font-family: var(--f-cond); font-weight: 600; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.kg-cd__time { font-family: var(--f-cond); font-weight: 600; font-size: 1.2rem; letter-spacing: .06em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.kg-cd--open { border-style: solid; border-color: var(--text-strong); }

/* formulir penyelenggara tersemat */
.kg-embed { position: relative; width: 100%; height: min(70vh, 720px); border: 1px solid var(--line); background: var(--c-white); }
.kg-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* panel di dalam detail agenda (modal) */
.agenda-modal .kg-slot { margin-top: 28px; }

/* --------------------------------------------------------------------------
   KEGIATAN SAYA (dasbor)
   -------------------------------------------------------------------------- */
.kgs__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.kgs__head .eyebrow { margin-bottom: 6px; }
.kgs__title { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.12; margin: 0; color: var(--text-strong); }
.kgs__lead { margin: 6px 0 0; font-size: .92rem; max-width: 46em; }
.kgs__list { display: grid; gap: 16px; }
.kgs-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 22px; align-items: start;
  padding: clamp(18px, 2.6vw, 26px); border: 1px solid var(--line); background: var(--surface);
}
.kgs-card__body { min-width: 0; }
.kgs-card__meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 8px; }
.kgs-card__title { font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; line-height: 1.2; margin: 0 0 6px; }
.kgs-card__title a { color: var(--text-strong); text-decoration: none; }
.kgs-card__title a:hover { text-decoration: underline; text-underline-offset: 4px; }
.kgs-card__when { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.kgs-card__when .icon { flex: none; margin-top: 3px; }
.kgs-card__panel { border-top: 1px solid var(--line); padding-top: 14px; }
@media (max-width: 559px) {
  .kgs-card { grid-template-columns: minmax(0, 1fr); }
  .kgs-card .date-block { justify-self: start; }
  .kg-step { grid-template-columns: 34px minmax(0, 1fr); column-gap: 12px; }
  .kg-step__num { width: 34px; height: 34px; font-size: .85rem; }
}

/* --------------------------------------------------------------------------
   KONSOL ADMIN — bagian Kegiatan
   -------------------------------------------------------------------------- */
.kga { display: grid; gap: 20px; }
.kga-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.kga-toolbar__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-width: 0; }
.kga-toolbar .search-box { min-width: min(280px, 100%); }
.kga-count { margin: 0; color: var(--muted); font-size: .9rem; }
.kga-title { font-weight: 600; color: var(--text-strong); }
.kga-title-btn { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--text-strong); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.kga-title-btn:hover { text-decoration-color: currentColor; }
.kga-sub { display: block; margin-top: 3px; color: var(--muted); font-size: .85rem; }
.kga-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kga-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.kga-num { font-family: var(--f-cond); font-weight: 600; font-size: 1.05rem; letter-spacing: .04em; white-space: nowrap; }
.kga-window { margin: 0; padding: 12px 14px; border-left: 2px solid var(--text-strong); background: var(--surface-2); font-size: .9rem; color: var(--text); }
.kga-window strong { font-weight: 600; }
.kga-form .form__section-title { margin-top: 8px; }
.kga-radio { display: grid; gap: 10px; }
.kga-radio .check { align-items: flex-start; }
.kga-radio .check__label small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.kga-tabs { margin-top: 4px; }
.kga-tabs .tabs__panel { padding-top: 20px; }
.kga-kv { margin: 0 0 18px; }
.kga-list-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* perancang sertifikat */
.kga-designer { display: grid; gap: 18px; }
.kga-stage-wrap { position: relative; }
.kga-stage {
  position: relative; width: 100%; overflow: hidden; background: var(--c-white); color: var(--c-ink);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-1); user-select: none; touch-action: none;
  container-type: inline-size;
}
.kga-stage__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.kga-stage__tpl { position: absolute; inset: 0; pointer-events: none; }
.kga-stage__frame { position: absolute; inset: 4.76% 3.37%; border: 2px solid #1a1a1d; }
.kga-stage__frame::after { content: ""; position: absolute; inset: 3px; border: 1px solid #8b8b92; }
.kga-stage[data-orient="portrait"] .kga-stage__frame { inset: 3.37% 4.76%; }
.kga-stage__static, .kga-field {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; line-height: 1.18;
}
.kga-field { cursor: grab; padding: 2px 4px; outline: 1px dashed rgba(17,17,19,.35); outline-offset: 2px; touch-action: none; }
.kga-field[data-align="left"] { transform: translate(0, -50%); }
.kga-field[data-align="right"] { transform: translate(-100%, -50%); }
.kga-field.is-wrap { white-space: normal; }
.kga-field.is-selected { outline: 2px solid #111113; background: rgba(255,255,255,.35); }
.kga-field.is-dragging { cursor: grabbing; }
.kga-field.is-off { opacity: .25; }
.kga-field:focus-visible { outline: 3px solid #111113; outline-offset: 3px; }
.kga-field--qr { padding: 0; line-height: 0; background: #fff; }
.kga-field--qr svg { width: 100%; height: 100%; display: block; color: #111113; }
.kga-controls { display: grid; gap: 14px; }
.kga-fieldpick { display: flex; flex-wrap: wrap; gap: 6px; }
.kga-props { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 14px; align-items: end; }
.kga-props .field { margin: 0; }
.kga-props input[type="color"] { padding: 4px; height: 44px; min-width: 64px; }
.kga-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.kga-upload input[type="file"] { max-width: 100%; }
.kga-hint { margin: 0; color: var(--muted); font-size: .85rem; }
.kga-cert-row--dicabut td { opacity: .7; }
@media (min-width: 1100px) {
  .kga-designer--split { grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); align-items: start; }
}
@media (prefers-reduced-motion: reduce) { .kga-field { transition: none; } }
@media print { .kg-step__actions, .kg-panel__live { display: none !important; } }

/* ---------- Flyer kegiatan (Konsol Admin → Kelola → Flyer) ---------- */
.kga-flyer { display: grid; gap: 20px; align-items: start; }
@media (min-width: 720px) { .kga-flyer { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); } }
.kga-flyer__preview { margin: 0; }
.kga-flyer__preview img { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: var(--surface); }
.kga-flyer__preview figcaption { margin-top: 6px; }
.kga-flyer__empty {
  display: grid; place-items: center; gap: 10px; aspect-ratio: 4 / 5; padding: 20px; text-align: center;
  color: var(--muted); font-size: .88rem; border: 1px dashed var(--line-strong); background: var(--surface);
}
.kga-flyer__side { display: grid; gap: 14px; }
.kga-flyer__pick { position: relative; cursor: pointer; }
.kga-flyer__pick:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.kga-flyer__pick.is-loading { opacity: .6; pointer-events: none; }

/* ---------- Format deskripsi kegiatan (formulir admin) ---------- */
.kga-fmt { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.kga-fmt .btn span[aria-hidden="true"] { font-variant-numeric: tabular-nums; margin-right: 2px; }
.kga-fmt-view { margin-top: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); font-size: .95rem; line-height: 1.7; }
/* templat sertifikat bawaan di pratinjau (elemen dari PPAPI.kegiatan.templateSpec) */
.kga-stage__img { position: absolute; transform: translate(-50%, -50%); height: auto; pointer-events: none; }
.kga-stage__line { position: absolute; height: 0; box-sizing: border-box; transform: translateY(-50%); pointer-events: none; }
.kga-stage__static.is-wrap { white-space: normal; }
/* penanda tangan sertifikat (Konsol Admin) */
.kga-sign { display: grid; gap: 14px; }
.kga-sign__box { border: 1px solid var(--line); background: #f8f7f3; padding: 18px; display: grid; place-items: center; min-height: 150px; }
.kga-sign__paper { margin: 0; display: grid; justify-items: center; width: min(100%, 320px); }
.kga-sign__paper img { display: block; max-width: 100%; max-height: 120px; height: auto; }
.kga-sign__line { display: block; width: 100%; border-top: 1px solid #9aa0a6; margin-top: -6px; }
.kga-sign__empty { display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: .9rem; text-align: center; }
