/* 全站弹窗 / 确认框 / 提示条 — 统一样式 */

:root {
  --dialog-overlay: rgba(15, 23, 42, 0.52);
  --dialog-panel-bg: #fff;
  --dialog-panel-radius: 16px;
  --dialog-panel-shadow:
    0 24px 48px rgba(15, 23, 42, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  --dialog-border: #e8ecf2;
  --dialog-accent: #2563eb;
  --dialog-text: #111827;
  --dialog-muted: #6b7280;
}

@keyframes dialog-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-panel-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* —— 模态框 —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--dialog-overlay);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal:not(.hidden) .modal-backdrop {
  animation: dialog-backdrop-in 0.22s ease;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(92vh, 720px);
  background: var(--dialog-panel-bg);
  border-radius: var(--dialog-panel-radius);
  border: 1px solid var(--dialog-border);
  box-shadow: var(--dialog-panel-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal:not(.hidden) .modal-panel {
  animation: dialog-panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--dialog-border);
  flex-shrink: 0;
  background: #fff;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dialog-text);
  letter-spacing: -0.01em;
}

.modal-header--brand {
  border-bottom: none;
  background: linear-gradient(135deg, #f8fafc 0%, #fff 68%);
}

.modal-header--brand-accent {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 55%, #fff 100%);
}

.modal-header-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.modal-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--dialog-accent);
  background: #fff;
  border: 1px solid rgba(37, 99, 235, 0.12);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.modal-header-icon--neutral {
  color: #475569;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.modal-header-icon--success {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.15);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.1);
}

.modal-header-text {
  min-width: 0;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--dialog-muted);
  font-weight: normal;
}

.modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.modal-close--round {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.35rem;
}

.modal-close--round:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #475569;
}

.modal-body {
  padding: 18px 22px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--dialog-border);
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
  flex-shrink: 0;
}

/* —— 弹窗内提示条 —— */
.modal-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.modal-message::before {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  content: "";
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.modal-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.modal-message.error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23dc2626'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z'/%3E%3C/svg%3E");
}

.modal-message.ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.modal-message.ok::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23059669'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z'/%3E%3C/svg%3E");
}

.modal-message.warn {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.modal-message.warn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23d97706'%3E%3Cpath fill-rule='evenodd' d='M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z'/%3E%3C/svg%3E");
}

/* —— 确认框 —— */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.confirm-dialog:not(.hidden) .confirm-backdrop {
  animation: dialog-backdrop-in 0.22s ease;
}

.confirm-dialog:not(.hidden) .confirm-panel {
  animation: dialog-panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: var(--dialog-overlay);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.confirm-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 22px;
  background: var(--dialog-panel-bg);
  border-radius: var(--dialog-panel-radius);
  border: 1px solid var(--dialog-border);
  box-shadow: var(--dialog-panel-shadow);
  text-align: center;
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
}

.confirm-icon svg {
  width: 26px;
  height: 26px;
}

.confirm-icon--warning {
  color: #d97706;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.15);
}

.confirm-icon--danger {
  color: #dc2626;
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

.confirm-icon--info {
  color: #2563eb;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.confirm-icon--success {
  color: #059669;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.confirm-icon.hidden {
  display: none;
}

.confirm-title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dialog-text);
  letter-spacing: -0.01em;
}

.confirm-message {
  margin: 0 0 22px;
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.6;
  white-space: pre-line;
  text-align: left;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-dialog.alert-only .confirm-actions {
  justify-content: center;
}

.confirm-dialog.alert-only #confirmCancel {
  display: none;
}

.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-danger:hover {
  filter: brightness(1.05);
}

.btn-danger:active {
  transform: translateY(1px);
}

.btn-primary--emphasis {
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.28);
}

/* —— 页面内联提示（登录页等） —— */
.banner-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.banner-message::before {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  content: "";
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.banner-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.banner-message.error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23dc2626'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z'/%3E%3C/svg%3E");
}

.banner-message.ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.banner-message.ok::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23059669'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z'/%3E%3C/svg%3E");
}

@media (max-width: 520px) {
  .modal {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-panel {
    max-height: 94vh;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }

  .modal:not(.hidden) .modal-panel {
    animation: dialog-panel-in-mobile 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes dialog-panel-in-mobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .confirm-panel {
    padding: 24px 20px 18px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions .btn-primary,
  .confirm-actions .btn-secondary,
  .confirm-actions .btn-danger {
    width: 100%;
    justify-content: center;
  }
}
