/* ══════════════════════════════════════════════
   PassOnward Portal — Shared Styles
   ══════════════════════════════════════════════ */

:root {
  --teal: #007B8A;
  --teal-dark: #005F6B;
  --teal-deep: #003D44;
  --teal-light: #E0F4F6;
  --teal-pale: #F2FBFC;
  --gold: #C49A2A;
  --gold-light: #FFF8E6;
  --ink: #1A2326;
  --mid: #4A5568;
  --muted: #718096;
  --light: #F7FAFA;
  --white: #ffffff;
  --border: #E2E8F0;
  --danger: #E53E3E;
  --success: #38A169;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--light);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; font-weight: 700; line-height: 1.2; }

/* ── PORTAL NAV ── */
.portal-nav {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 6%;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.portal-nav-logo { display: flex; align-items: center; text-decoration: none; }
.portal-nav-logo img { height: 30px; }
.portal-nav-right { display: flex; align-items: center; gap: 16px; }
.portal-nav-user {
  font-size: 13px; font-weight: 600; color: var(--mid);
  display: flex; align-items: center; gap: 8px;
}
.portal-nav-user::before {
  content: '';
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal-light);
  display: flex; align-items: center; justify-content: center;
}
.portal-nav-logout {
  font-size: 13px; font-weight: 500; color: var(--muted);
  text-decoration: none; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 6px;
  transition: all 0.2s;
}
.portal-nav-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ── PROGRESS BAR ── */
.progress-bar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 20px 6%;
}
.progress-inner {
  max-width: 800px; margin: 0 auto;
  display: flex; align-items: center; gap: 4px;
}
.progress-step {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  position: relative;
}
.progress-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  transition: all 0.3s; position: relative; z-index: 2;
}
.progress-step.done .progress-dot {
  background: var(--teal); border-color: var(--teal); color: white;
}
.progress-step.active .progress-dot {
  background: var(--gold); border-color: var(--gold); color: white;
  box-shadow: 0 0 0 4px rgba(196,154,42,0.2);
}
.progress-label {
  font-size: 10px; font-weight: 600; color: var(--muted);
  margin-top: 6px; text-align: center; letter-spacing: 0.02em;
  white-space: nowrap;
}
.progress-step.done .progress-label { color: var(--teal); }
.progress-step.active .progress-label { color: var(--gold); font-weight: 700; }

/* Clickable completed steps */
a.progress-step {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.progress-step.done:hover .progress-dot {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  transform: scale(1.12);
}
a.progress-step.done:hover .progress-label {
  color: var(--teal-dark);
}

.progress-line {
  flex: 0.5; height: 2px; background: var(--border);
  margin-top: -14px; /* align with dots */
}
.progress-line.done { background: var(--teal); }

/* ── PORTAL CONTAINER ── */
.portal-container {
  max-width: 780px; margin: 32px auto; padding: 0 24px 64px;
}

/* ── CARD ── */
.portal-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.portal-card-header {
  padding: 28px 36px 24px;
  border-bottom: 1px solid var(--border);
}
.portal-card-header .step-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--teal);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.portal-card-header h2 { font-size: 24px; margin-bottom: 6px; }
.portal-card-header p { font-size: 14px; color: var(--mid); }

.portal-card-body { padding: 32px 36px; }

/* ── AUTO-SAVE BANNER ── */
.autosave-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--teal-pale); border: 1px solid rgba(0,123,138,0.1);
  border-radius: var(--radius-sm); padding: 12px 20px;
  margin-bottom: 28px; font-size: 13px;
}
.autosave-status { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--mid); }
.autosave-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #CBD5E0;
  transition: background 0.3s;
}
.autosave-dot.saving { background: var(--gold); animation: pulse 1s infinite; }
.autosave-dot.saved { background: var(--success); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── FORM ELEMENTS ── */
.form-section {
  margin-bottom: 32px;
}
.form-section-title {
  font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--ink); margin-bottom: 4px;
  display: flex; align-items: center; gap: 10px;
}
.form-section-title .icon { font-size: 18px; }
.form-section-desc {
  font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.6;
}

.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 16px;
}
.form-row.single { grid-template-columns: 1fr; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label {
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.form-group .hint {
  font-size: 12px; color: var(--muted); font-weight: 400; font-style: italic;
}
.form-group input, .form-group textarea, .form-group select {
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: white; color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,123,138,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Styled radio/checkbox groups */
.option-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
  margin-top: 8px;
}
.option-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all 0.2s; font-size: 14px;
}
.option-item:hover { border-color: var(--teal); background: var(--teal-pale); }
.option-item.selected { border-color: var(--teal); background: var(--teal-light); }
.option-item input { accent-color: var(--teal); }

/* Info box */
.info-box {
  display: flex; gap: 12px; padding: 14px 18px;
  background: var(--gold-light); border: 1px solid rgba(196,154,42,0.2);
  border-radius: var(--radius-sm); margin-bottom: 20px;
  font-size: 13px; color: var(--ink); line-height: 1.6;
}
.info-box.teal { background: var(--teal-pale); border-color: rgba(0,123,138,0.15); }
.info-box.danger { background: #FFF5F5; border-color: rgba(229,62,62,0.2); }
.info-box-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* Account table for repeating rows */
.account-block {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 16px; overflow: hidden;
}
.account-block-header {
  background: var(--teal-pale); padding: 12px 18px;
  font-size: 14px; font-weight: 700; color: var(--teal-dark);
  display: flex; align-items: center; justify-content: space-between;
}
.account-block-body { padding: 18px; }
.account-block .form-row { margin-bottom: 12px; }
.account-block .form-row:last-child { margin-bottom: 0; }

.add-account-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: 1px dashed var(--teal);
  border-radius: 8px; background: var(--teal-pale);
  color: var(--teal); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.add-account-btn:hover { background: var(--teal-light); }

.remove-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 18px; padding: 2px 6px; border-radius: 4px;
  transition: all 0.2s;
}
.remove-btn:hover { color: var(--danger); background: #FFF5F5; }

/* ── NAVIGATION BUTTONS ── */
.portal-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px; margin-top: 8px;
  border-top: 1px solid var(--border);
}
.portal-actions .btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none;
  transition: all 0.25s;
}
.btn-back {
  background: transparent; color: var(--mid);
  border: 1px solid var(--border) !important;
}
.btn-back:hover { border-color: var(--ink) !important; color: var(--ink); }
.btn-next {
  background: var(--teal); color: white;
  box-shadow: 0 2px 8px rgba(0,123,138,0.25);
}
.btn-next:hover { background: var(--teal-dark); transform: translateY(-1px); }
.btn-next:disabled {
  background: #CBD5E0; cursor: not-allowed; box-shadow: none;
  transform: none;
}
.btn-next svg, .btn-back svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* ── DONE BANNER ── */
.done-banner {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 22px; border-radius: var(--radius-sm);
  background: var(--teal-pale); border: 1px solid rgba(0,123,138,0.15);
  margin-bottom: 24px;
}
.done-banner-icon { font-size: 24px; flex-shrink: 0; }
.done-banner-text strong { display: block; color: var(--teal-dark); margin-bottom: 2px; }
.done-banner-text span { font-size: 13px; color: var(--mid); }

/* ── AUTH CARD (login/register) ── */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 24px; background: var(--light);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-card-header {
  background: linear-gradient(135deg, var(--teal-deep), var(--teal));
  padding: 36px 36px 28px; text-align: center;
}
.auth-card-header img { height: 36px; margin-bottom: 16px; }
.auth-card-header h1 { font-size: 24px; color: white; margin-bottom: 6px; }
.auth-card-header p { font-size: 14px; color: rgba(255,255,255,0.75); }
.auth-card-body { padding: 32px 36px; }

.auth-field { margin-bottom: 18px; }
.auth-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.auth-field input {
  width: 100%; padding: 12px 14px;
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: white; color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,123,138,0.1); }

.auth-submit {
  width: 100%; padding: 14px; margin-top: 8px;
  background: var(--teal); color: white; border: none; border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,123,138,0.25);
}
.auth-submit:hover { background: var(--teal-dark); }

.auth-error {
  background: #FFF5F5; border: 1px solid rgba(229,62,62,0.2);
  color: var(--danger); padding: 10px 14px; border-radius: 8px;
  font-size: 13px; margin-bottom: 16px; display: none;
}
.auth-footer {
  text-align: center; padding: 0 36px 28px;
  font-size: 13px; color: var(--muted);
}
.auth-footer a { color: var(--teal); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* ── LOCKED STATE ── */
.locked-message {
  text-align: center; padding: 60px 36px;
}
.locked-message .lock-icon { font-size: 48px; margin-bottom: 16px; }
.locked-message h3 { font-size: 20px; margin-bottom: 8px; }
.locked-message p { font-size: 14px; color: var(--mid); margin-bottom: 24px; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .portal-card-header, .portal-card-body { padding-left: 20px; padding-right: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.triple { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .progress-label { font-size: 9px; }
  .portal-actions { flex-direction: column-reverse; gap: 12px; }
  .portal-actions .btn { width: 100%; justify-content: center; }
}
