/* ==========================================================================
   信息系统常见违章 · 案例警示馆（纯展示版）
   文件：modules/system_violations/css/cases.css
   URL：/modules/system_violations/css/cases.css
   说明：所有样式均限定在 #case-module 内，不影响原有页面样式
   配色：沿用主站淡绿主题（主绿 #3fae74 / 深绿 #1f7a4d / 淡绿 #eafaf1）
   ========================================================================== */

   #case-module {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0; inset: 0; z-index: 120;
    display: none; flex-direction: column;
    background:
        radial-gradient(circle at 10% 0%, rgba(168, 230, 191, 0.5), transparent 55%),
        linear-gradient(180deg, #f5fdf8 0%, #eaf8f0 100%);
}
#case-module.show { display: flex; animation: cmFade 0.22s ease; }
@keyframes cmFade { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- 顶部 ---------- */
.cm-top {
    /* 顶部叠加刘海/灵动岛安全区：否则"返回列表"按钮会被状态栏压住、点不到，
       而它是本模块唯一的退出通道 */
    padding: calc(11px + var(--sa-top, 0px)) calc(12px + var(--sa-right, 0px)) 12px calc(12px + var(--sa-left, 0px));
    background: linear-gradient(135deg, #eafaf1, #d3f0e0);
    border-bottom: 1px solid #cbe8d9;
    box-shadow: 0 2px 10px rgba(63, 174, 116, 0.14);
}
.cm-top-row { display: flex; align-items: center; gap: 9px; }
/* 允许标题块收缩，避免窄屏上把返回按钮挤出去 */
.cm-top-row > * { min-width: 0; }
.cm-back {
    border: 1px solid #bfe7d1; background: rgba(255, 255, 255, 0.9); color: #2f9b64;
    font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 14px; cursor: pointer;
    min-height: 44px; display: inline-flex; align-items: center;   /* 移动端最小点击热区 */
    white-space: nowrap; box-shadow: 0 1px 4px rgba(63, 174, 116, 0.12);
}
.cm-back:active { transform: translateY(1px); }
.cm-head-title { font-size: 14.5px; font-weight: 800; color: #1f7a4d; letter-spacing: 0.3px; }
.cm-head-sub { font-size: 12.5px; color: #4f7365; margin-top: 2px; }

/* ---------- 滚动区 ---------- */
/* 滚动区。底部原本硬编码 96px，但本模块 DOM 里没有任何 fixed 底栏需要避让，
   在 320×568 上等于白扔掉 19% 的可视高度；改成"安全区 + 合理留白" */
.cm-body {
    flex: 1; overflow-y: auto;
    padding: 12px calc(14px + var(--sa-right, 0px)) calc(28px + var(--sa-bottom, 0px)) calc(14px + var(--sa-left, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;   /* 防止滚到顶触发安卓下拉刷新，打断阅读 */
    overflow-wrap: anywhere;          /* 长英文/URL 不再顶破卡片 */
}
.cm-view { display: none; }
.cm-view.active { display: block; animation: cmUp 0.24s ease; }
@keyframes cmUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* ---------- 搜索 ---------- */
.cm-search { position: relative; }
.cm-search input {
    width: 100%; padding: 11px 40px; border: 1px solid #cfe9dc; border-radius: 22px;
    /* 必须 16px：iOS Safari 聚焦 <16px 的输入框会自动放大整页，
       而 maximum-scale/user-scalable 在 iOS 10+ 已被忽略 */
    background: #fff; font-size: 16px; color: #234; outline: none;
    box-shadow: 0 2px 8px rgba(31, 122, 77, 0.06);
}
.cm-search input:focus { border-color: #3fae74; box-shadow: 0 0 0 3px rgba(63, 174, 116, 0.15); }
.cm-search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: 0.6; }
.cm-search-clear {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; line-height: 1;   /* 放大到可点中的热区 */
    border: none; background: transparent; color: #5f7d6f; font-size: 16px; cursor: pointer; display: none;
}

/* ---------- 分类标签（可左右拖动） ---------- */
.cm-chips {
    display: flex; gap: 7px; overflow-x: auto; padding: 10px 0 2px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain; cursor: grab;
}
.cm-chips.dragging { cursor: grabbing; }
.cm-chips::-webkit-scrollbar { display: none; }
.cm-chip {
    flex: 0 0 auto; padding: 9px 14px; min-height: 40px; display: inline-flex; align-items: center;
    font-size: 12px; font-weight: 700; cursor: pointer;
    color: #2f9b64; background: #fff; border: 1px solid #d5f0e2; border-radius: 16px; white-space: nowrap;
    transition: all 0.15s ease;
    user-select: none; -webkit-user-select: none;
}
.cm-chip.active {
    color: #fff; border-color: transparent;
    background: linear-gradient(135deg, #5fcf90, #2f9b64);
    box-shadow: 0 3px 9px rgba(63, 174, 116, 0.28);
}
.cm-chip-n { opacity: 0.75; font-weight: 600; }

/* ---------- 通用面板 ---------- */
.cm-panel {
    margin-top: 12px; background: #fff; border: 1px solid #dcf1e6; border-radius: 14px;
    padding: 12px 13px; box-shadow: 0 3px 12px rgba(31, 122, 77, 0.07);
}
.cm-panel-title {
    font-size: 13px; font-weight: 800; color: #1f7a4d;
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap;
}
.cm-panel-title em { font-style: normal; font-size: 12px; font-weight: 600; color: #5f7d6f; margin-left: auto; }

/* ---------- 案例卡片 ---------- */
.cm-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cm-card {
    position: relative; overflow: hidden; cursor: pointer;
    background: linear-gradient(160deg, #fff, #f8fdfa);
    border: 1px solid #dcf1e6; border-radius: 14px; padding: 13px 13px 12px 16px;
    box-shadow: 0 3px 12px rgba(31, 122, 77, 0.07);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.cm-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, #a8e6bf, #3fae74);
}
.cm-card:hover { box-shadow: 0 6px 18px rgba(31, 122, 77, 0.14); border-color: #bfe7d1; }
.cm-card:active { transform: scale(0.985); }
.cm-card-top { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; flex-wrap: wrap; }
.cm-no {
    font-size: 12px; font-weight: 800; color: #fff; letter-spacing: 0.5px;
    background: linear-gradient(135deg, #5fcf90, #2f9b64); padding: 2px 8px; border-radius: 10px;
}
.cm-type { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.cm-type.network { color: #1f7a4d; background: #e6f9ee; border: 1px solid #bfe7d1; }
.cm-type.data    { color: #22688a; background: #e8f5fa; border: 1px solid #c3e2ee; }
.cm-type.privacy { color: #8a6321; background: #fdf4e4; border: 1px solid #f0dcb8; }
.cm-type.ai      { color: #5a4a9e; background: #f1eefc; border: 1px solid #dcd4f5; }
.cm-region { font-size: 12px; color: #5f7d6f; margin-left: auto; }
.cm-card h4 { font-size: 14px; color: #1c5a40; font-weight: 800; line-height: 1.4; margin: 0 0 5px; }
.cm-card p {
    font-size: 13px; color: #57796a; line-height: 1.6; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.cm-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.cm-tag {
    font-size: 12px; color: #45705d; background: #eaf7f0;
    border: 1px solid #d5eade; padding: 2px 8px; border-radius: 8px;
}
.cm-more { font-size: 12.5px; font-weight: 700; color: #1f7a4d; white-space: nowrap; }
mark.cm-hl { background: #fff1b8; color: #7a5c00; border-radius: 3px; padding: 0 1px; }
.cm-empty { text-align: center; padding: 36px 10px; color: #5f7d6f; font-size: 13px; }
.cm-empty span { display: block; font-size: 26px; margin-bottom: 8px; opacity: 0.6; }

/* ---------- 案例详情 ---------- */
.cm-hero {
    background: linear-gradient(150deg, #ffffff, #eafaf1);
    border: 1px solid #cbe8d9; border-radius: 16px; padding: 14px;
    box-shadow: 0 5px 18px rgba(31, 122, 77, 0.1);
}
.cm-hero-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.cm-hero h3 { font-size: 16px; color: #1c5a40; font-weight: 800; line-height: 1.45; margin: 0; }
.cm-hero-sub { margin-top: 7px; font-size: 13px; color: #4f7365; line-height: 1.7; }
.cm-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.cm-fact { background: rgba(255, 255, 255, 0.9); border: 1px solid #cfe9da; border-radius: 10px; padding: 8px 10px; }
.cm-fact span { display: block; font-size: 11.5px; color: #5f7d6f; margin-bottom: 2px; }
.cm-fact b { font-size: 13px; color: #2f6b52; font-weight: 700; line-height: 1.45; }
/* 320~359px 窄屏：固定两列会让每格只剩 ~110px，中文被挤成 3 行，退化为单列 */
@media (max-width: 359px) {
    .cm-facts { grid-template-columns: 1fr; }
}

/* 风险演变（四步） */
.cm-chain { position: relative; }
.cm-step {
    position: relative; margin-bottom: 9px; padding: 9px 11px;
    background: #fff; border: 1px solid #ddf0e6; border-radius: 12px;
    box-shadow: 0 2px 8px rgba(31, 122, 77, 0.06);
    animation: cmStep 0.34s ease backwards;
}
.cm-step:last-child { margin-bottom: 0; }
@keyframes cmStep { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.cm-step-label { font-size: 12.5px; font-weight: 800; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.cm-step-text { font-size: 13px; color: #3d5c4d; line-height: 1.7; }
.cm-step.s1 { border-left: 3px solid #f0dcb8; }
.cm-step.s2 { border-left: 3px solid #f3cfc5; }
.cm-step.s3 { border-left: 3px solid #dcd4f5; }
.cm-step.s4 { border-left: 3px solid #a8e6bf; }
.cm-step.s1 .cm-step-label { color: #8f6113; }
.cm-step.s2 .cm-step-label { color: #c0503a; }
.cm-step.s3 .cm-step-label { color: #5a4a9e; }
.cm-step.s4 .cm-step-label { color: #1f7a4d; }

/* 违规点 */
.cm-faults { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.cm-faults li { position: relative; padding-left: 25px; font-size: 13px; color: #3d5c4d; line-height: 1.7; }
.cm-faults li::before {
    content: "✕"; position: absolute; left: 0; top: 1px;
    width: 19px; height: 19px; line-height: 19px; text-align: center;
    font-size: 12px; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, #f0a58c, #e07a5f); border-radius: 50%;
}

/* 法规与处罚 */
.cm-law {
    display: inline-block; font-size: 12px; font-weight: 700; color: #1f7a4d;
    background: #eafaf1; border: 1px solid #bfe7d1; border-radius: 9px;
    padding: 3px 9px; margin: 0 6px 6px 0;
}
.cm-penalty { display: flex; flex-wrap: wrap; gap: 7px; }
.cm-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 10px; }
.cm-pill.fix  { background: #eafaf1; color: #1f7a4d; border: 1px solid #bfe7d1; }
.cm-pill.fine { background: #fdf4e4; color: #8a6321; border: 1px solid #f0dcb8; }
.cm-pill.warn { background: #fdeeee; color: #a1442f; border: 1px solid #f3cfc5; }

/* 防范建议（只展示，不可勾选） */
.cm-advice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cm-advice-list li { position: relative; padding-left: 26px; font-size: 13px; color: #3a5c4c; line-height: 1.7; }
.cm-advice-list li::before {
    content: "✓"; position: absolute; left: 0; top: 1px;
    width: 19px; height: 19px; line-height: 19px; text-align: center;
    font-size: 12px; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, #5fcf90, #2f9b64); border-radius: 50%;
}

/* 警示语 */
.cm-lesson {
    display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
    background: linear-gradient(150deg, #f2fdf7, #e4f8ee);
    border: 1px dashed #a8e6bf; border-radius: 14px; padding: 11px 12px;
}
/* 新羚羊是竖构图（0.6:1），按高度定尺寸；容器写成 46×46 正方形会让它只渲染成 27.6px 宽，太小 */
.cm-lesson img { height: 56px; width: auto; object-fit: contain; flex: 0 0 auto; }
.cm-lesson-text { font-size: 13px; color: #2a5c47; line-height: 1.75; min-width: 0; flex: 1 1 180px; }
.cm-lesson-text b { color: #1f7a4d; }

/* 上一个 / 下一个 */
.cm-nav { display: flex; gap: 10px; margin-top: 12px; }
.cm-nav button {
    flex: 1; padding: 10px; min-height: 44px; font-size: 13px; font-weight: 700; cursor: pointer;
    border-radius: 12px; border: 1px solid #d5f0e2; background: #fff; color: #2f9b64;
}
.cm-nav button:disabled { opacity: 0.42; cursor: not-allowed; }
.cm-nav button:active:not(:disabled) { transform: translateY(1px); }

/* --------------------------------------------------------------------------
   涉及法规：多枚法规胶囊整齐排列（合并丢失后从 4ef9f39 取回）
   cases.js 会把 .cm-law 逐个放进 .cm-fact-laws 容器里
   -------------------------------------------------------------------------- */
.cm-fact-laws { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1px; }
.cm-fact-laws .cm-law {
    margin: 0; font-size: 11.5px; font-weight: 700; color: #21503a; line-height: 1.4;
    padding: 2px 8px; border-radius: 8px;
    max-width: 100%; white-space: normal; word-break: break-word;
}
