/* =====================================================================
   Friends' Portal — Styles
   Extends the base styles.css design system.
   ===================================================================== */

/* ── Portal layout ─────────────────────────────────────────────────── */
.portal-app {
  width: 100%;
  max-width: 680px;
}

/* ── Header ────────────────────────────────────────────────────────── */
.portal-header {
  text-align: center;
  padding: 16px 16px 28px;
}

.portal-header-nav {
  text-align: left;
  margin-bottom: 18px;
}

.back-link {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  transition: color 0.2s var(--ease), border-color 0.2s;
}
.back-link:hover {
  color: var(--accent-orange);
  border-color: var(--accent-orange);
}

.portal-hero-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 4px solid var(--highlight-pink);
  box-shadow: 0 8px 28px rgba(216, 107, 129, 0.4);
  display: block;
  margin: 0 auto 16px;
  animation: portalBounce 3s ease-in-out infinite;
}
@keyframes portalBounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}

.portal-title {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  color: var(--primary-red);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.portal-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── Step indicator ────────────────────────────────────────────────── */
.steps-nav {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 0 auto 22px;
  max-width: 440px;
  padding: 0 4px;
}

.step-pip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pip-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border-soft);
  background: var(--surface-card);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  transition: background 0.3s var(--ease), border-color 0.3s, color 0.3s;
}

.pip-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: color 0.3s;
}

.step-pip.active .pip-circle {
  background: linear-gradient(135deg, var(--accent-orange), var(--primary-red));
  border-color: var(--primary-red);
  color: #fff;
}
.step-pip.active .pip-label { color: var(--primary-red); }

.step-pip.done .pip-circle {
  background: #3f9d5a;
  border-color: #3f9d5a;
  color: #fff;
}
.step-pip.done .pip-circle > span::before { content: '✓'; }
.step-pip.done .pip-circle > span { font-size: 0; }
.step-pip.done .pip-circle > span::before { font-size: 0.9rem; }
.step-pip.done .pip-label { color: #3f9d5a; }

.step-bar {
  flex: 1;
  height: 3px;
  background: var(--border-soft);
  align-self: flex-start;
  margin-top: 17px;
  min-width: 16px;
  transition: background 0.4s var(--ease);
}
.step-bar.done { background: #3f9d5a; }

/* ── Wizard steps ──────────────────────────────────────────────────── */
.wiz-step {
  animation: cardIn 0.4s var(--ease);
}

.wiz-icon {
  font-size: 2.8rem;
  text-align: center;
  display: block;
  margin-bottom: 10px;
}
.wiz-icon.big { font-size: 4rem; }

.wiz-heading {
  font-size: clamp(1.45rem, 4vw, 2rem);
  color: var(--primary-red);
  text-align: center;
  margin-bottom: 8px;
}

.wiz-sub {
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 24px;
}

.wiz-nav {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.wiz-nav .btn-ghost  { flex: 0 0 auto; }
.wiz-nav .btn-primary { flex: 1; }

/* ── Form helpers ──────────────────────────────────────────────────── */
.portal-form-group { margin-bottom: 20px; }

.optional-tag {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.portal-textarea {
  resize: vertical;
  min-height: 96px;
  font-family: inherit;
  line-height: 1.5;
}

.char-count {
  text-align: right;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── Ghost / secondary buttons ─────────────────────────────────────── */
.btn-ghost {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-soft);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

/* ── Avatar section ────────────────────────────────────────────────── */
.avatar-section {
  text-align: center;
  margin-bottom: 8px;
}

.av-sect-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.av-or { margin: 20px 0 12px; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  max-width: 380px;
  margin: 0 auto;
}
@media (max-width: 460px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}

.av-item {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  cursor: pointer;
  background: none;
  font-family: inherit;
  transition: transform 0.14s var(--ease), border-color 0.14s, box-shadow 0.14s;
  user-select: none;
}
.av-item:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}
.av-item.selected {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 4px rgba(184, 59, 38, 0.22);
  transform: scale(1.16);
}

.upload-btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--highlight-pink), var(--accent-orange));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 20px rgba(216, 107, 129, 0.3);
  transition: transform 0.15s var(--ease), filter 0.15s;
  border: none;
}
.upload-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.upload-preview {
  margin: 18px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.upload-preview img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--highlight-pink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  display: block;
}
.remove-upload {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-red);
  background: none;
  border: 1.5px solid var(--primary-red);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s, color 0.18s;
}
.remove-upload:hover {
  background: var(--primary-red);
  color: #fff;
}

/* ── Question cards ────────────────────────────────────────────────── */
.q-card {
  background: var(--bg-earth);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px 20px 16px;
  margin-bottom: 16px;
  animation: cardIn 0.3s var(--ease);
}

.q-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.q-card-num {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary-red);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.q-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  background: var(--surface-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 1;
}
.q-remove:hover {
  border-color: var(--primary-red);
  background: var(--primary-red);
  color: #fff;
}

/* Option rows */
.q-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface-card);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}
.q-opt-row:hover { border-color: var(--accent-orange); }
.q-opt-row.is-correct {
  border-color: #3f9d5a;
  background: rgba(63, 157, 90, 0.08);
}

.opt-letter {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border-soft);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  transition: background 0.14s, color 0.14s;
}
.q-opt-row.is-correct .opt-letter {
  background: #3f9d5a;
  color: #fff;
}

.q-opt-input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 6px 8px;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-dark);
  font-family: inherit;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.q-opt-input:focus { background: rgba(217, 107, 39, 0.07); }

.q-correct-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.q-correct-mark {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  background: var(--surface-card);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: border-color 0.14s, background 0.14s, color 0.14s;
  user-select: none;
  cursor: pointer;
  font-family: inherit;
}
.q-correct-mark:hover {
  border-color: #3f9d5a;
  color: #3f9d5a;
}
.q-opt-row.is-correct .q-correct-mark {
  border-color: #3f9d5a;
  background: #3f9d5a;
  color: #fff;
}

/* Make inputs inside q-cards show on white so they're readable against the earthy card bg */
.q-card .text-input {
  background: var(--surface-card);
}

.correct-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 5px;
}

.q-funfact-label { display: block; }

/* Question image upload */
.q-img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(217, 107, 39, 0.07), rgba(216, 107, 129, 0.10));
  border: 2px dashed var(--border-soft);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-family: inherit;
}
.q-img-placeholder:hover {
  border-color: var(--accent-orange);
  background: linear-gradient(135deg, rgba(217, 107, 39, 0.12), rgba(216, 107, 129, 0.15));
}
.q-img-ph-icon  { font-size: 2rem; opacity: 0.45; pointer-events: none; }
.q-img-ph-text  { font-size: 0.9rem; font-weight: 700; color: var(--text-muted); pointer-events: none; }
.q-img-ph-hint  { font-size: 0.75rem; color: var(--text-muted); opacity: 0.65; pointer-events: none; }

.q-img-preview {
  width: 100%;
}
.q-img-preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--highlight-pink);
  display: block;
}
.q-img-remove {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-red);
  background: none;
  border: 1.5px solid var(--primary-red);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s, color 0.18s;
}
.q-img-remove:hover { background: var(--primary-red); color: #fff; }

/* Fun fact live preview — same look as .fun-fact in the quiz but no entry animation */
.portal-funfact-preview {
  animation: none;
  margin-top: 10px;
}
.portal-funfact-preview::before {
  content: 'Preview ↓ ';
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--highlight-pink);
  display: block;
  margin-bottom: 4px;
}

/* Add question button */
.btn-add-q {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--border-soft);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--accent-orange);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin: 0 0 16px;
}
.btn-add-q:hover {
  border-color: var(--accent-orange);
  background: rgba(217, 107, 39, 0.06);
}

/* ── Guestbook step ────────────────────────────────────────────────── */
.already-signed-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: rgba(63, 157, 90, 0.08);
  border: 2px solid #3f9d5a;
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-size: 0.98rem;
  line-height: 1.5;
}
.already-signed-icon { font-size: 1.5rem; flex-shrink: 0; }

/* ── Success screen ────────────────────────────────────────────────── */
.portal-success {
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
}

.success-extras {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 4px;
}

.success-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-earth);
  border: 1px solid var(--border-soft);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
}

.success-play-btn {
  text-decoration: none;
  display: block;
  margin-top: 22px;
}

/* Confetti */
.confetti-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  animation: confettiFall linear forwards;
  border-radius: 2px;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

/* ── Guestbook display ─────────────────────────────────────────────── */
.guestbook-board {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 2px solid var(--border-soft);
  padding-bottom: 60px;
}

.guestbook-board-title {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  color: var(--primary-red);
  text-align: center;
  margin-bottom: 6px;
}

.guestbook-board-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.gb-entries {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gb-entry {
  display: flex;
  gap: 14px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 4px 14px rgba(43, 33, 33, 0.06);
  animation: cardIn 0.35s var(--ease);
}

.gb-entry-avatar {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  background: var(--bg-earth);
}
.gb-entry-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gb-entry-body   { flex: 1; min-width: 0; }
.gb-entry-name   { font-weight: 800; color: var(--primary-red); font-size: 0.95rem; margin-bottom: 5px; }
.gb-entry-msg    { font-size: 0.95rem; color: var(--text-dark); line-height: 1.55; word-break: break-word; }
.gb-entry-date   { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

.gb-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 28px 0;
}
