/* =========================================================
   Registration popup styles (public pages and admin panel)
   ========================================================= */

/* Overlay Background */
.rw-overlay {
  position: fixed; 
  inset: 0; 
  background: rgba(23, 21, 38, 0.55);
  display: none; 
  align-items: center; 
  justify-content: center;
  padding: 16px; 
  z-index: 2000;
}
.rw-overlay.open { display: flex; }

/* Modal Box Container */
.rw-box {
  background: var(--paper, #fffdf8); 
  border-radius: var(--radius-lg, 24px);
  width: 100%; 
  max-width: 900px; 
  max-height: 92vh;
  min-height: 65vh; 
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(23, 21, 38, 0.3);
  display: grid; 
  grid-template-columns: 1fr 2fr;
}

/* Left Visual Panel */
.rw-visual {
  background-color: #1B1533; 
  background-size: cover; 
  background-position: center bottom;
  background-repeat: no-repeat; 
  color: #fff; 
  padding: 32px 26px;
  display: flex; 
  flex-direction: column; 
  justify-content: flex-start; 
  gap: 12px;
  position: relative; 
  min-height: 100%;
}
.rw-visual::before {
  content: ''; 
  position: absolute; 
  inset: 0;
  background: linear-gradient(180deg, rgba(20,14,40,0.6) 0%, rgba(20,14,40,0.2) 45%, rgba(20,14,40,0) 65%);
  pointer-events: none;
}
.rw-visual > * { position: relative; z-index: 1; }
.rw-visual .rw-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.rw-visual .brand-word { color: #fff; }
.rw-visual .brand-word span { color: #FFD86A; }
.rw-visual h2 { color: #fff; font-size: 22px; line-height: 1.3; margin: 8px 0 6px; }
.rw-visual h2 span { color: #FFD86A; }
.rw-visual p { color: #E4DFF5; font-size: 13px; max-width: 280px; margin: 0; }

/* Right Form Panel */
.rw-panel { 
  display: flex; 
  flex-direction: column; 
  max-height: 92vh;
  min-height: 65vh; 
  min-width: 0; 
  overflow-y: auto;
  justify-content: space-around;
}

.rw-header {
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  padding: 14px 20px; 
  border-bottom: 1px solid var(--line, #e2e8f0);
  position: sticky; 
  top: 0; 
  background: var(--paper, #fffdf8); 
  z-index: 10;
}
.rw-header h3 { margin: 0; font-size: 1.1rem; }
.rw-close {
  background: none; 
  border: none; 
  cursor: pointer; 
  font-size: 1.3rem;
  line-height: 1; 
  color: var(--muted, #8b87a6); 
  padding: 4px 6px;
}
.rw-close:hover { color: var(--ink, #171526); }

/* Steps Navigation Bar */
.rw-steps { display: flex; gap: 6px; padding: 10px 20px 0; }
.rw-steps .rw-dot { flex: 1; text-align: center; font-size: 0.68rem; color: var(--muted, #8b87a6); font-weight: 700; }
.rw-steps .rw-dot .rw-num {
  width: 20px; height: 20px; border-radius: 50%; background: #EFEAF5;
  color: var(--muted, #8b87a6); display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; margin: 0 auto 3px; font-weight: 800;
}
.rw-steps .rw-dot.active .rw-num,
.rw-steps .rw-dot.done .rw-num { background: var(--purple, #71007f); color: #fff; }
.rw-steps .rw-dot.active span, .rw-steps .rw-dot.done span { color: var(--ink, #171526); }

.rw-body { padding: 12px 20px; }

/* Form Grid & Input Fields */
#rwOverlay .form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
}
#rwOverlay .field { margin-bottom: 0; }
#rwOverlay .field.full { grid-column: span 2; }
#rwOverlay .field label {
  display: block;
  font-size: 11px;
  margin: 0 0 2px 1px;
  font-weight: 600;
  color: var(--ink, #171526);
}

#rwOverlay .field input[type="text"],
#rwOverlay .field input[type="email"],
#rwOverlay .field input[type="date"],
#rwOverlay .field select {
  width: 100%;
  padding: 4px 8px; 
  border-radius: 8px; 
  font-size: 12px; 
  height: 34px;
  border: 1px solid var(--line, #d1d5db); 
  background-color: #ffffff;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#rwOverlay .field textarea {
  width: 100%; 
  min-height: 44px; 
  padding: 5px 8px;
  border-radius: 8px; 
  font-size: 12px; 
  border: 1px solid var(--line, #d1d5db);
  background-color: #ffffff;
}

#rwOverlay .field input:focus, 
#rwOverlay .field select:focus, 
#rwOverlay .field textarea:focus {
  border-color: var(--purple, #71007f); 
  outline: none;
  box-shadow: 0 0 0 2px rgba(113,0,127,0.12);
}

/* =========================================================
   COMBINED ROW: TYPE OF PARTICIPANT + PHONE 1 + PHONE 2
   ========================================================= */
#rwOverlay .rw-combined-row {
  grid-column: span 2;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 12px;
  align-items: flex-end;
}

/* Checkbox (No Outer Border + Vertical Label Below Box) */
#rwOverlay .rw-type-field .rw-radio-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 2px;
}

#rwOverlay .rw-radio-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

#rwOverlay .rw-radio-item input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid #c8cbd0;
  border-radius: 4px; /* Soft Square */
  background-color: #ffffff;
  outline: none;
  cursor: pointer;
  margin: 0 0 2px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

#rwOverlay .rw-radio-item input[type="radio"]:checked {
  background-color: var(--purple, #71007f);
  border-color: var(--purple, #71007f);
}

#rwOverlay .rw-radio-item input[type="radio"]:checked::after {
  content: '';
  width: 4px;
  height: 7px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
  display: block;
}

#rwOverlay .rw-radio-item span {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink, #171526);
}

#rwOverlay .rw-radio-item:has(input[type="radio"]:checked) span {
  color: var(--purple, #71007f);
}

/* Connected Compact Phone Field (Merged Dropdown) */
#rwOverlay .rw-phone-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 8px;
  background-color: #ffffff;
  overflow: hidden;
  height: 34px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#rwOverlay .rw-phone-row:focus-within {
  border-color: var(--purple, #71007f);
  box-shadow: 0 0 0 2px rgba(113, 0, 127, 0.12);
}

#rwOverlay .rw-phone-row select.rw-cc {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  flex: 0 0 50px;
  height: 100%;
  border: none;
  border-right: 1px solid var(--line, #e2e8f0);
  border-radius: 0;
  background: #f7f6f9;
  padding: 0 2px 0 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink, #171526);
  outline: none;
  cursor: pointer;
  margin: 0;
}

#rwOverlay .rw-phone-row input {
  flex: 1;
  height: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0 8px;
  font-size: 12px;
  outline: none;
  margin: 0;
}

/* Address Checkbox Field */
#rwOverlay .rw-checkbox-field label { 
  display: flex; 
  align-items: center; 
  gap: 6px; 
  font-size: 11.5px; 
  font-weight: 600; 
  color: var(--ink, #171526); 
  cursor: pointer; 
}
#rwOverlay .rw-checkbox-field input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid #c8cbd0;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  background-color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
#rwOverlay .rw-checkbox-field input[type="checkbox"]:checked {
  background-color: var(--purple, #71007f);
  border-color: var(--purple, #71007f);
}
#rwOverlay .rw-checkbox-field input[type="checkbox"]:checked::after {
  content: '';
  width: 3.5px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Competition Pick Boxes (Step 1) */
.rw-pick {
  border: 1px solid var(--line, #e2e8f0); 
  border-radius: 10px; 
  padding: 10px 12px;
  margin-bottom: 6px; 
  cursor: pointer; 
  display: block;
}
.rw-pick.selected { border-color: var(--purple, #71007f); background: rgba(113,0,127,0.06); }
.rw-pick .rw-pick-name { font-weight: 700; color: var(--ink, #171526); font-size: 0.85rem; }
.rw-pick .rw-pick-desc { font-size: 0.75rem; color: var(--muted, #8b87a6); margin-top: 1px; }

/* Step Navigation Display */
.rw-step { display: none; }
.rw-step.active { display: block; }
.rw-step p.rw-hint { font-size: 0.78rem; color: var(--muted, #8b87a6); margin: 0 0 8px; }

/* Footer Actions */
.rw-footer {
  display: flex; 
  justify-content: space-between; 
  gap: 8px;
  padding: 12px 20px; 
  border-top: 1px solid var(--line, #e2e8f0);
  position: sticky; 
  bottom: 0; 
  background: var(--paper, #fffdf8);
}

/* Step 4 Review & Messages */
.rw-review { background: var(--paper-2, #f7f3ff); border-radius: 10px; padding: 12px; font-size: 0.82rem; }
.rw-review-row { display: grid; grid-template-columns: 120px 1fr; gap: 6px; padding: 4px 0; }
.rw-review-row strong { color: var(--ink, #171526); }

.rw-msg { margin-top: 10px; font-size: 0.82rem; border-radius: 8px; padding: 8px 10px; }
.rw-msg.rw-ok { background: #E6F8F1; color: #178A5C; }
.rw-msg.rw-err { background: #FBE6E4; color: #B23A2E; }

.rw-loading { color: var(--muted, #8b87a6); font-size: 0.82rem; padding: 6px 0; }

/* Disclaimer Modal Box */
.rw-disclaimer-box {
  background: var(--paper, #fffdf8); 
  border-radius: var(--radius-lg, 24px);
  width: 100%; 
  max-width: 460px; 
  max-height: 90vh; 
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(23, 21, 38, 0.3);
}
.rw-disclaimer-list { margin: 0; padding-left: 16px; font-size: 12px; color: var(--muted, #8b87a6); line-height: 1.5; }
.rw-disclaimer-list li { margin-bottom: 5px; }

/* Tooltip Error */
.rw-field-error-tip {
  margin-top: 3px; background: #E0473C; color: #fff; font-size: 11px;
  padding: 4px 8px; border-radius: 5px; position: relative;
}
.rw-field-error-tip::before {
  content: ''; position: absolute; top: -5px; left: 12px;
  border: 5px solid transparent; border-bottom-color: #E0473C;
}
.field input.rw-error, .field select.rw-error, .rw-pick.rw-error, .rw-phone-row.rw-error { border-color: #E0473C !important; }

/* Mobile Responsiveness */
@media (max-width: 700px) {
  .rw-box { grid-template-columns: 1fr; max-width: 460px; }
  .rw-visual { display: none; }
  #rwOverlay .rw-combined-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .rw-steps .rw-dot span { display: none; }
}

.rw-header h3 { font-size: 1.3rem; }
.rw-steps .rw-dot { font-size: 0.82rem; }
.rw-steps .rw-dot .rw-num { width: 24px; height: 24px; font-size: 0.8rem; }
.rw-body { padding: 16px 24px; }
.rw-step p.rw-hint { font-size: 0.95rem; margin: 0 0 12px; }

#rwOverlay .form-grid { gap: 12px 16px; align-items: end; }
#rwOverlay .field label { font-size: 13.5px; margin: 0 0 5px 1px; }
#rwOverlay .field input[type="text"],
#rwOverlay .field input[type="email"],
#rwOverlay .field input[type="date"],
#rwOverlay .field select { font-size: 14.5px; height: 40px; padding: 6px 10px; }
#rwOverlay .field textarea { font-size: 14.5px; min-height: 60px; padding: 8px 10px; }

#rwOverlay .rw-phone-row { height: 40px; }
#rwOverlay .rw-phone-row select.rw-cc { width: 54px; min-width: 54px; max-width: 54px; flex: 0 0 54px; font-size: 13px; padding: 0 0 0 6px; }
#rwOverlay .rw-phone-row input { font-size: 14.5px; padding: 0 10px; }

/* Type of Participant: two small radio buttons on one line */
#rwOverlay .rw-radio-row { display: flex; align-items: center; gap: 18px; height: 40px; }
#rwOverlay .field label.rw-radio-pill {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  font-size: 14.5px; font-weight: 600; line-height: 1; cursor: pointer;
}
#rwOverlay .field .rw-radio-pill input[type="radio"] {
  width: 17px; height: 17px; min-width: 17px; padding: 0; margin: 0;
  border: none; box-shadow: none; accent-color: var(--purple, #71007f);
}

#rwOverlay .rw-checkbox-field label { font-size: 14px; }
.rw-pick .rw-pick-name { font-size: 1rem; }
.rw-pick .rw-pick-desc { font-size: 0.88rem; }
.rw-review { font-size: 0.95rem; }
.rw-review-row { grid-template-columns: 140px 1fr; }
.rw-msg { font-size: 0.95rem; }
.rw-disclaimer-list { font-size: 14px; }
.rw-field-error-tip { font-size: 12.5px; }

/* =========================================================
   Payment popup (opens when "Pay Now" is pressed on the last step)
   ========================================================= */
.rw-pay-overlay { z-index: 2100; font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; color: #171526; }
.rw-pay-box {
  background: var(--paper, #fffdf8); border-radius: 20px; width: 100%; max-width: 440px;
  max-height: 92vh; overflow-y: auto; padding: 22px 24px 20px;
  box-shadow: 0 30px 80px rgba(23, 21, 38, 0.3);
}
.rw-pay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rw-pay-head h3 { margin: 0; font-size: 1.15rem; }
.rw-pay-head .rw-close { position: static; }
.rw-pay-amount { margin: 0 0 10px; font-weight: 700; font-size: 0.95rem; color: #71007f; }
.rw-pay-qr { text-align: center; margin: 10px 0; }
.rw-pay-qr img { width: 190px; height: 190px; object-fit: contain; background: #fff; border: 1px solid rgba(23, 21, 38, 0.12); border-radius: 12px; padding: 8px; }
.rw-pay-note { margin: 4px 0; font-size: 0.85rem; text-align: center; }
.rw-pay-muted { color: var(--muted, #8b87a6); font-size: 0.78rem; }
.rw-pay-field { margin-top: 14px; }
.rw-pay-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; }
.rw-pay-field input[type="text"] { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid rgba(23, 21, 38, 0.18); border-radius: 10px; font: inherit; }
.rw-pay-field input[type="file"] { width: 100%; font: inherit; font-size: 0.85rem; }
.rw-pay-field input.rw-error { border-color: #E0473C !important; }
.rw-pay-hint { margin: 4px 0 0; font-size: 0.75rem; color: var(--muted, #8b87a6); }
.rw-pay-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }


/* =====================================================================
   RESPONSIVE LAYER for the registration popups (public site AND admin)
   ===================================================================== */
/* Sizes use dvh so phone browser bars never hide the buttons; vh stays as the fallback. */
.rw-overlay { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.rw-box { max-height: 92vh; max-height: 92dvh; min-height: min(65vh, 640px); min-height: min(65dvh, 640px); }
.rw-panel { max-height: 92vh; max-height: 92dvh; min-height: 0; justify-content: flex-start; }
.rw-panel > .rw-body { flex: 1 1 auto; }
.rw-disclaimer-box, .rw-pay-box { max-height: 92vh; max-height: 92dvh; }
.rw-body input, .rw-body select, .rw-body textarea, .rw-pay-field input { max-width: 100%; }
.rw-review-row > * { min-width: 0; overflow-wrap: anywhere; }

/* Tablets */
@media (max-width: 900px) {
  .rw-box { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
  .rw-visual { padding: 24px 18px; }
  .rw-visual h2 { font-size: 18px; }
}

/* Phones & small tablets: single column, popup becomes a near full-screen sheet */
@media (max-width: 700px) {
  .rw-overlay { padding: 0; align-items: flex-end; }
  .rw-box, .rw-disclaimer-box, .rw-pay-box {
    max-width: 100%; width: 100%; border-radius: 20px 20px 0 0;
  }
  .rw-box { display: flex; flex-direction: column; min-height: 0; height: 94vh; height: 94dvh; max-height: 94dvh; }
  .rw-panel { flex: 1 1 auto; max-height: none; height: 100%; min-height: 0; }
  .rw-body { padding: 14px 16px; }
  .rw-header { padding: 12px 16px; }
  .rw-steps { padding: 10px 16px 0; }
  .rw-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .rw-footer .button { flex: 1 1 0; min-width: 0; }
  #rwOverlay .form-grid { grid-template-columns: 1fr; gap: 12px; }
  #rwOverlay .field.full, #rwOverlay .rw-combined-row { grid-column: auto; }
  #rwOverlay .rw-combined-row { grid-template-columns: 1fr; }
  .rw-review-row { grid-template-columns: 1fr; gap: 0; padding: 6px 0; }
  .rw-review-row strong { font-size: .8rem; color: var(--muted, #8b87a6); }
  .rw-pay-box { padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); }
  .rw-pay-actions { flex-direction: column-reverse; }
  .rw-pay-actions .button { width: 100%; }
  .rw-disclaimer-box { max-height: 88vh; max-height: 88dvh; }
}
/* 16px inputs stop iPhones from zooming the page when a field is tapped */
@media (max-width: 700px) {
  #rwOverlay .field input[type="text"], #rwOverlay .field input[type="email"], #rwOverlay .field input[type="date"],
  #rwOverlay .field select, #rwOverlay .field textarea, #rwOverlay .rw-phone-row input,
  .rw-pay-field input[type="text"] { font-size: 16px; }
  #rwOverlay .field input[type="text"], #rwOverlay .field input[type="email"], #rwOverlay .field input[type="date"],
  #rwOverlay .field select { height: 44px; }
  #rwOverlay .rw-phone-row { height: 44px; }
  #rwOverlay .rw-phone-row select.rw-cc { font-size: 14px; width: 64px; min-width: 64px; max-width: 64px; flex-basis: 64px; }
}
@media (max-width: 380px) {
  .rw-header h3 { font-size: 1.05rem; }
  .rw-steps { gap: 3px; }
  .rw-body { padding: 12px; }
}
/* Short landscape phones: the sheet uses the full height and scrolls inside */
@media (max-height: 520px) and (orientation: landscape) {
  .rw-overlay { align-items: stretch; }
  .rw-box { height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .rw-visual { display: none; }
  .rw-box { grid-template-columns: 1fr; }
}

/* The form wraps the body and the footer: let it fill the panel so the buttons sit at the bottom */
.rw-panel > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.rw-panel > form .rw-body { flex: 1 1 auto; }
.rw-panel > form .rw-footer { margin-top: auto; flex-shrink: 0; }
.rw-header, .rw-steps { flex-shrink: 0; }


/* ---- Disclaimer popup: larger, darker text for easier reading ---- */
.rw-disclaimer-box { max-width: 540px; }
.rw-disclaimer-box .rw-body { padding: 18px 24px; }
.rw-disclaimer-list { font-size: 16px; line-height: 1.65; color: #1e1a33; padding-left: 22px; font-weight: 500; }
.rw-disclaimer-list li { margin-bottom: 11px; padding-left: 4px; }
.rw-disclaimer-list li::marker { color: var(--purple, #71007f); font-weight: 700; }
@media (max-width: 700px) {
  .rw-disclaimer-box .rw-body { padding: 16px 18px; }
  .rw-disclaimer-list { font-size: 15.5px; }
}
