/**
 * 복구천사 웹 사이트 - 모달 팝업 스타일
 * popup_message.html에서 추출한 공통 스타일
 */

:root {
  /* Color Palette */
  --modal-primary: #3b82f6;
  --modal-primary-dark: #2563eb;
  --modal-primary-soft: #eff6ff;

  --modal-success: #10b981;
  --modal-success-dark: #059669;
  --modal-success-soft: #d1fae5;

  --modal-danger: #ef4444;
  --modal-danger-dark: #dc2626;
  --modal-danger-soft: #fee2e2;

  --modal-text-main: #1f2937;
  --modal-text-sub: #6b7280;
  --modal-border: #e5e7eb;
}

/* 모달 배경 (오버레이) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

/* 모달 컨테이너 */
.modal {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  position: relative;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin: 20px;
}

.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
}

/* 닫기 버튼 */
.modal .btn-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  transition: background 0.2s;
}

.modal .btn-close::before {
  content: "✕";
  font-size: 16px;
  font-weight: bold;
}

.modal .btn-close:hover {
  background: #f3f4f6;
  color: #4b5563;
}

/* 헤더 영역 - .modal 내부에서만 적용 */
.modal > .modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-right: 32px; /* 닫기 버튼 공간 확보 */
}

/* 헤더 텍스트 영역 - .modal 내부에서만 적용 */
.modal > .modal-header > div:not(.modal-icon) {
  flex: 1;
  min-width: 0;
}

/* 아이콘 스타일 */
.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.modal-icon.icon-success {
  background: var(--modal-success-soft);
  color: var(--modal-success-dark);
  font-weight: bold;
}

.modal-icon.icon-error {
  background: var(--modal-danger-soft);
  color: var(--modal-danger-dark);
  font-weight: 800;
}

.modal-icon.icon-info {
  background: var(--modal-primary-soft);
  color: var(--modal-primary-dark);
}

/* 제목 영역 - .modal 내부에서만 적용 */
.modal .modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
  line-height: 1.4;
}

.modal .modal-sub {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

/* 구분선 */
.modal .divider {
  height: 1px;
  background: #f3f4f6;
  margin: 0 -24px 16px;
}

/* 본문 영역 - .modal 내부에서만 적용 */
.modal > .modal-body {
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal > .modal-body strong {
  color: #111827;
  font-weight: 600;
}

/* 리스트 스타일 - .modal 내부에서만 적용 */
.modal > .modal-body ul {
  background: #f9fafb;
  padding: 12px 16px;
  border-radius: 12px;
  list-style: none;
  margin-top: 12px;
}

.modal > .modal-body ul li {
  margin-bottom: 4px;
  font-size: 13px;
  color: #4b5563;
  padding-left: 0;
}

.modal > .modal-body ul li:last-child {
  margin-bottom: 0;
}

/* 힌트 텍스트 - .modal 내부에서만 적용 */
.modal > .modal-body .hint {
  margin-top: 12px;
  font-size: 12px;
  color: #9ca3af;
  padding-left: 2px;
}

/* 코드 블럭 */
.modal-body code {
  display: block;
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  margin: 8px 0;
  word-break: break-all;
}

/* 코드 복사 영역 */
.modal-body .code-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 8px;
  background: #f3f4f6;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.modal-body .code-row code {
  background: transparent;
  color: #1f2937;
  border: none;
  margin: 0;
  flex: 1;
  display: flex;
  align-items: center;
}

.modal-body .btn-copy {
  background: #ffffff;
  border: none;
  border-left: 1px solid #e5e7eb;
  padding: 0 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--modal-primary-dark);
  transition: background 0.2s;
}

.modal-body .btn-copy:hover {
  background: #eff6ff;
}

/* 푸터 영역 (버튼) - .modal 내부에서만 적용 */
.modal > .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 모달 액션 버튼 */
.btn-modal-action {
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-modal-action:active {
  transform: scale(0.98);
}

/* Secondary 버튼 (닫기, 취소) */
.btn-modal-secondary {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #374151;
}

.btn-modal-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Primary 버튼 (확인, 제출) */
.btn-modal-primary {
  background: var(--modal-primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-modal-primary:hover {
  background: var(--modal-primary-dark);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Success 버튼 */
.btn-modal-success {
  background: var(--modal-success);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-modal-success:hover {
  background: var(--modal-success-dark);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

/* Danger 버튼 */
.btn-modal-danger {
  background: var(--modal-danger);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-modal-danger:hover {
  background: var(--modal-danger-dark);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Outline 버튼 */
.btn-modal-outline {
  background: white;
  border: 1px solid var(--modal-border);
  color: var(--modal-text-main);
}

.btn-modal-outline:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* 반응형 */
@media (max-width: 640px) {
  .modal {
    max-width: 100%;
    margin: 16px;
    padding: 20px;
  }

  .modal > .modal-header {
    gap: 12px;
  }

  .modal .modal-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

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

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

  .btn-modal-action {
    width: 100%;
    justify-content: center;
  }
}
