/* Eden Aloni — customer-facing /personal-area/ styles. */

/* ---------- No-session message ---------- */

.ea-pa__nosession {
  background: #fafafa;
  border: 1px dashed #ddd;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}
.ea-pa__nosession p { margin: 0 0 0.75rem; }
.ea-pa__nosession .ea-pa__hint { color: var(--color-muted, #6b6b74); font-size: 0.9375rem; }

/* ---------- Setup wizard (first-visit) ---------- */

.ea-pa--setup .ea-pa__intro {
  color: var(--color-muted, #6b6b74);
  margin: 0 0 1.5rem;
  line-height: 1.7;
}
.ea-pa__guardians {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ea-pa__guardian {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.75rem;
  align-items: center;
}
.ea-pa__guardian.is-self { border-color: var(--color-pink, #e78aaf); }
.ea-pa__guardian-meta { color: var(--color-muted, #6b6b74); font-size: 0.875rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.ea-pa__role { background: #f3f3f3; padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.8125rem; }
.ea-pa__email { font-size: 0.8125rem; }

.ea-pa__add {
  background: #fff;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.ea-pa__add > summary { cursor: pointer; font-weight: 600; }
.ea-pa__form--inline { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; background: transparent; border: 0; padding: 0; }
.ea-pa__role-select { font-family: inherit; padding: 0.5rem; border: 1px solid var(--color-line, #ececec); border-radius: 0.5rem; }
.ea-pa__role-other  { font-family: inherit; padding: 0.5rem; border: 1px solid var(--color-line, #ececec); border-radius: 0.5rem; margin-top: 0.375rem; }

.ea-pa__finish { margin-top: 1.5rem; }

.ea-pa__manage-link {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
}
.ea-pa__manage-link a { color: var(--color-muted, #6b6b74); }
.ea-pa__manage-link a:hover { color: var(--color-pink, #e78aaf); }


.ea-pa {
  max-width: 760px;
  margin: 0 auto;
}
.ea-pa__h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-ink, #1a1a1f);
  margin: 0 0 1.25rem;
}
.ea-pa__empty {
  color: var(--color-muted, #6b6b74);
  background: #fafafa;
  border: 1px dashed #ddd;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}
.ea-pa__back {
  display: inline-block;
  color: var(--color-muted, #6b6b74);
  text-decoration: none;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.ea-pa__back:hover { color: var(--color-pink, #e78aaf); }

.ea-pa__meta { color: var(--color-muted, #6b6b74); font-size: 0.9375rem; margin: 0; }

.ea-pa__signed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

/* ---------- List ---------- */

.ea-pa__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.875rem; }
.ea-pa__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 1.5rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.875rem;
  padding: 1rem 1.25rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.ea-pa__item:hover { border-color: var(--color-pink, #e78aaf); }
.ea-pa__item--signed { background: #fbfbfb; }
.ea-pa__item-title { font-weight: 600; color: var(--color-ink, #1a1a1f); margin-bottom: 0.25rem; }
.ea-pa__item-meta  { display: flex; gap: 0.625rem; align-items: center; flex-wrap: wrap; }

.ea-pa__badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}
.ea-pa__badge--pending { background: var(--color-pink-soft, #fce8ef); color: #8a1f2e; }
.ea-pa__badge--signed  { background: #d4edda;                         color: #155724; }
.ea-pa__subdate        { color: var(--color-muted, #6b6b74); font-size: 0.8125rem; }
.ea-pa__link           { color: var(--color-muted, #6b6b74); text-decoration: none; font-size: 0.9375rem; }
.ea-pa__link:hover     { color: var(--color-pink, #e78aaf); }

@media (max-width: 560px) {
  .ea-pa__item { grid-template-columns: 1fr; }
  .ea-pa__item-action .btn { width: 100%; text-align: center; }
}

/* ---------- Notices ---------- */

.ea-pa__notice {
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}
.ea-pa__notice--success { background: #d4edda; color: #155724; border-inline-start: 3px solid #28a745; }
.ea-pa__notice--error   { background: #fbecec; color: #8a1f2e; border-inline-start: 3px solid #d04a4a; }

/* ---------- Sign view ---------- */

.ea-pa__pdf {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.5rem;
  background: #f0f0f0;
  margin: 1rem 0 1.5rem;
}
@media (max-width: 768px) {
  .ea-pa__pdf { height: 35vh; min-height: 220px; }
}

/* Page previews with overlayed text-field inputs.
   Each page is sized via aspect-ratio so the field positions (in %) line up
   exactly with where Eden placed them in the editor. */
.ea-pa__pages { margin: 1rem 0 1.5rem; }
.ea-pa__page {
  position: relative;
  display: block;
  margin-bottom: 0.75rem;
  background: #fafafa;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.5rem;
  overflow: hidden;
  max-width: 100%;
}
.ea-pa__page-img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ea-pa__marker {
  position: absolute;
  box-sizing: border-box;
}
.ea-pa__marker-label {
  position: absolute;
  bottom: 100%;
  inset-inline-start: 0;
  font-size: 11px;
  background: #2b9cd4;
  color: #fff;
  padding: 1px 8px;
  border-radius: 3px 3px 0 0;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.5;
}
.ea-pa__field-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: rgba(43, 156, 212, 0.12);
  border: 1.5px dashed #2b9cd4;
  border-radius: 0 3px 3px 3px;
  padding: 0 0.4em;
  font-family: inherit;
  font-size: clamp(11px, 1.6vh, 16px);
  color: #1a1a1f;
  outline: none;
  direction: rtl;
  text-align: right;
}
.ea-pa__field-input:not([value=""]) { /* filled */
  border-style: solid;
  background: rgba(43, 156, 212, 0.04);
}
.ea-pa__field-input:focus {
  background: #fff;
  border-color: #1a1a1f;
  box-shadow: 0 0 0 2px rgba(43, 156, 212, 0.45);
  z-index: 5;
}
.ea-pa__field-input:invalid {
  border-color: rgba(208, 74, 74, 0.85);
  background: rgba(208, 74, 74, 0.06);
}

.ea-pa__form {
  background: #fff;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.875rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.ea-pa__field { display: flex; flex-direction: column; gap: 0.375rem; }
.ea-pa__field > label { font-weight: 600; font-size: 0.9375rem; color: var(--color-ink, #1a1a1f); }
.ea-pa__field input[type="text"],
.ea-pa__field input[type="email"],
.ea-pa__field input[type="tel"],
.ea-pa__field input[type="date"],
.ea-pa__field input[type="number"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.625rem;
  background: #fafafa;
  color: var(--color-ink, #1a1a1f);
}
.ea-pa__field input[type="text"]:focus,
.ea-pa__field input[type="email"]:focus,
.ea-pa__field input[type="tel"]:focus,
.ea-pa__field input[type="date"]:focus,
.ea-pa__field input[type="number"]:focus {
  outline: none;
  border-color: var(--color-pink, #e78aaf);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(231, 138, 175, 0.18);
}

.ea-pa__canvas-wrap {
  border: 2px dashed #cfcfd4;
  border-radius: 0.625rem;
  background: #fafafa;
  overflow: hidden;
}
.ea-pa__canvas-wrap.has-signature {
  border-style: solid;
  border-color: var(--color-pink, #e78aaf);
  background: #fff;
}
#ea-pa-canvas {
  display: block;
  width: 100%;
  height: 180px;
  touch-action: none;
  cursor: crosshair;
}

.ea-pa__hint {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-muted, #6b6b74);
  margin: 0;
}
.ea-pa__clear {
  background: none;
  border: 0;
  color: var(--color-pink, #e78aaf);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  padding: 0;
}

.ea-pa__confirm > label {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--color-ink, #1a1a1f);
}
.ea-pa__confirm input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--color-pink, #e78aaf);
  margin-top: 0.2rem;
}

.ea-pa__actions { margin: 0; }
.ea-pa__actions .btn { width: 100%; text-align: center; }
@media (min-width: 600px) {
  .ea-pa__actions .btn { width: auto; display: inline-flex; }
}

/* ---------- Signed record view ---------- */

.ea-pa__record {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fafafa;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.625rem;
}
.ea-pa__record-label { margin: 0 0 0.5rem; font-weight: 600; font-size: 0.875rem; color: var(--color-ink, #1a1a1f); }
.ea-pa__sig-img {
  max-width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.375rem;
  margin: 0.25rem 0;
}

/* ============================================================
   Signature slots overlaid on the PDF preview (last page).
   ============================================================ */

.ea-pa__sig-slot {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(231, 138, 175, 0.10);
  border: 2px dashed var(--color-pink, #e78aaf);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: #6b1f3a;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ea-pa__sig-slot:hover {
  background: rgba(231, 138, 175, 0.18);
  border-color: #c9618c;
}
.ea-pa__sig-slot:focus-visible {
  outline: 2px solid #c9618c;
  outline-offset: 2px;
}
.ea-pa__sig-slot.is-signed {
  background: #fff;
  border-style: solid;
  border-color: #155724;
  color: #155724;
}
.ea-pa__sig-slot.is-signed:hover {
  background: #f6fbf7;
}

.ea-pa__sig-slot-label {
  font-size: clamp(11px, 1.6vh, 14px);
  font-weight: 600;
  pointer-events: none;
  text-align: center;
  line-height: 1.2;
  padding: 0 0.3em;
}
.ea-pa__sig-slot.is-signed .ea-pa__sig-slot-label {
  position: absolute;
  top: -1.4em;
  inset-inline-start: 0;
  font-size: 11px;
  color: #155724;
  background: #d4edda;
  padding: 1px 6px;
  border-radius: 4px 4px 0 0;
}
.ea-pa__sig-slot-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* ============================================================
   Signature pad modal.
   ============================================================ */

.ea-sig-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 25, 0.55);
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  direction: rtl;
  animation: ea-modal-fade 120ms ease-out;
}
.ea-sig-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  max-width: 560px;
  width: 100%;
  padding: 1.25rem 1.25rem 1rem;
  font-family: inherit;
  animation: ea-modal-rise 160ms ease-out;
}
.ea-sig-modal__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a1f;
}
.ea-sig-modal__pad-wrap {
  border: 2px dashed #cfcfd4;
  border-radius: 0.5rem;
  background: #fafafa;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.ea-sig-modal__pad {
  display: block;
  width: 100%;
  height: 240px;
  touch-action: none;
  cursor: crosshair;
}
.ea-sig-modal__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.ea-sig-modal__clear {
  background: none;
  border: 0;
  color: var(--color-pink, #e78aaf);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  padding: 0;
}
.ea-sig-modal__actions {
  display: flex;
  gap: 0.5rem;
}
.ea-sig-modal__cancel,
.ea-sig-modal__save {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}
.ea-sig-modal__save {
  background: #1a1a1f;
  color: #fff;
}
.ea-sig-modal__save:hover { background: #2b2b34; }
.ea-sig-modal__save:disabled {
  background: #b7b7be;
  cursor: not-allowed;
}
.ea-sig-modal__cancel {
  background: #f3f3f5;
  color: #1a1a1f;
  border-color: #e2e2e6;
}
.ea-sig-modal__cancel:hover { background: #e8e8ec; }

/* Parent → teacher invite form (per qfill row). */
.ea-pa__invite-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}
.ea-pa__invite-row label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 180px;
}
.ea-pa__invite-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted, #6b6b74);
}
.ea-pa__invite-row input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 6px;
  background: #fff;
}
.ea-pa__invite-row input:focus {
  outline: none;
  border-color: var(--color-pink, #e78aaf);
  box-shadow: 0 0 0 3px rgba(231, 138, 175, 0.18);
}
.ea-pa__notice--success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; border-radius: 6px; padding: 0.5rem 0.8rem; }

/* Setup wizard: two-section (guardians / caretakers) layout. */
.ea-pa__setup-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-line, #ececec);
}
.ea-pa__setup-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 1rem;
  padding-bottom: 0;
}
.ea-pa__setup-h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--color-ink, #1a1a1f);
}
.ea-pa__setup-hint {
  margin: 0 0 0.85rem;
  color: var(--color-muted, #6b6b74);
  font-size: 0.9rem;
  line-height: 1.55;
}
.ea-pa__setup-empty {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--color-cream, #f7f1e6);
  border: 1px dashed #e6dcc0;
  border-radius: 0.625rem;
  color: var(--color-muted, #6b6b74);
  font-size: 0.9rem;
}

/* Parent → admin document upload form. */
.ea-pa__upload-form {
  background: #fff;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}
.ea-pa__upload-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}
.ea-pa__upload-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.ea-pa__upload-lbl {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted, #6b6b74);
}
.ea-pa__upload-row input[type="text"],
.ea-pa__upload-row input[type="file"] {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-line, #ececec);
  border-radius: 0.5rem;
  background: #fafafa;
}
.ea-pa__upload-row input[type="text"]:focus {
  outline: none;
  border-color: var(--color-pink, #e78aaf);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(231, 138, 175, 0.18);
}
.ea-pa__upload-hint {
  margin: 0.5rem 0 0;
  color: var(--color-muted, #6b6b74);
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .ea-pa__upload-row { grid-template-columns: 1fr; }
}
