/**
 * 規則維護中心 — 統一 Modal / Popup 樣式
 * 用於 RulesCenterView 下所有子頁面的新增、編輯、刪除視窗
 */

/* ── 尺寸變體 ── */
.rmodal--sm  { max-width: 440px !important; }
.rmodal--md  { max-width: 680px !important; }
.rmodal--lg  { max-width: 820px !important; }
.rmodal--xl  { max-width: 920px !important; }
.rmodal--2xl { max-width: 1060px !important; }

/* ── 表單 Modal Header ── */
.rmodal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--clr-border-light, #e2e8f0);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.rmodal-header-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.rmodal-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.rmodal-icon--blue   { background: #eff6ff; border: 1px solid #bfdbfe; }
.rmodal-icon--purple { background: #f5f3ff; border: 1px solid #ddd6fe; }
.rmodal-icon--green  { background: #f0fdf4; border: 1px solid #bbf7d0; }
.rmodal-icon--amber  { background: #fffbeb; border: 1px solid #fde68a; }
.rmodal-icon--red    { background: #fef2f2; border: 1px solid #fecaca; }
.rmodal-icon--slate  { background: #f1f5f9; border: 1px solid #e2e8f0; }

.rmodal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--clr-text, #0f172a);
  line-height: 1.35;
}

.rmodal-subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.5;
}

.rmodal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}

/* ── Body ── */
.rmodal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.rmodal-body--compact { padding: 18px 22px; }

/* 分區塊 */
.rmodal-section {
  margin-bottom: 18px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.rmodal-section:last-child { margin-bottom: 0; }

.rmodal-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.rmodal-grid {
  display: grid;
  gap: 14px;
}

.rmodal-grid--2 { grid-template-columns: 1fr 1fr; }
.rmodal-grid--3 { grid-template-columns: repeat(3, 1fr); }
.rmodal-grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 640px) {
  .rmodal-grid--2,
  .rmodal-grid--3,
  .rmodal-grid--4 { grid-template-columns: 1fr; }
}

/* 表單輔助 */
.rmodal .form-group { margin-bottom: 14px; }
.rmodal .form-group:last-child { margin-bottom: 0; }

.rmodal .req {
  color: #dc2626;
  font-weight: 600;
}

.rmodal-hint {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.5;
  margin-top: 5px;
}

.rmodal-callout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.55;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

.rmodal-callout--dashed {
  background: #f8fafc;
  border-style: dashed;
  border-color: #cbd5e1;
}

.rmodal-summary {
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.65;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  border-left: 3px solid #2563eb;
}

.rmodal-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 18px 0;
}

.rmodal-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}

/* 2026-08-11：原本這裡另外寫死 accent-color: #2563eb（第三種藍），
   已改由 global.css :root 的 accent-color 統一提供，這裡不再覆寫。 */
.rmodal-checkbox-row input { width: 15px; height: 15px; cursor: pointer; }
.rmodal-checkbox-row label { font-size: 13px; color: #334155; cursor: pointer; margin: 0; }

.rmodal-inline-box {
  display: none;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 12px;
}

.rmodal-scroll-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.rmodal-info-card {
  margin-top: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.75;
}

/* ── Footer ── */
.rmodal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--clr-border-light, #e2e8f0);
  background: #f8fafc;
}

.rmodal-footer .btn-primary { min-width: 88px; }

/* ── 刪除確認 Modal ── */
.rmodal--delete .rmodal-header {
  background: linear-gradient(180deg, #fef2f2 0%, #fff 100%);
  border-bottom-color: #fecaca;
}

.rmodal-body--delete {
  padding: 28px 24px 20px;
  text-align: center;
}

.rmodal-delete-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fee2e2;
  border: 2px solid #fecaca;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
}

.rmodal-delete-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: #991b1b;
}

.rmodal-delete-text {
  margin: 0 0 6px;
  font-size: 14px;
  color: #475569;
  line-height: 1.65;
}

.rmodal-delete-text strong {
  color: #0f172a;
  font-weight: 600;
}

.rmodal-delete-hint {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
}

.rmodal-footer--delete {
  justify-content: center;
  gap: 12px;
  background: #fff;
}

.rmodal-footer--delete .btn-danger { min-width: 100px; }
