/* 
 * Form Controls CSS for Innolab Enrolment Form
 * 美化表单控件样式
 */

/* 表单标签样式 */
.form-label {
  position: relative;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  color: var(--gray-80, #333333);
  letter-spacing: 0.01em;
}

.form-label strong {
  color: var(--sunset-orange, #FF9F1C);
  margin-left: 4px;
}

.form-label::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background-color: var(--primary-green, #2a9d8f);
  margin-right: 8px;
  border-radius: 2px;
  opacity: 0.8;
}

/* 可选标签样式 */
.form-label.optional {
  font-weight: 500;
  color: var(--gray-60, #666666);
}

.form-label.optional::before {
  background-color: var(--gray-40, #999999);
  opacity: 0.6;
}

/* 输入框样式增强 */
.form-control {
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background-color: #f9fbfa;
  padding: 10px 15px;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  height: auto;
  line-height: 1.4;
}

.form-control:focus {
  border-color: var(--primary-green, #2a9d8f);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15);
  background-color: white;
}

.form-control:hover:not(:focus) {
  border-color: rgba(42, 157, 143, 0.5);
}

/* 表单分组样式 */
.form-group {
  margin-bottom: 0.8rem;
  position: relative;
}

.form-group.focused .form-label {
  color: var(--primary-green, #2a9d8f);
}

.form-group.has-value .form-label {
  font-weight: 600;
}

/* 单选按钮美化 */
.custom-radio {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 30px;
  transition: all 0.2s ease;
  margin-bottom: 0.3rem;
}

.custom-radio:hover {
  background-color: rgba(42, 157, 143, 0.05);
}

.custom-radio input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-checkmark {
  position: relative;
  height: 18px;
  width: 18px;
  background-color: white;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  margin-right: 8px;
  transition: all 0.2s ease;
}

.custom-radio:hover input ~ .radio-checkmark {
  border-color: var(--primary-green, #2a9d8f);
}

.custom-radio input:checked ~ .radio-checkmark {
  border-color: var(--primary-green, #2a9d8f);
}

.radio-checkmark:after {
  content: "";
  position: absolute;
  display: none;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-green, #2a9d8f);
  transform: translate(-50%, -50%) scale(0);
  transition: all 0.2s ease;
}

.custom-radio input:checked ~ .radio-checkmark:after {
  display: block;
  transform: translate(-50%, -50%) scale(1);
}

/* 复选框美化 */
.custom-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-bottom: 0.3rem;
}

.custom-checkbox:hover {
  background-color: rgba(42, 157, 143, 0.05);
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-checkmark {
  position: relative;
  height: 18px;
  width: 18px;
  background-color: white;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  margin-right: 8px;
  transition: all 0.2s ease;
}

.custom-checkbox:hover input ~ .checkbox-checkmark {
  border-color: var(--primary-green, #2a9d8f);
}

.custom-checkbox input:checked ~ .checkbox-checkmark {
  background-color: var(--primary-green, #2a9d8f);
  border-color: var(--primary-green, #2a9d8f);
}

/* 禁用复选框样式 */
.custom-checkbox input:disabled ~ .checkbox-checkmark {
  opacity: 0.7;
  border-color: var(--primary-green, #2a9d8f);
  background-color: var(--primary-green, #2a9d8f);
}

.custom-checkbox input:disabled ~ .checkbox-checkmark:after {
  opacity: 1;
  display: block;
}

.custom-checkbox input:disabled ~ .radio-checkmark {
  opacity: 0.7;
}

/* 当复选框被禁用且应用了not-allowed样式时 */
.custom-checkbox[style*="cursor: not-allowed"]:hover {
  background-color: transparent;
}

.checkbox-checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 50%;
  top: 45%;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -40%) rotate(45deg);
  transform-origin: center;
}

.custom-checkbox input:checked ~ .checkbox-checkmark:after {
  display: block;
  animation: checkmark-appear 0.2s ease forwards;
}

@keyframes checkmark-appear {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) rotate(45deg) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -40%) rotate(45deg) scale(1);
  }
}

/* 下拉菜单样式 */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232a9d8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
  padding-right: 40px;
  padding: 8px 40px 8px 15px;
}

select.form-control:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232a9d8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E");
}

/* 表单分组改进 */
.form-section {
  border-radius: 12px;
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.6rem;
  border: 1px solid rgba(42, 157, 143, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.form-section:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(42, 157, 143, 0.25);
}

.form-row {
  margin-bottom: 0.9rem;
}

/* 标题样式优化 */
.form-section-title {
  font-weight: 600;
  margin-bottom: 1.2rem;
  color: var(--night-blue, #2b2d42);
  letter-spacing: 0.01em;
}

/* 错误与验证状态 */
.form-control.is-invalid {
  border-color: var(--secondary-red, #FF4438);
  background-color: rgba(255, 68, 56, 0.02);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(255, 68, 56, 0.1);
}

.error-message {
  color: var(--secondary-red, #FF4438);
  font-size: 0.85rem;
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
}

.error-message::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background-color: var(--secondary-red, #FF4438);
  color: white;
  border-radius: 50%;
  margin-right: 6px;
  font-size: 12px;
  font-weight: bold;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    margin-bottom: 0.5rem;
  }
  
  .form-col-6, .form-col-4, .form-col-12 {
    width: 100%;
    padding: 0 10px;
  }
  
  .custom-radio, .custom-checkbox {
    padding: 6px 6px;
  }
  
  .form-section {
    padding: 1.2rem 1.2rem;
  }
}

/* 修改表单复选/单选组的横向排列 */
.form-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 3px;
}

/* 为已有的非自定义控件提供兼容样式 */
input[type="radio"].form-check-input,
input[type="checkbox"].form-check-input {
  margin-right: 8px;
  cursor: pointer;
}

/* 优化性别选项组样式 */
.gender-options {
  display: flex;
  gap: 15px;
}

/* Style for Other text input fields that display inline with radio buttons */
#visa_type_other {
  display: inline-block;
  width: 180px;
  height: 35px;
  padding: 5px 10px;
  margin-left: 5px;
  vertical-align: middle;
  border-radius: 6px;
}

/* Hide the Other text input by default until selected */
#visa_type_other:not(:focus) {
  display: none;
}

#visa_type_other[style*="display: inline-block"] {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 增强表单输入框在宽屏幕上的表现 */
@media (min-width: 1200px) {
  .form-control {
    height: 45px; /* 稍微增加输入框高度，提高可操作性 */
    font-size: 16px; /* 增加字体大小，提高可读性 */
  }
  
  .form-label {
    font-size: 16px; /* 增加标签字体大小 */
    margin-bottom: 8px; /* 增加底部间距 */
  }
  
  /* 增加表单组间距 */
  .form-group {
    margin-bottom: 25px;
  }
  
  /* 确保下拉菜单在大屏幕上有适当的大小 */
  select.form-control {
    padding-right: 30px; /* 为下拉箭头留出足够空间 */
  }
  
  /* 调整复选框和单选按钮的尺寸 */
  .custom-checkbox .checkbox-checkmark,
  .custom-radio .radio-checkmark {
    width: 22px;
    height: 22px;
  }
  
  /* 提高按钮的可用性 */
  .btn {
    padding: 12px 30px;
    font-size: 16px;
  }
} 