/* ============================================================
   Form
   ============================================================ */
.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* -- Field -- */
.form__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* -- Input -- */
.form__input {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  color: #2c3e50;
  background: #ffffff;
  border: 1px solid #c8d4dc;
  border-radius: 0px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.form__input::placeholder { 
  color: #8fa0b0; 
}
.form__input:focus {
  border-color: #2e8b9a;
  box-shadow: 0 0 0 3px rgba(46,139,154,0.14);
  background: #ffffff;
}

/* invalid state */
.form__field--invalid .form__input {
  border-color: #e05252;
  background: #fdf0f0;
}
.form__field--invalid .form__input:focus {
  box-shadow: 0 0 0 3px rgba(224,82,82,0.13);
}

/* valid state */
.form__field--valid .form__input {
  border-color: #4caf82;
}

/* -- Error message -- */
.form__error {
  font-size: 11.5px;
  color: #e05252;
  min-height: 0;
  display: block;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}
.form__field--invalid .form__error {
  max-height: 40px;
  opacity: 1;
}

/* ============================================================
   Phone input
   ============================================================ */
.form__field--phone .phone-input {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #c8d4dc;
  border-radius: 0px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form__field--phone:focus-within .phone-input {
  border-color: #2e8b9a;
  box-shadow: 0 0 0 3px rgba(46,139,154,0.14);
}

.form__field--phone.form__field--invalid .phone-input {
  border-color: #e05252;
  background: #fdf0f0;
}
.form__field--phone.form__field--invalid:focus-within .phone-input {
  box-shadow: 0 0 0 3px rgba(224,82,82,0.13);
}
.form__field--phone.form__field--valid .phone-input {
  border-color: #4caf82;
}

.phone-input__flag {
  display: flex;
  align-items: center;
  padding: 0 8px 0 10px;
  flex-shrink: 0;
}

.phone-input__flag-icon {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  display: block;
}

.phone-input__code {
  font-size: 13.5px;
  font-weight: 500;
  color: #2c3e50;
  white-space: nowrap;
  padding-right: 2px;
  flex-shrink: 0;
}

.phone-input__divider {
  width: 1px;
  height: 20px;
  background: #c8d4dc;
  margin: 0 8px;
  flex-shrink: 0;
}

.phone-input__field {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding-left: 0;
  flex: 1;
}
.phone-input__field:focus {
  box-shadow: none !important;
  border: none !important;
}

/* ============================================================
   Checkbox
   ============================================================ */
.form__field--checkbox {
  margin-top: 4px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.checkbox__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox__box {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid #c8d4dc;
  border-radius: 3px;
  background: #ffffff;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.checkbox__box::after {
  content: '';
    display: block;
    width: 10px;
    height: 20px;
    border: 2px solid #ffffff;
    border-top: none;
    border-left: none;
    transform: rotate(50deg) translateY(-8px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.checkbox__input:checked ~ .checkbox__box {
  background: #2e8b9a;
  border-color: #2e8b9a;
}
.checkbox__input:checked ~ .checkbox__box::after { 
  opacity: 1; 
}

.checkbox:hover .checkbox__box {
  border-color: #2e8b9a;
  box-shadow: 0 0 0 3px rgba(46,139,154,0.12);
}

.form__field--invalid .checkbox__box {
  border-color: #e05252;
}

.checkbox__label {
  font-size: 12px;
  color: #8fa0b0;
  line-height: 1.5;
}

.checkbox__link {
  color: #2e8b9a;
  text-decoration: none;
  border-bottom: 1px dashed rgba(46,139,154,0.4);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.checkbox__link:hover {
  color: #236d7a;
  border-color: #236d7a;
}

.form__field--error .checkbox__box {
    border-color: #e74c3c;
}

/* ============================================================
   Form footer & Button
   ============================================================ */
.form__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.btn {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 0px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: #2e8b9a;
  color: #ffffff;
  padding: 11px 36px;
  box-shadow: 0 4px 14px rgba(46,139,154,0.3);
}
.btn--primary:hover {
  background: #236d7a;
  box-shadow: 0 6px 18px rgba(46,139,154,0.4);
  transform: translateY(-1px);
}
.btn--primary:active { 
  transform: translateY(0); 
}
.btn--primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* loading state */
.btn--loading .btn__text { 
  opacity: 0; 
}
.btn--loading .btn__loader { 
  opacity: 1; 
}

.btn__loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.btn__loader::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ============================================================
   Success message
   ============================================================ */
.form__success {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 8px;
  gap: 14px;
  text-align: center;
}

.form__success--visible { 
  display: flex; 
}

.form__success-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(46,139,154,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.form__success-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
}

.form__success-sub {
  font-size: 13px;
  color: #8fa0b0;
  line-height: 1.5;
}
