/**
 * Matchmaking Application Form — Apple-inspired UI
 * Polished, minimal, high-contrast. No functionality changes.
 */

/* —— Hide main nav for focused form (body.hide-nav) —— */
body.hide-nav header,
body.hide-nav .main-nav,
body.hide-nav nav:not(.matchmaking-breadcrumb) {
  display: none !important;
}

/* —— Page & container —— */
.matchmaking-form {
  background: #f5f5f7;
  min-height: 100vh;
}

/* —— Breadcrumb —— */
.matchmaking-form .matchmaking-breadcrumb a {
  color: #515154;
  font-weight: 500;
  transition: color 0.2s;
}
.matchmaking-form .matchmaking-breadcrumb a:hover {
  color: #1d1d1f;
}
.matchmaking-form .matchmaking-breadcrumb .text-gray-400 { color: #86868b; }
.matchmaking-form .matchmaking-breadcrumb .text-gray-900 { color: #1d1d1f; }

/* —— No-login badge —— */
.matchmaking-form .no-login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 20px;
  color: #1d1d1f;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* —— Form controls (inputs, selects, textareas) —— */
.matchmaking-form .form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 400;
  color: #1d1d1f;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.matchmaking-form .form-control::placeholder {
  color: #86868b;
}

.matchmaking-form .form-control:hover {
  border-color: #b8b8bd;
}

.matchmaking-form .form-control:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.matchmaking-form .form-control:disabled,
.matchmaking-form .form-control[readonly] {
  background: #f5f5f7;
  color: #86868b;
  cursor: not-allowed;
  border-color: #e8e8ed;
}

/* Select arrow (custom-styled) */
.matchmaking-form select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2368686e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* —— Form check (radios, checkboxes) —— */
.matchmaking-form .form-check-input {
  margin-top: 0;
  width: 18px;
  height: 18px;
  accent-color: #0071e3;
}

/* —— Cards —— */
.matchmaking-form .glass-form-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 24px;
  position: relative;
}

.matchmaking-form .mma-header-card {
  padding: 10px 14px;
}

.matchmaking-form .mma-header-card .no-login-badge {
  padding: 4px 10px;
  font-size: 11px;
}

/* —— Participation mode (segmented control) —— */
.matchmaking-form .participation-mode-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
  white-space: nowrap;
}

.matchmaking-form .participation-mode-label,
.matchmaking-form label:has(.participation-mode-radio) {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid #e8e8ed;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  background: #fff;
}

.matchmaking-form label:has(.participation-mode-radio):hover {
  background: #f5f5f7;
  border-color: #d2d2d7;
}

.matchmaking-form .participation-mode-radio:checked + span,
.matchmaking-form label:has(.participation-mode-radio:checked) {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #fff;
}

.matchmaking-form label:has(.participation-mode-radio:checked) .text-gray-700,
.matchmaking-form label:has(.participation-mode-radio:checked) span {
  color: #fff !important;
}

/* 方式 section: more compact on mobile */
@media (max-width: 639px) {
  .matchmaking-form .mma-mode-section {
    padding: 10px 12px;
  }
  .matchmaking-form .mma-mode-section h2 {
    font-size: 0.9375rem;
    margin-bottom: 6px;
  }
  .matchmaking-form .mma-mode-grid {
    gap: 6px;
  }
  .matchmaking-form .mma-mode-section label:has(.participation-mode-radio) {
    padding: 6px 8px;
    font-size: 12px;
  }
  .matchmaking-form .mma-mode-section label:has(.participation-mode-radio) span {
    font-size: 0.6875rem;
  }
}

/* —— Section headers —— */
.matchmaking-form .section-header {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 1rem;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8e8ed;
  letter-spacing: -0.02em;
}

.matchmaking-form .subsection-header {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

/* —— Labels —— */
.matchmaking-form .field-label,
.matchmaking-form label:not([class*="participation"]) {
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 6px;
  display: block;
  letter-spacing: -0.01em;
}

.matchmaking-form .field-label .required {
  color: #ff3b30;
}

/* —— Error / warning messages —— */
.matchmaking-form .error-message {
  margin-top: 6px;
  font-size: 13px;
  color: #ff3b30;
}

.matchmaking-form .warning-message {
  margin-top: 8px;
  font-size: 13px;
  color: #ff3b30;
  padding: 10px 12px;
  background: #fff5f5;
  border-radius: 8px;
  border-left: 3px solid #ff3b30;
}

/* —— Submit button —— */
.matchmaking-form .submit-button,
.matchmaking-form .glass-btn-primary {
  background: #0071e3;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  padding: 14px 32px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: -0.01em;
}

.matchmaking-form .submit-button:hover:not(:disabled),
.matchmaking-form .glass-btn-primary:hover:not(:disabled) {
  background: #0077ed;
  transform: translateY(-1px);
}

.matchmaking-form .submit-button:disabled,
.matchmaking-form .glass-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* —— Checkbox / radio groups —— */
.matchmaking-form .checkbox-group,
.matchmaking-form .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.matchmaking-form .checkbox-item,
.matchmaking-form .radio-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
  color: #1d1d1f;
}

.matchmaking-form .checkbox-item input,
.matchmaking-form .radio-item input {
  margin-right: 8px;
}

/* —— Range inputs (age, height) —— */
.matchmaking-form .range-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.matchmaking-form .range-inputs .form-control {
  flex: 1;
}

.matchmaking-form .range-separator {
  color: #86868b;
  font-weight: 500;
  font-size: 15px;
}

/* —— Section backgrounds (semantic, subtle) —— */
.matchmaking-form .section-bg-private {
  background: #1d1d1f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  color: #f5f5f7;
}

.matchmaking-form .section-bg-private label,
.matchmaking-form .section-bg-private .text-gray-700,
.matchmaking-form .section-bg-private .text-gray-800,
.matchmaking-form .section-bg-private .text-gray-600,
.matchmaking-form .section-bg-private .text-gray-500 {
  color: #f5f5f7 !important;
}

.matchmaking-form .section-bg-private .form-control {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.matchmaking-form .section-bg-private .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.matchmaking-form .section-bg-private .form-control:focus {
  border-color: rgba(0, 113, 227, 0.8);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25);
}

.matchmaking-form .section-bg-public {
  background: rgba(245, 245, 247, 0.9);
  border: 1px solid #e8e8ed;
  border-radius: 12px;
  padding: 20px;
}

.matchmaking-form .section-bg-required {
  background: #fff;
  border: 1px solid #e8e8ed;
  border-radius: 12px;
}

/* —— Fade-in —— */
.glass-fade-in {
  animation: mmaFadeIn 0.4s ease-out;
}

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

/* —— Error summary (form-errors-summary) —— */
.matchmaking-form #form-errors-summary {
  border: 1px solid rgba(255, 59, 48, 0.3);
  border-radius: 12px;
  background: #fff5f5;
}

/* —— Error highlight animation (for JS) —— */
@keyframes errorHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    transform: scale(1);
  }
}

/* —— Loading —— */
.matchmaking-form .loading {
  opacity: 0.6;
  pointer-events: none;
}

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

/* —— Responsive —— */
@media (max-width: 768px) {
  .matchmaking-form .glass-form-card {
    padding: 18px;
    border-radius: 12px;
  }

  .matchmaking-form .section-header {
    font-size: 1.125rem;
  }

  .matchmaking-form .form-control {
    padding: 10px 12px;
    font-size: 16px; /* avoid iOS zoom on focus */
  }

  .matchmaking-form .checkbox-group,
  .matchmaking-form .radio-group {
    flex-direction: column;
    gap: 10px;
  }
}
