/* ==========================================================================
   Guild Signup Form — Figma-matched (RTL, Heebo)
   Figma frame: הרשמה המשך (699:4479) — 978×3571
   ========================================================================== */

:root{
  --gs-bg: #ffffff;
  --gs-surface: #ffffff;
  --gs-text: #2e404a;
  --gs-muted: #6b7280;
  --gs-border: #2e404a;
  --gs-border-focus: #f9c466;
  --gs-focus: rgba(249,196,102,.2);
  --gs-accent: #f9c466;
  --gs-accent-text: #003944;
  --gs-link: #1d4ed8;
  --gs-danger: #dc2626;

  --gs-radius: 10px;
  --gs-field-h: 60px;
  --gs-container-w: 600px;
  --gs-label-size: 24px;
  --gs-label-weight: 400;
  --gs-label-ls: -0.019em;
  --gs-label-lh: 120%;
}

/* ── Screen wrapper ── */
.guild-signup-container{
  direction: rtl;
  background: var(--gs-bg);
  color: var(--gs-text);
  font-family: "Heebo","Rubik","Assistant",system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
  padding: 0;
}

/* ── Centered column ── */
.guild-signup-form-single{
  max-width: var(--gs-container-w);
  margin: 0 auto;
}

/* ── Sections: 42px gap between them (Figma gap) ── */
.guild-signup-form-single .form-section{
  margin: 0 0 42px;
  padding: 0;
  border: 0;
  background: transparent;
}

.guild-signup-form-single .form-section:last-of-type{
  margin-bottom: 0;
}

/* Section headings: hidden visually but kept for accessibility */
.guild-signup-form-single .form-section > h3{
  font-size: var(--gs-label-size);
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--gs-text);
}

.guild-signup-form-single .form-section > h3.visually-hidden{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Section description */
.guild-signup-form-single .section-description{
  margin: -4px 0 16px;
  font-size: 18px;
  color: var(--gs-text);
  line-height: 1.4;
}

/* ── Field blocks: 16px gap (Figma gap within sections) ── */
.guild-signup-form-single .form-group{
  margin: 0 0 16px;
}

/* ── Labels — Figma: Heebo 24px / 400wt / -0.019em / #2e404a ── */
.guild-signup-form-single label{
  display: block;
  text-align: right;
  font-size: var(--gs-label-size);
  font-weight: var(--gs-label-weight);
  letter-spacing: var(--gs-label-ls);
  line-height: var(--gs-label-lh);
  margin-bottom: 10px;
  color: var(--gs-text);
}

.guild-signup-form-single .required{
  color: var(--gs-text);
  font-weight: 700;
}

/* ── Inputs — Figma: 600×60, border 1px #2e404a, radius 10 ── */
.guild-signup-form-single input[type="text"],
.guild-signup-form-single input[type="email"],
.guild-signup-form-single input[type="password"],
.guild-signup-form-single input[type="url"],
.guild-signup-form-single input[type="number"],
.guild-signup-form-single input[type="date"],
.guild-signup-form-single select,
.guild-signup-form-single textarea{
  width: 100%;
  height: var(--gs-field-h);
  border: 1px solid var(--gs-border);
  border-radius: var(--gs-radius);
  background: var(--gs-surface);
  color: var(--gs-text);
  font-family: inherit;
  font-size: 18px;
  padding: 14px 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.guild-signup-form-single textarea{
  height: auto;
  min-height: 100px;
}

/* Placeholder */
.guild-signup-form-single input::placeholder,
.guild-signup-form-single textarea::placeholder{
  color: var(--gs-muted);
}

/* Focus — golden ring matching Figma accent */
.guild-signup-form-single input:focus,
.guild-signup-form-single input[type="date"]:focus,
.guild-signup-form-single select:focus,
.guild-signup-form-single textarea:focus{
  border-color: var(--gs-border-focus);
  box-shadow: 0 0 0 3px var(--gs-focus);
}

/* Helper text */
.guild-signup-form-single small{
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--gs-muted);
  line-height: 1.4;
}

/* Error message */
.guild-signup-form-single .error-message{
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--gs-danger);
  min-height: 0;
}

.guild-signup-form-single .error-message:empty{
  display: none;
}

/* Field description + notes (documents section) */
.guild-signup-form-single .field-description{
  font-size: 18px;
  font-weight: 700;
  color: var(--gs-text);
  margin: 0 0 8px;
  line-height: 1.4;
}

.guild-signup-form-single .field-notes{
  margin: 0 0 8px;
  padding-right: 20px;
  font-size: 16px;
  color: var(--gs-text);
  line-height: 1.6;
}

.guild-signup-form-single .field-notes li{
  margin-bottom: 4px;
}

/* ── Mobile phone: 3-part row ── */
.mobile-phone-fields{
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr; /* numbers read LTR */
}

.mobile-phone-fields input[type="text"]{
  text-align: center;
  min-width: 0;
}

/* Part 2 (3 digits) and Part 3 (4 digits) — proportional widths */
.mobile-phone-fields #mobile_phone_part_2{
  flex: 3;
}
.mobile-phone-fields #mobile_phone_part_3{
  flex: 4;
}

/* Prefix dropdown — fixed comfortable width */
.mobile-phone-fields select{
  flex: 0 0 110px;
  width: 110px;
  text-align: center;
  text-align-last: center;
  padding: 14px 8px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  background-size: 10px 6px;
  padding-left: 26px;
}

.mobile-phone-fields .phone-separator{
  flex: 0 0 auto;
  font-size: 20px;
  color: var(--gs-muted);
  user-select: none;
}

/* ── Date input — match other inputs ── */
.guild-signup-form-single input[type="date"]{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  direction: ltr;
  text-align: right;
  padding-left: 50px;  /* room for the icon on the left */
  padding-right: 16px;
  position: relative;
}

/* Calendar icon — positioned on the left, expanded to cover the full input height */
.guild-signup-form-single input[type="date"]::-webkit-calendar-picker-indicator{
  cursor: pointer;
  opacity: .55;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  /* Show the icon on the left via background positioning */
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232e404a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat left 14px center;
  background-size: 20px 20px;
}

/* Date text alignment */
.guild-signup-form-single input[type="date"]::-webkit-date-and-time-value{
  text-align: right;
}

/* ── Custom dropdown ── */
.custom-dropdown{
  position: relative;
  width: 100%;
}

.dropdown-toggle{
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--gs-field-h);
  padding: 14px 16px;
  background: var(--gs-surface);
  border: 1px solid var(--gs-border);
  border-radius: var(--gs-radius);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}

.dropdown-toggle:hover{
  border-color: var(--gs-border-focus);
}

.dropdown-toggle:focus-within{
  border-color: var(--gs-border-focus);
  box-shadow: 0 0 0 3px var(--gs-focus);
}

.dropdown-label{
  flex: 1;
  text-align: right;
  color: var(--gs-text);
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dropdown-arrow{
  font-size: 12px;
  color: var(--gs-muted);
  margin-left: 10px;
  transition: transform .2s ease;
}

.dropdown-arrow.open{
  transform: rotate(180deg);
}

/* Dropdown panel */
.dropdown-content{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--gs-surface);
  border: 1px solid var(--gs-border);
  border-radius: var(--gs-radius);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

/* Items */
.dropdown-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(46,64,74,.15);
  transition: background .12s ease;
}

.dropdown-item:last-child{
  border-bottom: 0;
}

.dropdown-item:hover{
  background: #f3f6fb;
}

.dropdown-item input[type="checkbox"]{
  width: 18px;
  height: 18px;
  margin: 0 0 0 8px;
  accent-color: var(--gs-accent-text);
}

.dropdown-item span:not(.expand-icon){
  flex: 1;
  text-align: right;
  color: var(--gs-text);
  font-size: 16px;
}

/* Hierarchy styling */
.dropdown-content.hierarchical .region-item{
  font-weight: 700;
  background: #fafafa;
}

.region-item .expand-icon{
  color: var(--gs-muted);
  font-size: 12px;
  margin-right: 10px;
  transition: transform .2s ease;
}

.region-item .expand-icon.expanded{
  transform: rotate(180deg);
}

.sub-items{
  background: #fff;
}

.sub-item{
  padding-right: 34px;
  font-weight: 500;
}

/* ── File inputs ── */

.file-input-hidden{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Figma: 600×60, border 1px #2E404A, radius 10, Heebo 400 24px */
.file-upload-btn{
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: var(--gs-field-h);
  padding: 14px 16px;
  border: 1px solid var(--gs-border);
  border-radius: var(--gs-radius);
  background: var(--gs-surface);
  color: var(--gs-text);
  font-family: inherit;
  font-size: var(--gs-label-size);
  font-weight: var(--gs-label-weight);
  line-height: 1.2;
  letter-spacing: var(--gs-label-ls);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  margin-top: 8px;
  box-sizing: border-box;
}

.file-upload-btn:hover{
  background: #f8fbfc;
  border-color: var(--gs-border-focus);
  box-shadow: 0 0 0 3px rgba(249,196,102,.10);
}

.file-upload-btn:focus-within{
  border-color: var(--gs-border-focus);
  box-shadow: 0 0 0 3px var(--gs-focus);
  outline: none;
}

.file-upload-btn .upload-icon{
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.file-upload-btn.has-files{
  border-color: #2e9e6e;
  color: #1a7a52;
}

/* Selected file names */
.file-upload-name{
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--gs-muted);
  line-height: 1.5;
}

.file-upload-name:empty{
  display: none;
}

.file-upload-name .file-item{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.file-upload-name .file-item::before{
  content: "\2713";
  color: #2e9e6e;
  font-weight: 800;
  font-size: 14px;
}

.file-upload-name .file-item-name{
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-upload-name .btn-remove-file{
  background: none;
  border: none;
  color: var(--gs-danger);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .7;
  transition: opacity .15s ease;
}

.file-upload-name .btn-remove-file:hover{
  opacity: 1;
}

/* ── Teaching locations (repeater) ── */

.location-row{
  border: 1px solid var(--gs-border);
  border-radius: var(--gs-radius);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--gs-surface);
}

.location-fields{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.location-fields .form-group{
  margin-bottom: 0;
}

.location-fields label{
  font-size: 16px;
}

.location-fields input[type="text"]{
  height: 48px;
  font-size: 16px;
}

/* ── Consents — Figma: 24px Heebo 400, gap 16px, checkbox 18×18 ── */

.consent-group{
  margin: 0 0 16px;
}

.consent-label{
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: var(--gs-label-size);
  font-weight: var(--gs-label-weight);
  letter-spacing: var(--gs-label-ls);
  line-height: var(--gs-label-lh);
  color: var(--gs-text);
}

.consent-label input[type="checkbox"]{
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 5px;
  accent-color: var(--gs-accent-text);
}

.consent-label a{
  color: var(--gs-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-label a:hover{
  color: var(--gs-accent-text);
}

.privacy-link{
  display: inline-block;
  margin-right: 34px;
  margin-top: 6px;
  color: var(--gs-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 16px;
}

.privacy-link:hover{
  opacity: .85;
}

/* ── Buttons — Figma: 602×57, #f9c466, radius 10, Heebo 700 24px, #003944 ── */

.form-navigation{
  margin-top: 24px;
}

.button-primary,
#submit-form{
  width: 100%;
  height: 57px;
  border: 0;
  border-radius: var(--gs-radius);
  background: var(--gs-accent);
  color: var(--gs-accent-text);
  font-family: inherit;
  font-weight: 700;
  font-size: var(--gs-label-size);
  letter-spacing: var(--gs-label-ls);
  cursor: pointer;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}

.button-primary:hover,
#submit-form:hover{
  background: #f7b84a;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(249,196,102,.4);
}

.button-primary:active,
#submit-form:active{
  transform: translateY(0);
}

/* "Add location" secondary button */
.button-secondary,
#add-location{
  width: 100%;
  height: 52px;
  margin-top: 12px;
  border-radius: var(--gs-radius);
  border: 1px solid var(--gs-border);
  background: var(--gs-surface);
  color: var(--gs-text);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.button-secondary:hover,
#add-location:hover{
  border-color: var(--gs-border-focus);
  box-shadow: 0 0 0 3px rgba(249,196,102,.10);
}

/* Remove location button */
.btn-remove-location{
  border: 1px solid rgba(220,38,38,.35);
  background: rgba(220,38,38,.06);
  color: var(--gs-danger);
  border-radius: var(--gs-radius);
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 10px;
}

.btn-remove-location:hover{
  background: rgba(220,38,38,.10);
}

/* ── Loading overlay ── */

.loading-overlay{
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 2000;
}

.loading-overlay p{
  margin: 0;
  color: var(--gs-text);
  font-weight: 700;
  font-size: 18px;
}

.spinner{
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(46,64,74,.2);
  border-top-color: rgba(46,64,74,.75);
  animation: gs-spin 1s linear infinite;
}

@keyframes gs-spin{
  to{ transform: rotate(360deg); }
}

/* ── Mobile ── */
@media (max-width: 768px){
  .guild-signup-container{
    padding: 0 10px;
  }

  .guild-signup-form-single{
    max-width: 100%;
  }

  .guild-signup-form-single .form-section{
    margin-bottom: 32px;
  }

  .guild-signup-form-single label{
    font-size: 20px;
  }

  .guild-signup-form-single input[type="text"],
  .guild-signup-form-single input[type="email"],
  .guild-signup-form-single input[type="password"],
  .guild-signup-form-single input[type="url"],
  .guild-signup-form-single input[type="number"],
  .guild-signup-form-single input[type="date"],
  .guild-signup-form-single select,
  .guild-signup-form-single textarea{
    height: 55px;
    font-size: 16px;
  }

  .file-upload-btn{
    font-size: 20px;
    height: 55px;
  }

  .location-fields{
    grid-template-columns: 1fr;
  }

  .consent-label{
    font-size: 18px;
  }

  .button-primary,
  #submit-form{
    height: 52px;
    font-size: 20px;
  }

  .section-description{
    font-size: 16px;
  }

  .field-description{
    font-size: 16px;
  }

  .field-notes{
    font-size: 14px;
  }

  .mobile-phone-fields select{
    flex: 0 0 95px;
    width: 95px;
    font-size: 15px;
  }
}
