/* KOF STORM · Quản trị — "Website & SEO" (static/cms.js). Dùng biến màu của app.css. */

/* ---------- chung */
.cms-lab { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cms-lab label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cms-lab .req { color: var(--err); }
.cms-cnt { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cms-cnt.ok { color: var(--muted); }
.cms-cnt.warn { color: var(--warn); }
.cms-cnt.over { color: var(--err); font-weight: 600; }
.form-grid.one { grid-template-columns: minmax(0, 1fr); }
.cms-group { grid-column: 1 / -1; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px 14px; margin: 0; min-width: 0; }
.cms-group > legend { padding: 0 6px; font-weight: 650; font-size: 13px; color: var(--text); }
.cms-boolf { justify-content: center; }
.cms-color { width: 40px; height: 36px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; flex: none; }
.cms-yt { font-size: 12px; }
.cms-yt.ok { color: #7ee2a8; }
.cms-yt.bad { color: #ffcf7a; }
.cms-prefix .pre { position: absolute; left: 11px; color: var(--faint); font-family: var(--mono); font-size: 12px; pointer-events: none; }
.cms-prefix > .inp { padding-left: 82px; font-family: var(--mono); font-size: 12.5px; }
.cms-or { text-align: center; color: var(--faint); font-size: 12px; position: relative; }
.cms-sticky { position: sticky; top: 0; align-self: start; min-width: 0; }
.cms-search { flex: 1 1 220px; min-width: 0; }
.cms-savebar { position: sticky; bottom: -40px; z-index: 5; display: flex; align-items: center; gap: 12px; margin: 18px -24px -40px; padding: 12px 24px;
  background: rgba(12, 15, 21, .94); border-top: 1px solid var(--line-2); backdrop-filter: blur(6px); flex-wrap: wrap; }
.cms-linkrow { min-width: 0; }
.cms-linkrow .mono { font-size: 11.5px; color: var(--text-2); }
.cms-used { margin: 0; padding-left: 18px; color: var(--text-2); }
.cms-star { color: var(--q4); margin-right: 4px; display: inline-flex; vertical-align: -2px; }
.tbl .w-thumb { width: 72px; }

/* ---------- ảnh nhỏ */
.cms-th { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; background: #0b0e14 linear-gradient(45deg, #121722 25%, transparent 25%, transparent 75%, #121722 75%) 0 0 / 16px 16px;
  display: grid; place-items: center; color: var(--faint); border: 1px solid var(--line); }
.cms-th img, .cms-th video { width: 100%; height: 100%; object-fit: contain; display: block; }
.cms-th.none .ic { width: 22px; height: 22px; }
.cms-th.ext { gap: 4px; font-size: 11px; grid-auto-flow: row; text-align: center; padding: 4px; }
.cms-th.xs { width: 60px; height: 40px; aspect-ratio: auto; border-radius: 7px; flex: none; }
.cms-th.xs img { object-fit: cover; }
.cms-th.sm { width: 120px; height: 76px; aspect-ratio: auto; flex: none; }
.cms-th.lg { max-height: 220px; }
.cms-th-badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .7); color: #fff; border-radius: 6px; padding: 2px 5px; display: inline-flex; }

/* ---------- ô chọn media */
.cms-mf { display: flex; gap: 12px; align-items: center; min-width: 0; }
.cms-mf-r { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cms-mf-r > .inp { font-family: var(--mono); font-size: 12px; }
.cms-sticky .cms-mf { flex-direction: column; align-items: stretch; }
.cms-sticky .cms-th.sm { width: 100%; height: 160px; }

/* ---------- thư viện: lưới + thẻ */
.cms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; min-height: 120px; }
.cms-grid > .loading, .cms-grid > .empty, .cms-grid > .errbox { grid-column: 1 / -1; }
.cms-grid.pick { max-height: 56vh; overflow: auto; padding: 2px; }
.cms-mcard { position: relative; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.cms-mcard .cms-th { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.cms-mcard.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.cms-mcard.clickable:hover { border-color: var(--acc-line); transform: translateY(-1px); }
.cms-mc-b { padding: 8px 10px 9px; min-width: 0; }
.cms-mc-t { font-weight: 600; font-size: 12.5px; }
.cms-mc-s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cms-mc-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.cms-mcard:hover .cms-mc-tools, .cms-mcard:focus-within .cms-mc-tools { opacity: 1; }
.cms-mc-tools .btn { background: rgba(10, 12, 17, .82); }
@media (hover: none) { .cms-mc-tools { opacity: 1; } }
.cms-drop { position: relative; border-radius: 12px; }
.cms-drop-hint { display: none; position: absolute; inset: 0; z-index: 3; border: 2px dashed var(--acc); border-radius: 12px; background: rgba(255, 106, 26, .08);
  place-items: center; align-content: center; gap: 8px; color: #ffc49c; font-weight: 650; pointer-events: none; }
.cms-drop.over .cms-drop-hint { display: grid; }
.cms-queue { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-2); }
.cms-q { display: flex; gap: 12px; align-items: center; font-size: 12.5px; min-width: 0; }
.cms-q-st { width: 90px; text-align: right; color: var(--muted); }
.cms-q-st.done { color: var(--ok); }
.cms-q-st.fail { color: var(--err); }
.cms-detail { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cms-detail-img { border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: #0b0e14 linear-gradient(45deg, #121722 25%, transparent 25%, transparent 75%, #121722 75%) 0 0 / 16px 16px; }
.cms-big { display: block; width: 100%; max-height: 62vh; object-fit: contain; }

/* ---------- icon app */
.cms-appicon { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 14px; }
.cms-appicon-img { width: 132px; height: 132px; flex: none; border-radius: 28px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg-2); display: grid; place-items: center; }
.cms-appicon-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cms-appicon-empty { display: grid; place-items: center; gap: 4px; color: var(--faint); font-size: 12px; }

/* ---------- xem trước Google / chia sẻ */
.serp { background: #fff; color: #202124; border-radius: 12px; padding: 14px 16px; font-family: Arial, "Segoe UI", sans-serif; max-width: 600px; }
.serp-top { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.serp-fav { width: 28px; height: 28px; border-radius: 50%; background: #f1f3f4; border: 1px solid #e3e5e8; display: grid; place-items: center; overflow: hidden; color: #5f6368; flex: none; }
.serp-fav img { width: 18px; height: 18px; object-fit: contain; }
.serp-site { font-size: 14px; color: #202124; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serp-url { font-size: 12px; color: #4d5156; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serp-t { font-size: 20px; line-height: 1.3; color: #1a0dab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.serp-d { font-size: 14px; line-height: 1.58; color: #4d5156; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.share { max-width: 520px; border: 1px solid #3a4152; border-radius: 10px; overflow: hidden; background: #242526; color: #e4e6eb; font-family: "Segoe UI", Arial, sans-serif; }
.share-img { aspect-ratio: 1.91 / 1; background: #18191a; display: grid; place-items: center; overflow: hidden; }
.share-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-noimg { display: grid; place-items: center; gap: 6px; color: #8a8d91; font-size: 12.5px; }
.share-b { padding: 10px 12px 12px; border-top: 1px solid #3a3b3c; }
.share-host { font-size: 12px; color: #b0b3b8; text-transform: uppercase; }
.share-t { font-size: 16px; font-weight: 600; line-height: 1.3; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-d { font-size: 13.5px; color: #b0b3b8; line-height: 1.35; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- trang chủ: danh sách khối */
.cms-secs { display: flex; flex-direction: column; gap: 8px; }
.cms-sec { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); position: relative; min-width: 0; }
.cms-sec.off { opacity: .62; }
.cms-sec.off:hover { opacity: .9; }
.cms-sec.foot { background: var(--bg-2); border-style: dashed; }
.cms-sec.dragging { opacity: .35; }
.cms-sec.drop-a::before, .cms-sec.drop-b::after { content: ""; position: absolute; left: 8px; right: 8px; height: 3px; border-radius: 3px; background: var(--acc); }
.cms-sec.drop-a::before { top: -6px; }
.cms-sec.drop-b::after { bottom: -6px; }
.cms-grip { color: var(--faint); cursor: grab; display: grid; place-items: center; width: 22px; flex: none; }
.cms-grip:hover { color: var(--text); }
.cms-grip.dis { cursor: default; }
.cms-sec-n { width: 26px; height: 26px; border-radius: 8px; background: var(--grad-soft); border: 1px solid var(--acc-line); color: #ffb27d; font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; }
.cms-sec-m { flex: 1; min-width: 0; }
.cms-sec-t { display: flex; align-items: center; gap: 8px; font-weight: 650; flex-wrap: wrap; }
.cms-sec-t .ic { color: var(--acc); }
.cms-sec-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cms-sec-a { display: flex; align-items: center; gap: 4px; flex: none; }
.cms-sec-a .switch { margin-right: 6px; }

/* ---------- danh sách có thứ tự (chuyên mục / menu) */
.cms-rows { display: flex; flex-direction: column; }
.cms-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.cms-row:last-child { border-bottom: 0; }
.cms-row.off .cms-row-m { opacity: .6; }
.cms-ord { display: flex; flex-direction: column; gap: 0; flex: none; }
.cms-ord .btn.xs { height: 20px; }
.cms-row-m { flex: 1; min-width: 0; }
.cms-row-t { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cms-row-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cms-row-s.mono { font-size: 11.5px; }
.cms-row-c { flex: none; }
.cms-row-a { display: flex; align-items: center; gap: 2px; flex: none; }
.cms-row-a .switch { margin-right: 6px; }
.cms-navprev { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; background: #0b0d12; border: 1px solid var(--line-2); }
.cms-nav-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--grad); display: grid; place-items: center; color: #fff; margin-right: 10px; }
.cms-nav-i { padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.cms-nav-i:first-of-type { color: #ffd38a; background: rgba(227, 179, 74, .1); }
.cms-postpick-cur { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line-2); min-width: 0; }

/* ---------- ô danh sách lặp (form khối) */
.cms-list { display: flex; flex-direction: column; gap: 10px; }
.cms-list-empty { padding: 14px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--faint); text-align: center; font-size: 12.5px; }
.cms-li { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px 12px; background: var(--bg-2); }
.cms-li-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; min-width: 0; }
.cms-li .form-grid { gap: 10px 12px; }

/* ---------- trình soạn bài */
.cms-editor { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.cms-title-inp { font-size: 20px !important; font-weight: 700; line-height: 1.35; min-height: 46px !important; resize: none; overflow: hidden; }
.rte { border: 1px solid var(--line-2); border-radius: 11px; background: var(--bg-2); display: flex; flex-direction: column; min-width: 0; }
.rte:focus-within { border-color: var(--acc-line); }
.rte-bar { position: sticky; top: -22px; z-index: 4; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--line-2);
  background: #131823; border-radius: 11px 11px 0 0; }
.rte-bar.src-mode > :not(.rte-b[aria-label="Xem / sửa mã HTML"]):not(.grow):not([aria-label="Toàn màn hình"]) { opacity: .35; pointer-events: none; }
.rte-b { height: 30px; min-width: 30px; padding: 0 6px; border: 0; border-radius: 7px; background: none; color: var(--text-2); cursor: pointer; display: inline-grid; place-items: center; }
.rte-b:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.rte-b.on { background: var(--acc-soft); color: #ffc49c; }
.rte-b .ic { width: 17px; height: 17px; }
.rte-t { font-weight: 800; font-size: 13.5px; font-family: Georgia, serif; }
.rte-b[title^="Nghiêng"] .rte-t { font-style: italic; }
.rte-b[title^="Gạch chân"] .rte-t { text-decoration: underline; }
.rte-b[title^="Gạch ngang"] .rte-t { text-decoration: line-through; }
.rte-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.rte-block { width: 150px !important; flex: none; }
.rte-ed { padding: 16px 18px; min-height: 160px; outline: none; overflow-wrap: anywhere; }
.rte-ed:empty::before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
.rte-src { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; min-height: 260px; background: #0b0e14; }
.rte-stat { padding: 6px 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; }
.rte.compact .rte-ed { min-height: 120px; max-height: 420px; overflow: auto; }
.rte.compact .rte-bar { position: static; }
.rte.rte-full { position: fixed; inset: 12px; z-index: 60; box-shadow: var(--shadow); }
.rte.rte-full .rte-bar { position: static; }
.rte.rte-full .rte-ed, .rte.rte-full .rte-src { flex: 1; overflow: auto; height: auto !important; }
.rte-embed { display: flex; align-items: center; justify-content: center; gap: 10px; aspect-ratio: 16 / 9; max-width: 560px; margin: 12px auto; border-radius: 10px;
  background: #000 linear-gradient(135deg, #1b0b0b, #000); color: #fff; font-weight: 600; user-select: none; border: 1px solid #3a2020; }
.rte-embed-ic { width: 48px; height: 34px; border-radius: 9px; background: #f00; display: grid; place-items: center; }
.rte-embed-ic .ic { fill: #fff; stroke: none; }

/* nội dung bài trong khung soạn (gần giống trang công khai) */
.cms-prose { font-size: 15px; line-height: 1.7; color: #dfe3ec; }
.cms-prose > :first-child { margin-top: 0; }
.cms-prose h2 { font-size: 22px; margin: 1.3em 0 .5em; color: #fff; }
.cms-prose h3 { font-size: 18px; margin: 1.2em 0 .45em; color: #fff; }
.cms-prose h4 { font-size: 16px; margin: 1.1em 0 .4em; color: #fff; }
.cms-prose p { margin: 0 0 .9em; }
.cms-prose a { color: #ffb27d; text-decoration: underline; }
.cms-prose blockquote { margin: 1em 0; padding: 8px 16px; border-left: 3px solid #e3b34a; background: rgba(227, 179, 74, .07); border-radius: 0 8px 8px 0; color: #f0e2c0; }
.cms-prose ul, .cms-prose ol { padding-left: 1.5em; margin: 0 0 .9em; }
.cms-prose pre { background: #0b0e14; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; }
.cms-prose hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.4em 0; }
.cms-prose img, .cms-prose video { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.cms-prose figure { margin: 1em 0; }
.cms-prose figure.img-center img { margin: 0 auto; max-width: 70%; }
.cms-prose figure.img-left { float: left; max-width: 45%; margin: .3em 1.2em .8em 0; }
.cms-prose figure.img-right { float: right; max-width: 45%; margin: .3em 0 .8em 1.2em; }
.cms-prose figcaption { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 6px; }
.cms-prose::after { content: ""; display: block; clear: both; }
.cms-prose table { border-collapse: collapse; width: 100%; }
.cms-prose td, .cms-prose th { border: 1px solid var(--line-2); padding: 6px 8px; }

/* ---------- responsive */
@media (max-width: 1280px) {
  .cms-editor { grid-template-columns: minmax(0, 1fr); }
  .cms-sticky { position: static; }
}
@media (max-width: 860px) {
  .cms-savebar { margin: 18px -16px -40px; padding: 10px 16px; }
  .cms-detail { grid-template-columns: 1fr; }
  .cms-sec { flex-wrap: wrap; }
  .cms-sec-m { flex-basis: calc(100% - 140px); }
  .cms-sec-a { width: 100%; justify-content: flex-end; }
}
@media (max-width: 640px) {
  .cms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cms-mf { flex-direction: column; align-items: stretch; }
  .cms-th.sm { width: 100%; height: 120px; }
  .cms-appicon { flex-direction: column; }
  .cms-row { flex-wrap: wrap; }
  .cms-row-m { flex-basis: calc(100% - 60px); }
  .cms-row-a { margin-left: auto; }
  .rte-block { width: 120px !important; }
  .cms-sec { gap: 8px; }
  .cms-sec > .cms-th.xs { display: none; }
  .cms-sec-m { flex-basis: calc(100% - 70px); }
}
