/* ============================================================
 * components.css - 可复用组件样式：弹窗 / 分页 / 全局提示
 * 对应 common/js/modal.js、pagination.js、common.js
 * ============================================================ */

/* ---------- 弹窗 Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  animation: overlay-in .16s ease-out;
}
.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in .18s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--c-border); }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--c-muted); font-size: 20px; line-height: 1; }
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body { padding: 22px; font-size: 14px; line-height: 1.7; color: var(--c-text-sub); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--c-border); }

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---------- 分页 Pagination ---------- */
.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.pagination .page-total { margin-right: auto; color: var(--c-muted); }
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--c-text-sub);
  font-size: 13px;
  transition: all .16s ease;
}
.page-btn:hover:not(:disabled):not(.is-active) { border-color: var(--c-primary); color: var(--c-primary); }
.page-btn.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--c-muted); }
.page-size { height: 32px; padding: 0 8px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); background: #fff; font-size: 13px; color: var(--c-text-sub); }
.page-jumper { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); }
.page-jumper input { width: 52px; height: 32px; padding: 0 8px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); text-align: center; outline: none; }
.page-jumper input:focus { border-color: var(--c-primary); }

/* ---------- 全局顶部通知 Toast（Bootstrap Alert 风格） ----------
   左侧圆形图标 + 文案 + 右侧关闭按钮；不同类型不同背景色与文字色。 */
#toast-root {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(20, 30, 60, .08);
  font-size: 13px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in .22s ease-out;
}
.toast-icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.toast-text { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.toast-close {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  line-height: 20px;
  cursor: pointer;
  opacity: .55;
}
.toast-close:hover { opacity: 1; }

/* primary 蓝 / success 绿 / info 灰 / warning 橙 / error 红 */
.toast--primary { background: #d9ecff; border-color: #b9d8ff; color: #124a8a; }
.toast--primary .toast-icon { background: #2f80ed; }
.toast--success { background: #d8f3e6; border-color: #b6e6cf; color: #146c43; }
.toast--success .toast-icon { background: #1f9d55; }
.toast--info    { background: #ebedef; border-color: #d8dce1; color: #4a515b; }
.toast--info .toast-icon { background: #8b939e; }
.toast--warning { background: #fff0d6; border-color: #f7dda8; color: #8a5a00; }
.toast--warning .toast-icon { background: #e59a17; }
.toast--error   { background: #fde0e2; border-color: #f6bcc0; color: #a5161c; }
.toast--error .toast-icon { background: #d92d34; }

.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: all .18s ease; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 全站图片点击放大（Lightbox） ----------
   由 common/js/common.js 的事件委托统一挂载，层级需高于 modal(1000) 与号码气泡(2100)。 */
.img-lightbox {
  position: fixed; inset: 0; z-index: 5000;
  display: none; align-items: center; justify-content: center;
  background: rgba(16, 18, 22, .86); padding: 56px 24px 40px;
}
.img-lightbox.is-open { display: flex; }
.img-lightbox-figure { max-width: 94vw; max-height: 92vh; margin: 0; text-align: center; }
.img-lightbox-img {
  display: block; max-width: 94vw; max-height: 86vh;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5); background: #fff;
}
.img-lightbox-caption { color: #e8eaee; font-size: 13px; margin-top: 12px; word-break: break-all; }
.img-lightbox-close {
  position: absolute; top: 16px; right: 22px;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 28px; line-height: 42px; text-align: center; cursor: pointer;
}
.img-lightbox-close:hover { background: rgba(255, 255, 255, .28); }
