/* ==========================================
   Modals 컴포넌트 스타일
   MAIC-Flask CSS 모듈화 Phase 2
   ========================================== */

/* 모달 오버레이 */
.modal {
  display: none;
  position: fixed;
  z-index: var(--z-modal, 1000);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(0 0 0 / 50%);
  backdrop-filter: blur(5px);
  animation: modal-fade-in var(--transition-normal, 0.3s ease);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 모달 컨텐츠 */
.modal-content {
  background: var(--bg-card, rgb(44 47 72 / 95%));
  backdrop-filter: blur(20px);
  margin: 15% auto;
  padding: var(--spacing-lg, 2rem);
  border-radius: var(--border-radius, 20px);
  width: 90%;
  max-width: 500px;
  box-shadow:
    var(--shadow-light, 8px 8px 16px rgb(0 0 0 / 30%)),
    var(--shadow-dark, -8px -8px 16px rgb(255 255 255 / 10%));
  border: 1px solid var(--border-light, rgb(255 255 255 / 10%));
  animation: modal-slide-in var(--transition-normal, 0.3s ease);
  position: relative;
}

/* 모달 제목 */
.modal-title {
  font-size: var(--font-size-xl, 1.5rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary, #e0e0e0);
  margin-bottom: var(--spacing-lg, 2rem);
  text-align: center;
  text-shadow: var(--text-shadow-light, 0 2px 4px rgb(0 0 0 / 30%));
}

/* 모달 입력 필드 */
.modal-input {
  width: 100%;
  padding: var(--spacing-sm, 1rem);
  border: 2px solid var(--border-light, rgb(255 255 255 / 10%));
  border-radius: var(--border-radius-input, 15px);
  background: var(--bg-input, rgb(255 255 255 / 5%));
  color: var(--text-primary, #e0e0e0);
  font-size: var(--font-size-base, 1rem);
  font-family: var(--font-family, "Poppins", sans-serif);
  margin-bottom: var(--spacing-lg, 2rem);
  transition: all var(--transition-normal, 0.3s ease);
  backdrop-filter: blur(10px);
}

.modal-input:focus {
  outline: none;
  border-color: var(--border-focus, var(--primary-color, #8b9cf7));
  box-shadow: 0 0 20px rgb(139 156 247 / 20%);
  background: var(--bg-input, rgb(255 255 255 / 8%));
}

.modal-input::placeholder {
  color: var(--text-muted, #b0b0b0);
  opacity: 70%;
}

/* select 드롭다운 option 배경색 (브랜드색 적용) */
.modal-input option {
  background: var(--bg-primary, #3a3d5c);
  color: var(--text-primary, #e0e0e0);
  padding: 8px 12px;
}

.modal-input option:hover,
.modal-input option:focus,
.modal-input option:checked {
  background: var(--bg-secondary, #4a4d6c);
  color: #ffffff;
}

/* 모달 버튼 컨테이너 */
.modal-buttons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm, 1rem);
  margin-top: var(--spacing-lg, 2rem);
}

/* 모달 닫기 버튼 */
.modal-close {
  position: absolute;
  top: var(--spacing-sm, 1rem);
  right: var(--spacing-sm, 1rem);
  background: none;
  border: none;
  color: var(--text-muted, #b0b0b0);
  font-size: var(--font-size-xl, 1.5rem);
  cursor: pointer;
  transition: color var(--transition-fast, 0.2s ease);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--text-primary, #e0e0e0);
  background: rgb(255 255 255 / 10%);
}

/* 모달 애니메이션 */
@keyframes modal-fade-in {
  from {
    opacity: 0%;
  }

  to {
    opacity: 100%;
  }
}

@keyframes modal-slide-in {
  from {
    opacity: 0%;
    transform: translateY(-50px) scale(0.9);
  }

  to {
    opacity: 100%;
    transform: translateY(0) scale(1);
  }
}

/* 모달 크기 변형 */
.modal-content.small {
  max-width: 400px;
}

.modal-content.medium {
  max-width: 600px;
}

.modal-content.large {
  max-width: 800px;
}

.modal-content.fullscreen {
  width: 95%;
  height: 90%;
  max-width: none;
  margin: 2.5% auto;
}

/* 모달 헤더 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg, 2rem);
  padding-bottom: var(--spacing-sm, 1rem);
  border-bottom: 1px solid var(--border-light, rgb(255 255 255 / 10%));
}

.modal-header .modal-title {
  margin-bottom: 0;
}

/* 모달 바디 */
.modal-body {
  margin-bottom: var(--spacing-lg, 2rem);
  color: var(--text-secondary, #c1c3e0);
  line-height: 1.6;
}

/* 모달 푸터 */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm, 1rem);
  padding-top: var(--spacing-sm, 1rem);
  border-top: 1px solid var(--border-light, rgb(255 255 255 / 10%));
}

/* 모달 알림 타입 */
.modal-content.info {
  border-left: 1.5px solid var(--primary-color, #8b9cf7);
}

.modal-content.success {
  border-left: 1.5px solid #4caf50;
}

.modal-content.warning {
  border-left: 1.5px solid #ff9800;
}

.modal-content.error {
  border-left: 1.5px solid #f44336;
}

/* 반응형 모달 */
@media (width <=768px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: var(--spacing-md, 1.5rem);
  }

  .modal-title {
    font-size: var(--font-size-lg, 1.2rem);
    margin-bottom: var(--spacing-md, 1.5rem);
  }

  .modal-input {
    padding: var(--spacing-sm, 0.8rem);
    font-size: var(--font-size-sm, 0.9rem);
    margin-bottom: var(--spacing-md, 1.5rem);
  }

  .modal-buttons {
    flex-direction: column;
    gap: var(--spacing-sm, 1rem);
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-content.fullscreen {
    width: 98%;
    height: 95%;
    margin: 1% auto;
    padding: var(--spacing-sm, 1rem);
  }
}

@media (width <=480px) {
  .modal-content {
    width: 98%;
    margin: 5% auto;
    padding: var(--spacing-sm, 1rem);
  }

  .modal-title {
    font-size: var(--font-size-base, 1rem);
  }

  .modal-input {
    padding: var(--spacing-sm, 0.7rem);
    font-size: var(--font-size-sm, 0.85rem);
  }
}