/* public/css/community.css — صفحه‌های کامیونیتی (/community و زیرصفحه‌ها)
   فقط از توکن‌های ezlan-tokens.css استفاده می‌کنه؛ پس تم روشن/تیره، رنگ تأکیدی و شعاع‌ها
   خودکار با بقیهٔ سایت هماهنگن. باید بعد از ezlan-tokens.css و ezlan-shell.css لود شه.
   پیشوند همهٔ کلاس‌ها cm- ـه تا با صفحه‌های دیگه تداخل نکنه. */

/* box-sizing همهٔ المان‌های کامیونیتی border-box (width:100% + padding بیرون نزنه) و
   attribute «hidden» حتی روی المان‌هایی که display سفارشی دارن (دکمه، grid، flex) کار کنه */
.cm-main, .cm-main *, .cm-main *::before, .cm-main *::after,
.cm-overlay, .cm-overlay *, .cm-toast-region, .cm-toast-region * { box-sizing: border-box; }
.cm-main [hidden], .cm-overlay[hidden], .cm-overlay [hidden], .cm-toast-region [hidden] { display: none !important; }

.cm-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.cm-main {
  width: 100%;
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 20px 56px;
  min-height: calc(100vh - var(--nav-h) - 160px);
}

/* ---------- دکمه‌ها ---------- */
.cm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.cm-btn:active { transform: scale(0.98); }
.cm-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.cm-btn-primary { background: var(--accent); color: var(--on-accent); }
.cm-btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.cm-btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.cm-btn-outline:hover:not(:disabled) { background: var(--surface-3); }
.cm-btn-block { width: 100%; }

.cm-icon-btn {
  position: relative; flex: none; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; color: var(--ink-2);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
}
.cm-icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.cm-icon-btn svg { width: 18px; height: 18px; }

/* ---------- صفحهٔ اصلی کامیونیتی ---------- */
.cm-hero {
  position: relative; text-align: center;
  padding: clamp(36px, 7vw, 72px) 0 clamp(26px, 4vw, 40px);
}
.cm-hero::before {
  content: ""; position: absolute; inset: -64px -20px auto; height: 360px; z-index: -1;
  background: radial-gradient(55% 70% at 50% 0%, var(--accent-soft-2), transparent 72%);
  pointer-events: none;
}
.cm-hero h1 {
  margin: 0 0 12px; font-size: clamp(34px, 6.4vw, 58px); font-weight: 800; line-height: 1.25; letter-spacing: -0.01em;
}
.cm-hero p {
  margin: 0 auto; max-width: 30em; font-size: clamp(14px, 1.9vw, 16.5px); color: var(--ink-2); line-height: 1.95;
}

.cm-cards {
  display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr);
  max-width: 520px; margin: 0 auto;
}
.cm-card {
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: 10px 10px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cm-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-3); }
.cm-card-art {
  display: block; aspect-ratio: 16 / 7; overflow: hidden; border-radius: 14px;
  background:
    radial-gradient(70% 90% at 30% 20%, var(--accent-soft-2), transparent 70%),
    linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.cm-art { display: block; width: 100%; height: 100%; }
.cm-card-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 10px 0; flex: 1; }
.cm-card-body h2 { margin: 0; font-size: clamp(19px, 2.4vw, 22px); font-weight: 800; line-height: 1.5; }
.cm-card-body p { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); line-height: 1.9; }
.cm-card-body .cm-btn { margin-top: auto; }

/* ---------- سرصفحهٔ راهنماها + جست‌وجو ---------- */
.cm-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: clamp(26px, 4.5vw, 44px) 0 18px;
}
.cm-head h1 { margin: 0 0 4px; font-size: clamp(26px, 4.2vw, 38px); font-weight: 800; line-height: 1.4; }
.cm-head p { margin: 0; font-size: 14.5px; color: var(--ink-2); }

.cm-search { position: relative; display: flex; align-items: center; max-width: 760px; }
.cm-search-icon { position: absolute; inset-inline-start: 14px; display: grid; color: var(--ink-3); pointer-events: none; }
.cm-search-icon svg { width: 19px; height: 19px; }
.cm-search input {
  width: 100%; height: 50px; padding: 0 46px; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--field-bg); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none; appearance: none;
}
.cm-search input::placeholder { color: var(--ink-3); }
.cm-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.cm-search input::-webkit-search-cancel-button { display: none; }
.cm-search-clear {
  position: absolute; inset-inline-end: 8px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center;
  color: var(--ink-3); background: transparent; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.cm-search-clear:hover { color: var(--ink); background: var(--surface-3); }
.cm-search-clear svg { width: 16px; height: 16px; }

.cm-count { min-height: 22px; margin: 14px 2px 10px; font-size: 13px; color: var(--ink-3); }

/* ---------- گرید ویدیوها ---------- */
.cm-grid { display: grid; gap: 22px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .cm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 18px; } }
@media (min-width: 1020px) { .cm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; } }
.cm-grid[aria-busy="true"] .cm-vcard { opacity: 0.55; transition: opacity 0.15s ease; }

.cm-vcard { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cm-thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cm-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
:root[data-theme="dark"] .cm-thumb img { filter: brightness(0.82) saturate(0.95); }
.cm-thumb.has-img::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.28));
}
/* کاورهای ساخته‌شده برای ویدیوهای بدون عکس بازی — ۶ حالت ملایم از رنگ برند */
.cm-g0 { background: radial-gradient(80% 90% at 20% 10%, var(--accent-soft-2), transparent 70%), linear-gradient(135deg, var(--surface-2), var(--surface-3)); }
.cm-g1 { background: radial-gradient(80% 90% at 85% 15%, var(--accent-soft-2), transparent 70%), linear-gradient(200deg, var(--surface-2), var(--surface-3)); }
.cm-g2 { background: radial-gradient(90% 80% at 50% 100%, var(--accent-soft-2), transparent 70%), linear-gradient(160deg, var(--surface-3), var(--surface-2)); }
.cm-g3 { background: radial-gradient(70% 90% at 10% 90%, var(--accent-soft-2), transparent 72%), linear-gradient(120deg, var(--surface-2), var(--surface-3)); }
.cm-g4 { background: radial-gradient(80% 80% at 90% 90%, var(--accent-soft-2), transparent 70%), linear-gradient(220deg, var(--surface-3), var(--surface-2)); }
.cm-g5 { background: radial-gradient(90% 70% at 40% 0%, var(--accent-soft-2), transparent 70%), linear-gradient(145deg, var(--surface-2), var(--surface-3)); }
.cm-play {
  position: absolute; inset: 50% auto auto 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; z-index: 1;
  display: grid; place-items: center; color: #fff; background: var(--accent);
  border-radius: 50%; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.cm-play svg { width: 20px; height: 20px; margin-left: 2px; } /* مثلث پخش همیشه رو به راست (مثل همهٔ پلیرها، حتی توی RTL) و کمی جابه‌جا برای مرکزیت بصری */
.cm-vcard:hover .cm-thumb { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.cm-vcard:hover .cm-play { transform: scale(1.08); background: var(--accent-hover); }
.cm-vtitle { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.75; }
.cm-vtitle a {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
}
.cm-vtitle a:hover { color: var(--accent-ink); }

/* ---------- رأی (کارت) ---------- */
.cm-votes { display: inline-flex; align-items: center; gap: 2px; margin-inline-start: -6px; }
.cm-votes .cm-vote {
  position: relative; width: 32px; height: 32px; padding: 0; display: grid; place-items: center;
  color: var(--ink-3); background: transparent; border: 0; border-radius: var(--r-sm); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.cm-votes .cm-vote::after { content: ""; position: absolute; inset: -6px -3px; } /* ناحیهٔ لمس ≥ ۴۴px */
.cm-votes .cm-vote svg { width: 17px; height: 17px; }
.cm-votes .cm-vote:hover { background: var(--surface-3); color: var(--ink); }
.cm-votes .cm-vote:active { transform: scale(0.9); }
.cm-votes .cm-vote[data-v="1"][aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft-2); }
.cm-votes .cm-vote[data-v="-1"][aria-pressed="true"] { color: var(--danger); background: var(--danger-soft); }
.cm-votes .cm-vote:disabled { opacity: 0.5; cursor: default; }
.cm-score { min-width: 2.2ch; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- حالت‌های لود / خالی / خطا ---------- */
.cm-state { margin-top: 8px; }
.cm-skeleton-grid { display: grid; gap: 22px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .cm-skeleton-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 18px; } }
@media (min-width: 1020px) { .cm-skeleton-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; } }
.cm-sk { display: flex; flex-direction: column; gap: 10px; }
.cm-sk i {
  display: block; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: cm-shimmer 1.4s linear infinite;
}
.cm-sk i:nth-child(1) { aspect-ratio: 16 / 9; }
.cm-sk i:nth-child(2) { height: 14px; width: 85%; }
.cm-sk i:nth-child(3) { height: 14px; width: 40%; }
@keyframes cm-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.cm-empty, .cm-error {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: clamp(36px, 8vw, 64px) 20px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
}
.cm-empty-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 6px; color: var(--accent-ink);
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 50%;
}
.cm-empty-icon svg { width: 26px; height: 26px; }
.cm-empty h2, .cm-error h2 { margin: 0; font-size: 17px; font-weight: 800; }
.cm-empty p, .cm-error p { margin: 0 0 8px; max-width: 34em; font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }
.cm-error { border-color: var(--danger-line); }
.cm-more-wrap { display: flex; justify-content: center; margin-top: 28px; }
.cm-noscript { color: var(--ink-3); font-size: 13px; }

/* ---------- دیالوگ ارسال ---------- */
.cm-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: var(--overlay); overscroll-behavior: contain;
}
.cm-overlay[hidden] { display: none; }
.cm-dialog {
  width: 100%; max-width: 520px; max-height: min(92vh, 92dvh); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-3);
  outline: none; animation: cm-pop 0.2s ease;
}
@keyframes cm-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.cm-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 8px; }
.cm-dialog-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.cm-dialog-scroll { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.cm-login-note {
  margin: 4px 0 12px; padding: 10px 14px; font-size: 13px; line-height: 1.9; color: var(--ink);
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-md);
}
.cm-login-note a { color: var(--accent-ink); font-weight: 700; }
.cm-howto { margin: 0 0 14px; padding: 0 20px 0 0; font-size: 13px; color: var(--ink-2); line-height: 2; }
.cm-field { display: block; margin-bottom: 12px; }
.cm-field > span { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cm-field em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.cm-field input {
  width: 100%; height: 44px; padding: 0 12px; font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--field-bg); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
.cm-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.cm-field input[dir="ltr"] { text-align: left; }
.cm-form-note { margin: 4px 0 12px; font-size: 12.5px; color: var(--ink-3); line-height: 1.9; }
.cm-form-error {
  margin: 0 0 12px; padding: 9px 12px; font-size: 13px; line-height: 1.8; color: var(--danger);
  background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: var(--r-sm);
}
.cm-form-error[hidden] { display: none; }
.cm-form-ok { color: var(--success); background: var(--accent-soft); border-color: var(--accent-line); }
.cm-dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cm-dialog-actions .cm-btn-primary { flex: 1 1 auto; }
.cm-mine { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.cm-mine h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; }
.cm-mine ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cm-mine li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.cm-mine li .t { min-width: 0; overflow-wrap: anywhere; flex: 1 1 160px; }
.cm-mine .why { flex-basis: 100%; font-size: 12px; color: var(--ink-3); }
.cm-badge {
  flex: none; padding: 2px 10px; font-size: 11.5px; font-weight: 700; color: var(--ink-2);
  background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-pill);
}
.cm-badge.ok { color: var(--success); background: var(--accent-soft); border-color: var(--accent-line); }
.cm-badge.no { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }

/* ---------- صفحهٔ ویدیو ---------- */
.cm-main-watch { max-width: 1040px; padding-top: clamp(16px, 3vw, 28px); }
.cm-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-bottom: 14px; padding: 0 14px 0 12px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
}
.cm-back:hover { color: var(--ink); background: var(--surface-3); }
.cm-back svg { width: 16px; height: 16px; }

.cm-player {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000;
  border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.cm-player iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; background: #000; }
.cm-player-busy { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: #000; }
.cm-player-busy[hidden], .cm-player-error[hidden] { display: none; }
.cm-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.28); border-top-color: #fff; animation: cm-spin 0.8s linear infinite;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }
.cm-player-error {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 20px; text-align: center; color: #fff; background: rgba(5, 12, 9, 0.86);
}
.cm-player-error p { margin: 0; max-width: 28em; font-size: 14px; line-height: 1.9; }
.cm-player-error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cm-player-error .cm-btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.cm-player-error .cm-btn-outline:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }

.cm-aparat-hint { margin: 8px 2px 0; font-size: 12.5px; color: var(--ink-3); }
.cm-aparat-hint a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.cm-aparat-hint a:hover { text-decoration: underline; }
.cm-watch-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; padding: 16px 2px 0; }
.cm-watch-title { flex: 1 1 280px; min-width: 0; margin: 0; font-size: clamp(18px, 2.8vw, 24px); font-weight: 800; line-height: 1.7; overflow-wrap: anywhere; }
.cm-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-act {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.cm-act::after { content: ""; position: absolute; inset: -3px; }
.cm-act svg { width: 18px; height: 18px; flex: none; }
.cm-act:hover { background: var(--surface-3); color: var(--ink); }
.cm-act:active { transform: scale(0.96); }
.cm-act:disabled { opacity: 0.55; cursor: default; }
.cm-act-icon { width: 40px; padding: 0; justify-content: center; }
.cm-act .cm-n { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.cm-act.cm-vote[data-v="1"][aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft-2); border-color: var(--accent-line); }
.cm-act.cm-vote[data-v="-1"][aria-pressed="true"] { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }

.cm-empty-page { text-align: center; padding: clamp(56px, 12vw, 120px) 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cm-empty-page h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); font-weight: 800; }
.cm-empty-page p { margin: 0 0 8px; color: var(--ink-2); font-size: 14.5px; }

/* ---------- اعلان کوچک (toast) ---------- */
.cm-toast-region {
  position: fixed; inset: auto 0 22px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px; pointer-events: none;
}
.cm-toast {
  max-width: min(92vw, 440px); padding: 11px 18px; font-size: 13.5px; line-height: 1.8; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-3);
  animation: cm-pop 0.2s ease; pointer-events: auto;
}
.cm-toast a { color: var(--accent-ink); font-weight: 700; }
.cm-toast.err { border-color: var(--danger-line); }

/* ---------- موبایل ---------- */
@media (max-width: 520px) {
  .cm-main { padding-inline: 14px; }
  .cm-head .cm-btn { width: 100%; }
  .cm-grid { gap: 20px 12px; }
  .cm-vtitle { font-size: 13.5px; }
  .cm-watch-bar { gap: 12px; }
  .cm-actions { width: 100%; }
  .cm-act { padding: 0 13px; }
  .cm-overlay { align-items: end; padding: 0; }
  .cm-dialog { max-width: none; border-radius: 20px 20px 0 0; max-height: 94dvh; }
}

/* فول‌اسکرین: خود ویدیو پر می‌شه */
.cm-player:fullscreen, .cm-player:-webkit-full-screen { border-radius: 0; border: 0; aspect-ratio: auto; width: 100%; height: 100%; }
