/* ==================================================
   PaymentModal — 범용 결제 모달 스타일
   ================================================== */

#payment-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
#payment-modal-overlay.pm-visible {
  display: flex;
}

.pm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ── 모달 박스 ── */
.pm-modal {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  margin: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: pm-pop .22s cubic-bezier(0.34, 1.36, 0.64, 1) both;
}

@keyframes pm-pop {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ── 헤더 ── */
.pm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid #eee;
}
.pm-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eef3fb;
  color: var(--primary-color, #1A447A);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.pm-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #111;
}
.pm-close-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: background .15s ease;
  flex-shrink: 0;
}
.pm-close-btn:hover { background: #f5f5f5; }

/* ── 본문 공통 ── */
.pm-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── 상품 카드 ── */
.pm-item-card {
  background: #f7f9fc;
  border: 1px solid #e8edf4;
  border-radius: 12px;
  padding: 14px 16px;
}
.pm-item-name {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 4px;
}
.pm-item-desc {
  font-size: 0.88rem;
  color: #888;
  line-height: 1.5;
}

/* ── 금액 행 ── */
.pm-amount-row,
.pm-account-row,
.pm-balance-after-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
}
.pm-amount-row {
  padding: 12px 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}
.pm-amount-label,
.pm-account-label,
.pm-balance-after-label {
  color: #555;
  font-weight: 500;
}
.pm-amount-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-color, #1A447A);
}
.pm-account-balance {
  font-weight: 600;
  color: #222;
}
.pm-balance-after-value {
  font-weight: 700;
  color: #27ae60;
}
.pm-balance-after-value.negative {
  color: #e74c3c;
}

/* ── 경고 ── */
.pm-warn {
  background: #fff5f5;
  border: 1px solid #fcc;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  color: #c0392b;
  font-weight: 500;
  line-height: 1.5;
}

/* ── 액션 버튼 ── */
.pm-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.pm-btn-cancel {
  flex: 1;
  height: 48px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
  font-size: 0.97rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background .15s ease;
}
.pm-btn-cancel:hover { background: #f5f5f5; }

.pm-btn-confirm {
  flex: 2;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--primary-color, #1A447A);
  color: #fff;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .15s ease, opacity .15s ease;
}
.pm-btn-confirm:hover:not(:disabled) {
  background: var(--sub-color, #112E51);
}
.pm-btn-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── 로딩 ── */
.pm-loading {
  align-items: center;
  justify-content: center;
  min-height: 160px;
  color: #888;
  font-size: 0.97rem;
  gap: 16px;
}
.pm-loading-icon {
  font-size: 2rem;
  color: var(--primary-color, #1A447A);
}

/* ── 결과 (성공/실패) ── */
.pm-success,
.pm-fail {
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  gap: 12px;
}
.pm-result-icon {
  font-size: 3rem;
  line-height: 1;
}
.pm-result-icon.success { color: #27ae60; }
.pm-result-icon.fail    { color: #e74c3c; }

.pm-result-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111;
  margin: 0;
}
.pm-result-desc {
  font-size: 0.92rem;
  color: #666;
  margin: 0;
  line-height: 1.6;
}
.pm-btn-done {
  flex: none !important;
  width: 100%;
  margin-top: 8px;
}

/* ── 모바일 ── */
@media (max-width: 480px) {
  .pm-modal {
    border-radius: 20px 20px 0 0;
    margin: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    animation: pm-slide-up .25s cubic-bezier(0.34, 1.2, 0.64, 1) both;
  }
  @keyframes pm-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  #payment-modal-overlay.pm-visible {
    align-items: flex-end;
  }
}