/**
 * ECS Submission Guest Page — OTP Flow
 * Namespace: .ecsg-*
 * All rules scoped to prevent theme CSS interference.
 */

/* ─── Variables ─── */
.ecsg-wrap {
  --sg-blue:       #3b82f6;
  --sg-blue-dk:    #2563eb;
  --sg-blue-lt:    #eff6ff;
  --sg-orange:     #f97316;
  --sg-orange-dk:  #ea580c;
  --sg-orange-lt:  #fff7ed;
  --sg-navy:       #0f172a;
  --sg-text:       #1e293b;
  --sg-muted:      #64748b;
  --sg-border:     #e2e8f0;
  --sg-light:      #f8fafc;
  --sg-white:      #ffffff;
  --sg-success:    #059669;
  --sg-error:      #dc2626;
  --sg-radius:     16px;
  --sg-radius-sm:  10px;
  --sg-shadow:     0 4px 24px rgba(0,0,0,.07);
  --sg-shadow-lg:  0 20px 60px rgba(0,0,0,.13);
  --sg-trans:      all .22s ease;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--sg-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scoped reset ─── */
.ecsg-wrap *, .ecsg-wrap *::before, .ecsg-wrap *::after { box-sizing: border-box; }
.ecsg-wrap a   { text-decoration: none; }
.ecsg-wrap ul  { list-style: none; margin: 0; padding: 0; }
.ecsg-wrap p   { margin-top: 0; }
.ecsg-wrap h1, .ecsg-wrap h2, .ecsg-wrap h3 { margin-top: 0; line-height: 1.25; }
.ecsg-wrap button { font-family: inherit; }

/* ═══════════════════════════════════
   CONTEXT BANNER
═══════════════════════════════════ */
.ecsg-context {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--sg-navy) 0%, #1e3a5f 100%);
  color: #fff;
  padding: 18px 28px;
  border-radius: var(--sg-radius);
  margin-bottom: 32px;
  flex-wrap: wrap;
  box-shadow: var(--sg-shadow);
}
.ecsg-context__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  color: #fbbf24;
}
.ecsg-context__text { flex: 1; min-width: 0; }
.ecsg-context__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.6);
  margin-bottom: 3px;
}
.ecsg-context__title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ecsg-context__deadline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(249,115,22,.2);
  border: 1px solid rgba(249,115,22,.35);
  color: #fdba74;
  padding: 7px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.ecsg-context__deadline i { font-size: 12px; }

/* ═══════════════════════════════════
   GATE CARD  (single centred card)
═══════════════════════════════════ */
.ecsg-gate {
  max-width: 540px;
  margin-inline: auto;
  background: var(--sg-white);
  border-radius: var(--sg-radius);
  border: 1px solid var(--sg-border);
  box-shadow: var(--sg-shadow-lg);
  overflow: hidden;
}

/* Step panels (only one visible at a time) */
.ecsg-step-panel { display: none; }
.ecsg-step-panel--active { display: block; }

/* ─── Gate header ─── */
.ecsg-gate__header {
  padding: 36px 36px 24px;
  text-align: center;
  position: relative;
  background: var(--sg-light);
  border-bottom: 1px solid var(--sg-border);
}
.ecsg-gate__icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
}
.ecsg-gate__icon--blue   { background: var(--sg-blue-lt); color: var(--sg-blue); }
.ecsg-gate__icon--orange { background: var(--sg-orange-lt); color: var(--sg-orange); }

.ecsg-gate__title {
  font-size: 22px !important;
  font-weight: 800 !important;
  color: var(--sg-text) !important;
  margin: 0 0 8px !important;
}
.ecsg-gate__sub {
  font-size: 14px;
  color: var(--sg-muted);
  margin: 0;
  line-height: 1.55;
}

/* ─── Back button ─── */
.ecsg-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: transparent;
  border: 1px solid var(--sg-border);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--sg-trans);
}
.ecsg-back-btn:hover {
  border-color: var(--sg-blue);
  color: var(--sg-blue);
  background: var(--sg-blue-lt);
}

/* ─── Gate body ─── */
.ecsg-gate__body {
  padding: 28px 36px 36px;
  display: flex;
  flex-direction: column;
}

/* ─── Gate footer ─── */
.ecsg-gate__footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--sg-border);
  text-align: center;
}
.ecsg-gate__footer p {
  margin: 0;
  font-size: 13px;
  color: var(--sg-muted);
}

/* ═══════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════ */
.ecsg-field { margin-bottom: 20px; }

.ecsg-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sg-text);
  margin-bottom: 8px;
}
.ecsg-label i { color: var(--sg-blue); font-size: 12px; width: 14px; }
.ecsg-label--center { justify-content: center; }

.ecsg-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--sg-border);
  border-radius: var(--sg-radius-sm);
  font-size: 15px;
  color: var(--sg-text);
  background: var(--sg-white);
  transition: var(--sg-trans);
  outline: none;
  font-family: inherit;
  display: block;
}
.ecsg-input:focus {
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.ecsg-input::placeholder { color: #94a3b8; }
.ecsg-input.ecsg-has-error {
  border-color: var(--sg-error);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.ecsg-input--lg { font-size: 16px; padding: 14px 16px; }

/* Password toggle wrapper */
.ecsg-input-wrap { position: relative; }
.ecsg-input-wrap .ecsg-input { padding-right: 46px; }
.ecsg-toggle-pwd {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--sg-muted);
  font-size: 14px;
  padding: 4px;
  line-height: 1;
  transition: color .2s;
}
.ecsg-toggle-pwd:hover { color: var(--sg-blue); }

/* ═══════════════════════════════════
   OTP DIGIT BOXES
   High-specificity selectors (.ecsg-wrap .ecsg-otp-*) beat BeTheme's
   input[type="text"] rule (0,1,1) because (0,2,0) wins.
   !important guards on sizing/spacing properties stop any remaining
   theme overrides (width:230px, max-width:100%, padding:10px,
   margin-bottom:20px, border-radius:0, display:block).
═══════════════════════════════════ */
.ecsg-wrap .ecsg-otp-boxes {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  overflow-x: auto;
  /* extra vertical padding so focus ring isn't clipped */
  padding: 4px 2px;
  box-sizing: border-box;
}

/* Each digit box — fixed 44 px, nothing the theme can stretch */
.ecsg-wrap .ecsg-otp-boxes .ecsg-otp-box {
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 56px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-block !important;
  border: 2px solid var(--sg-border) !important;
  border-radius: 10px !important;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--sg-text);
  background: var(--sg-white);
  transition: var(--sg-trans);
  outline: none;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  caret-color: transparent;
  box-sizing: border-box !important;
  line-height: 56px;
}
.ecsg-wrap .ecsg-otp-boxes .ecsg-otp-box:focus {
  border-color: var(--sg-blue) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
  background: var(--sg-blue-lt);
}
.ecsg-wrap .ecsg-otp-boxes .ecsg-otp-box.ecsg-has-error {
  border-color: var(--sg-error) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

.ecsg-wrap .ecsg-otp-sep {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 300;
  color: var(--sg-border);
  margin: 0;
  user-select: none;
  line-height: 1;
}

/* ─── Countdown / Resend row ─── */
.ecsg-resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
  color: var(--sg-muted);
  margin: 14px 0 20px;
  text-align: center;
  flex-wrap: wrap;
}
#ecsg-timer { font-variant-numeric: tabular-nums; color: var(--sg-blue); }
.ecsg-resend-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

/* ═══════════════════════════════════
   BUTTONS
═══════════════════════════════════ */
.ecsg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
  transition: var(--sg-trans);
  text-decoration: none !important;
  width: 100%;
  font-family: inherit;
}
.ecsg-btn--primary {
  background: var(--sg-blue);
  color: #fff !important;
  border-color: var(--sg-blue);
}
.ecsg-btn--primary:hover:not(:disabled) {
  background: var(--sg-blue-dk);
  border-color: var(--sg-blue-dk);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(59,130,246,.35);
}
.ecsg-btn--primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.ecsg-btn--secondary {
  background: var(--sg-orange);
  color: #fff !important;
  border-color: var(--sg-orange);
}
.ecsg-btn--secondary:hover {
  background: var(--sg-orange-dk);
  border-color: var(--sg-orange-dk);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(249,115,22,.35);
}
.ecsg-btn .ecsg-btn-loader { display: none; }
.ecsg-btn.is-loading .ecsg-btn-text   { display: none; }
.ecsg-btn.is-loading .ecsg-btn-loader { display: inline-flex; align-items: center; gap: 8px; }

/* ═══════════════════════════════════
   ALERT MESSAGES
═══════════════════════════════════ */
.ecsg-msg {
  padding: 12px 16px;
  border-radius: var(--sg-radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.ecsg-msg i { flex-shrink: 0; margin-top: 2px; }
.ecsg-msg--error   { background: #fef2f2; border: 1px solid #fca5a5; color: var(--sg-error); }
.ecsg-msg--success { background: #f0fdf4; border: 1px solid #86efac; color: var(--sg-success); }
.ecsg-msg--info    { background: var(--sg-blue-lt); border: 1px solid #bfdbfe; color: var(--sg-blue-dk); }
.ecsg-msg--warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }

/* ═══════════════════════════════════
   LINKS
═══════════════════════════════════ */
.ecsg-link {
  color: var(--sg-blue);
  font-size: 14px;
  font-weight: 500;
  transition: color .2s;
}
.ecsg-link:hover { color: var(--sg-blue-dk); text-decoration: underline; }
.ecsg-link--sm   { font-size: 13px; }
.ecsg-link--btn  {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
}

/* Highlighted email / name */
.ecsg-highlight { color: var(--sg-blue); }

/* ═══════════════════════════════════
   ROWS
═══════════════════════════════════ */
.ecsg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.ecsg-row--right { justify-content: flex-end; }

/* ═══════════════════════════════════
   REGISTRATION STEPS (step 3)
═══════════════════════════════════ */
.ecsg-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}
.ecsg-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.ecsg-step__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sg-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.ecsg-step strong { display: block; font-size: 14px; font-weight: 700; color: var(--sg-text); margin-bottom: 2px; }
.ecsg-step p { font-size: 13px; color: var(--sg-muted); margin: 0; line-height: 1.45; }

.ecsg-note {
  font-size: 12px;
  color: var(--sg-muted);
  margin: 14px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.5;
}
.ecsg-note i { margin-top: 2px; flex-shrink: 0; color: var(--sg-orange); }

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 600px) {
  .ecsg-context  { padding: 14px 18px; gap: 12px; }
  .ecsg-gate__header { padding: 28px 22px 20px; }
  .ecsg-gate__body   { padding: 22px 22px 28px; }

  .ecsg-wrap .ecsg-otp-boxes .ecsg-otp-box { flex: 0 0 38px !important; width: 38px !important; min-width: 38px !important; max-width: 38px !important; height: 50px !important; font-size: 19px; line-height: 50px; }
  .ecsg-wrap .ecsg-otp-boxes { gap: 5px; }

  .ecsg-btn { padding: 13px 20px; font-size: 14px; }
}

@media (max-width: 380px) {
  .ecsg-wrap .ecsg-otp-boxes .ecsg-otp-box { flex: 0 0 32px !important; width: 32px !important; min-width: 32px !important; max-width: 32px !important; height: 44px !important; font-size: 16px; line-height: 44px; border-radius: 7px !important; }
  .ecsg-wrap .ecsg-otp-boxes { gap: 4px; }
}
