/* 모달 오버레이 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

/* 모달 컨테이너 */
.modal-container {
  position: relative;
  width: 95%;
  max-width: 900px;
  height: 95%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 모달 헤더 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background-color: #e5e7eb;
}

.modal-close-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.modal-close-icon {
  width: 20px;
  height: 20px;
  stroke: #6b7280;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 모달 본문 */
.modal-body {
  height: calc(100% - 40px);
  position: relative;
}

/* HubSpot 폼 컨테이너 */
.modal-form-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.modal-form {
  width: 100%;
  height: 100%;
  border: none;
  overflow-y: auto;
  padding: 30px;
}

/* HubSpot 폼 스타일 커스터마이징 */
.modal-form .hs-form {
  font-family: inherit;
}

.modal-form .hs-form-field {
  margin-bottom: 20px;
}

.modal-form .hs-form-field label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
  display: block;
}

.modal-form .hs-form-field input,
.modal-form .hs-form-field select,
.modal-form .hs-form-field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-form .hs-form-field input:focus,
.modal-form .hs-form-field select:focus,
.modal-form .hs-form-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-form .hs-button {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.modal-form .hs-button:hover {
  background-color: #2563eb;
}

.modal-form .hs-error-msgs {
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
}

/* 로딩 스피너 */
.modal-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.modal-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.modal-loading-text {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .modal-container {
    width: 95%;
    height: 95%;
    max-height: none;
    border-radius: 8px;
  }

  .modal-header {
    padding: 8px 12px;
  }

  .modal-title {
    font-size: 16px;
  }

  .modal-close-btn {
    padding: 6px;
  }

  .modal-close-icon {
    width: 18px;
    height: 18px;
  }

  .modal-form {
    padding: 16px;
  }
}

/* 접근성 개선 */
.modal-overlay[aria-hidden='true'] {
  display: none;
}

.modal-overlay[aria-hidden='false'] {
  display: flex;
}

/* 키보드 포커스 관리 */
.modal-container:focus {
  outline: none;
}

/* 스크린 리더용 숨김 텍스트 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
