/* ==========================================================================
   Resident Registration — Style Sheet
  Design language: civic registry / official ledger.
  Palette: clear blue + orange, cool paper background.
   Type: Fraunces (display) + Public Sans (UI/body).
   ========================================================================== */

:root{
  /* -- Color tokens -- */
  --color-primary:        #0B63D6;
  --color-primary-dark:   #083D96;
  --color-primary-light:  #3B82F6;
  --color-accent:         #F4691F;
  --color-accent-light:   #FDBA74;
  --color-bg:             #F4F7FB;
  --color-surface:        #FFFFFF;
  --color-text:           #0F172A;
  --color-text-muted:     #64748B;
  --color-border:         #E2E8F0;
  --color-success:        #2563EB;
  --color-danger:         #B3261E;
  --color-info:           #1D4ED8;

  /* -- Type tokens -- */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* -- Layout tokens -- */
  --brand-width: 38%;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 20px 60px -25px rgba(8, 61, 150, 0.35);
}

*{ box-sizing: border-box; }

html, body{
  height: 100%;
}

body{
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Subtle paper texture on the app background */
.app-shell{
  min-height: 100vh;
  display: flex;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(8,61,150,0.06) 1px, transparent 0);
  background-size: 22px 22px;
}

a{ color: var(--color-primary); }

::selection{ background: var(--color-accent-light); color: var(--color-primary-dark); }

/* Focus visibility (accessibility floor) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible{
  outline: 2.5px solid var(--color-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Branding panel (left on desktop, condensed top bar on mobile)
   ========================================================================== */

.brand-panel{
  width: var(--brand-width);
  min-width: 360px;
  background:
    radial-gradient(120% 140% at 15% -10%, #124E9B 0%, transparent 55%),
    linear-gradient(165deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #EFF6FF;
  padding: 56px 48px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.brand-mark{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.brand-seal{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid rgba(253, 186, 116, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: radial-gradient(circle, rgba(253,186,116,0.14) 0%, transparent 70%);
}

.brand-seal svg{ width: 26px; height: 26px; }

.brand-wordmark{ line-height: 1.15; }
.brand-wordmark .line1{
  display:block;
  font-family: var(--font-body);
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-accent-light);
  font-weight: 600;
}
.brand-wordmark .line2{
  display:block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: #F8FAFC;
}

.brand-copy h1{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: #FFFFFF;
}

.brand-copy p{
  color: rgba(239, 246, 255, 0.78);
  font-size: 15px;
  max-width: 38ch;
  margin-bottom: 40px;
}

/* -- Ledger stepper (signature element) --
   Circles rendered like registry stamp rings; the current step glows,
   completed steps fill solid gold with a check, like an ink stamp. */

.ledger{
  list-style: none;
  margin: 0 0 auto 0;
  padding: 0;
  position: relative;
}

.ledger::before{
  content: "";
  position: absolute;
  left: 17px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, rgba(253,186,116,0.5), rgba(253,186,116,0.08));
}

.ledger-item{
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  padding-bottom: 26px;
}
.ledger-item:last-child{ padding-bottom: 0; }

.ledger-stamp{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  background: var(--color-primary-dark);
  border: 1.5px solid rgba(228, 199, 126, 0.35);
  color: rgba(239, 246, 255, 0.55);
  position: relative;
  z-index: 1;
  transition: all .35s ease;
}

.ledger-item.is-done .ledger-stamp{
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.35), transparent 45%),
    var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-primary-dark);
  transform: rotate(-6deg);
  box-shadow: 0 4px 14px -4px rgba(200,155,60,0.7);
}

.ledger-item.is-active .ledger-stamp{
  border-color: var(--color-accent);
  color: #FBFAF4;
  box-shadow: 0 0 0 4px rgba(228,199,126,0.16);
}

.ledger-text .label{
  display:block;
  font-size: 13px;
  color: rgba(239, 246, 255, 0.5);
  letter-spacing: 0.03em;
}
.ledger-item.is-active .ledger-text .label,
.ledger-item.is-done .ledger-text .label{
  color: var(--color-accent-light);
}
.ledger-text .title{
  display:block;
  font-weight: 600;
  font-size: 14.5px;
  color: rgba(239, 246, 255, 0.62);
  margin-top: 1px;
}
.ledger-item.is-active .ledger-text .title{ color: #FFFFFF; }
.ledger-item.is-done .ledger-text .title{ color: rgba(239, 246, 255, 0.85); }

.brand-footnote{
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(228,199,126,0.18);
  font-size: 12.5px;
  color: rgba(239, 246, 255, 0.45);
}

/* Condensed top bar shown only on small screens */
.brand-bar{
  display: none;
}

/* ==========================================================================
   Content panel (right on desktop, full width on mobile)
   ========================================================================== */

.content-panel{
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 56px 40px 80px;
  min-width: 0;
}

.form-card{
  width: 100%;
  max-width: 660px;
}

.step-eyebrow{
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-info);
  margin-bottom: 6px;
}

.step-heading{
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: 6px;
}

.step-subheading{
  color: var(--color-text-muted);
  font-size: 14.5px;
  margin-bottom: 32px;
}

/* Mobile dot progress (shown under the heading on small screens) */
.dot-progress{
  display: none;
  gap: 6px;
  margin-bottom: 24px;
}
.dot-progress span{
  height: 5px;
  flex: 1;
  border-radius: 3px;
  background: var(--color-border);
  transition: background .3s ease;
}
.dot-progress span.is-done,
.dot-progress span.is-active{ background: var(--color-accent); }

/* -- Form step panes -- */
.step-pane{ display: none; }
.step-pane.is-visible{ display: block; animation: fadeSlide .35s ease; }

@keyframes fadeSlide{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce){
  .step-pane.is-visible{ animation: none; }
  .ledger-item .ledger-stamp{ transition: none; }
}

/* -- Field styling -- */
.field-label{
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  display: inline-block;
}
.field-label .req{ color: var(--color-danger); margin-left: 2px; }
.field-hint{
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 5px;
}

.form-control,
.form-select{
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14.5px;
  color: var(--color-text);
  background-color: var(--color-surface);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-control:focus,
.form-select:focus{
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3.5px rgba(8,61,150,0.10);
}
.form-control[readonly]{
  background-color: #EFF6FF;
  color: var(--color-text-muted);
}
.form-control.is-invalid,
.form-select.is-invalid{
  border-color: var(--color-danger);
}
.form-control.is-valid,
.form-select.is-valid{
  border-color: var(--color-success);
}
.invalid-feedback{ font-size: 12px; }

.input-group .input-group-text{
  background: #EFF6FF;
  border: 1.5px solid var(--color-border);
  border-right: none;
  color: var(--color-text-muted);
  font-size: 14px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group .form-control{ border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.form-check-input:checked{
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
.form-check-input:focus{
  box-shadow: 0 0 0 3.5px rgba(8,61,150,0.10);
}

/* -- Navigation buttons -- */
.step-nav{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.btn{
  font-size: 14.5px;
  font-weight: 600;
  padding: 11px 26px;
  border-radius: 999px;
  transition: all .2s ease;
}
.btn-primary{
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-primary:hover, .btn-primary:focus{
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}
.btn-primary:disabled{
  background: #9CB1A5;
  border-color: #9CB1A5;
}
.btn-outline-secondary{
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline-secondary:hover{
  background: #EFEDE3;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-accent{
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-primary-dark);
}
.btn-accent:hover{
  background: var(--color-accent-light);
  border-color: var(--color-accent-light);
  color: var(--color-primary-dark);
}
.btn-link.small-link{
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* -- Section fieldset divider (used within long steps) -- */
.field-section-title{
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary);
  margin: 30px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--color-border);
}
.field-section-title:first-of-type{ margin-top: 0; }

/* -- Upload cards (ID, profile, cover) -- */
.upload-card{
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #FBFAF5;
  height: 100%;
}
.upload-card .upload-title{
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 3px;
}
.upload-card .upload-hint{
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.upload-preview{
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: var(--radius-sm);
  background: #EFEDE3 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 12.5px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.upload-preview.is-round{ border-radius: 50%; aspect-ratio: 1/1; max-width: 140px; margin-left: auto; margin-right: auto; }
.upload-preview img{ width: 100%; height: 100%; object-fit: cover; }
.upload-actions{ display: flex; gap: 8px; }
.upload-actions .btn{
  flex: 1;
  padding: 8px 10px;
  font-size: 12.5px;
}
.upload-status{
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
}
.upload-status.ok{ color: var(--color-success); }

/* -- Review step -- */
.review-group{
  margin-bottom: 22px;
}
.review-group-title{
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-primary);
  font-size: 15.5px;
  margin-bottom: 10px;
}
.review-group-title .edit-link{
  font-size: 12px;
  font-weight: 600;
  color: var(--color-info);
  text-decoration: none;
  cursor: pointer;
}
.review-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.review-table tr{ border-bottom: 1px solid var(--color-border); }
.review-table tr:last-child{ border-bottom: none; }
.review-table td{
  padding: 8px 4px;
  vertical-align: top;
}
.review-table td.rlabel{
  color: var(--color-text-muted);
  width: 46%;
}
.review-table td.rvalue{
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
}
.review-photos{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.review-photos .rp-thumb{
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: #EFEDE3;
}

/* -- Password step -- */
.password-strength{
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.password-strength span{
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--color-border);
}
.password-strength.s1 span:nth-child(1){ background: var(--color-danger); }
.password-strength.s2 span:nth-child(-n+2){ background: #ea580c; }
.password-strength.s3 span:nth-child(-n+3){ background: var(--color-accent); }
.password-strength.s4 span{ background: var(--color-success); }

.toggle-visibility{
  cursor: pointer;
  background: #fff7ed;
  border: 1.5px solid var(--color-border);
  border-left: none;
}

/* -- OTP step -- */
.otp-inputs{
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}
.otp-inputs input{
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-display);
}
@media (max-width: 420px){
  .otp-inputs input{ width: 40px; height: 50px; font-size: 19px; }
}

/* -- Success modal seal -- */
.success-seal{
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.5), transparent 45%), var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 10px 26px -10px rgba(200,155,60,0.7);
}
.success-seal svg{ width: 34px; height: 34px; color: var(--color-primary-dark); }

/* -- Camera capture modal -- */
.camera-video, .camera-canvas{
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
}
.camera-canvas{ display: none; }

/* -- Alerts -- */
.form-alert{
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  padding: 12px 16px;
}

/* -- Spinner within buttons -- */
.btn .spinner-border{
  width: 15px; height: 15px; border-width: 2px; margin-right: 6px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991.98px){
  .app-shell{ flex-direction: column; }

  .brand-panel{ display: none; }

  .brand-bar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .brand-bar .brand-mark{ margin-bottom: 0; }
  .brand-bar .brand-wordmark .line2{ font-size: 16px; }
  .brand-bar .brand-seal{ width: 38px; height: 38px; }
  .brand-bar .brand-seal svg{ width: 20px; height: 20px; }
  .brand-bar .step-count{
    font-size: 12px;
    color: var(--color-accent-light);
    font-weight: 600;
    white-space: nowrap;
  }

  .content-panel{ padding: 28px 18px 60px; }
  .dot-progress{ display: flex; }
  .step-heading{ font-size: 22px; }
}

@media (max-width: 575.98px){
  .otp-inputs input{ width: 44px; }
  .upload-actions{ flex-direction: column; }
}
