/* ============================================================
   FaraTvModule CSS — هم‌شکل با geo/slideshow/newsticker/content-module.css.
   همه‌چیز زیر .faratv-module اسکوپ شده، متغیرها با پیشوند ftv- نام‌گذاری شده‌اند.
   ============================================================ */

.faratv-module {
  --ftv-c-bg: #f5f5f3;
  --ftv-c-surface: #ffffff;
  --ftv-c-border: rgba(0,0,0,0.08);
  --ftv-c-border-strong: rgba(0,0,0,0.14);
  --ftv-c-text: #1a1a18;
  --ftv-c-text-2: #5a5a56;
  --ftv-c-text-3: #9a9994;
  --ftv-c-accent: #2563eb;
  --ftv-c-accent-bg: #eff6ff;
  --ftv-c-accent-text: #1d4ed8;
  --ftv-c-accent-border: #bfdbfe;
  --ftv-c-success: #16a34a;
  --ftv-c-success-bg: #f0fdf4;
  --ftv-c-success-text: #15803d;
  --ftv-c-success-border: #bbf7d0;
  --ftv-c-warning: #d97706;
  --ftv-c-warning-bg: #fffbeb;
  --ftv-c-warning-text: #b45309;
  --ftv-c-warning-border: #fde68a;
  --ftv-c-danger: #dc2626;
  --ftv-c-danger-bg: #fef2f2;
  --ftv-c-danger-text: #b91c1c;
  --ftv-c-danger-border: #fecaca;
  --ftv-radius-sm: 6px;
  --ftv-radius: 10px;
  --ftv-radius-lg: 14px;
  --ftv-transition: 0.15s ease;

  font-family: 'Vazirmatn', system-ui, sans-serif;
  color: var(--ftv-c-text);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

[data-theme="dark"] .faratv-module {
  --ftv-c-bg: #15161a;
  --ftv-c-surface: #1c1d22;
  --ftv-c-border: rgba(255,255,255,0.08);
  --ftv-c-border-strong: rgba(255,255,255,0.14);
  --ftv-c-text: #f1f1ef;
  --ftv-c-text-2: #b3b3ad;
  --ftv-c-text-3: #76766f;
  --ftv-c-accent-bg: rgba(37,99,235,0.14);
  --ftv-c-success-bg: rgba(22,163,74,0.14);
  --ftv-c-warning-bg: rgba(217,119,6,0.14);
  --ftv-c-danger-bg: rgba(220,38,38,0.14);
}

.faratv-module * { box-sizing: border-box; }

/* ── Page header ── */
.ftv-page-hdr { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.ftv-page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.ftv-page-desc { font-size: 13px; color: var(--ftv-c-text-3); margin-top: 3px; }

/* ── Buttons ── */
.ftv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; height: 34px;
  border-radius: var(--ftv-radius-sm);
  border: 1px solid var(--ftv-c-border-strong);
  background: var(--ftv-c-surface);
  color: var(--ftv-c-text);
  font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background var(--ftv-transition), border-color var(--ftv-transition);
  white-space: nowrap;
}
.ftv-btn:hover { background: var(--ftv-c-bg); }
.ftv-btn i { font-size: 14px; }
.ftv-btn-primary { background: var(--ftv-c-accent); border-color: var(--ftv-c-accent); color: #fff; }
.ftv-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ── Card / table ── */
.ftv-card { background: var(--ftv-c-surface); border: 1px solid var(--ftv-c-border); border-radius: var(--ftv-radius-lg); overflow: hidden; }
.ftv-mb-16 { margin-bottom: 16px; }
.ftv-card-hdr { padding: 14px 16px; border-bottom: 1px solid var(--ftv-c-border); }
.ftv-card-title { font-size: 14px; font-weight: 600; }
.ftv-tbl-wrap { overflow-x: auto; }

table.ftv-tbl { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
table.ftv-tbl th { text-align: right; padding: 10px 14px; color: var(--ftv-c-text-3); font-weight: 600; font-size: 11px; border-bottom: 1px solid var(--ftv-c-border); background: var(--ftv-c-bg); letter-spacing: 0.02em; }
table.ftv-tbl td { padding: 11px 14px; border-bottom: 1px solid var(--ftv-c-border); color: var(--ftv-c-text); vertical-align: middle; }
table.ftv-tbl tr:last-child td { border-bottom: none; }
table.ftv-tbl tr:hover td { background: var(--ftv-c-bg); }
.ftv-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }

/* ── Badge ── */
.ftv-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.ftv-badge i { font-size: 11px; }
.ftv-b-success { background: var(--ftv-c-success-bg); color: var(--ftv-c-success-text); border-color: var(--ftv-c-success-border); }
.ftv-b-warning { background: var(--ftv-c-warning-bg); color: var(--ftv-c-warning-text); border-color: var(--ftv-c-warning-border); }

/* ── Tabs ── */
.ftv-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--ftv-c-border); margin-bottom: 20px; overflow-x: auto; }
.ftv-tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--ftv-c-text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--ftv-transition), border-color var(--ftv-transition); }
.ftv-tab:hover { color: var(--ftv-c-text); }
.ftv-tab.active { color: var(--ftv-c-accent); border-bottom-color: var(--ftv-c-accent); }

/* ── Form ── */
.ftv-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ftv-field { display: flex; flex-direction: column; gap: 5px; }
.ftv-field label { font-size: 11px; font-weight: 600; color: var(--ftv-c-text-2); letter-spacing: 0.02em; }
.ftv-field input, .ftv-field select { height: 36px; border: 1px solid var(--ftv-c-border-strong); border-radius: var(--ftv-radius-sm); padding: 0 11px; font-size: 13px; background: var(--ftv-c-surface); color: var(--ftv-c-text); font-family: inherit; outline: none; transition: border-color var(--ftv-transition), box-shadow var(--ftv-transition); }
.ftv-field input:focus, .ftv-field select:focus { border-color: var(--ftv-c-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.ftv-form-preview { width: 90px; height: 60px; object-fit: cover; border-radius: 6px; margin-top: 8px; }
.ftv-hint { font-size: 11px; color: var(--ftv-c-text-3); margin-top: 4px; }
.ftv-form-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--ftv-c-border); }

/* ── Row action buttons ── */
td.ftv-row-actions { white-space: nowrap; }
.ftv-row-act-btn { width: 27px; height: 27px; border: 1px solid var(--ftv-c-border); background: var(--ftv-c-surface); border-radius: var(--ftv-radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--ftv-c-text-2); cursor: pointer; margin-inline-start: 4px; transition: background var(--ftv-transition), border-color var(--ftv-transition), color var(--ftv-transition); }
.ftv-row-act-btn:first-child { margin-inline-start: 0; }
.ftv-row-act-btn i { font-size: 14px; }
.ftv-row-act-btn:hover { background: var(--ftv-c-accent-bg); border-color: var(--ftv-c-accent-border); color: var(--ftv-c-accent); }
.ftv-row-act-btn.danger:hover { background: var(--ftv-c-danger-bg); border-color: var(--ftv-c-danger-border); color: var(--ftv-c-danger); }

/* ── Toast ── */
.ftv-toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.ftv-toast { display: flex; align-items: center; gap: 10px; background: var(--ftv-c-text); color: #fff; padding: 12px 16px; border-radius: var(--ftv-radius); font-size: 13px; font-weight: 500; cursor: pointer; animation: ftvSlideUp 0.25s ease; }
.ftv-toast i { font-size: 16px; }
@keyframes ftvSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Modal ── */
.ftv-modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,15,14,0.5); z-index: 10000; align-items: center; justify-content: center; padding: 20px; }
.ftv-modal-backdrop.open { display: flex; animation: ftvFadeIn 0.15s ease; }
@keyframes ftvFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ftv-modal-box { width: 100%; max-width: 600px; background: var(--ftv-c-surface); border-radius: var(--ftv-radius-lg); border: 1px solid var(--ftv-c-border); box-shadow: 0 24px 64px rgba(0,0,0,0.32); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; animation: ftvModalPop 0.18s ease; }
@keyframes ftvModalPop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.ftv-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--ftv-c-border); flex-shrink: 0; }
.ftv-modal-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ftv-modal-close { width: 30px; height: 30px; border: none; background: var(--ftv-c-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ftv-c-text-2); cursor: pointer; flex-shrink: 0; }
.ftv-modal-close:hover { background: var(--ftv-c-border); color: var(--ftv-c-text); }
.ftv-modal-body { padding: 20px; overflow-y: auto; }

.ftv-confirm-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--ftv-c-danger-bg); color: var(--ftv-c-danger); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.ftv-confirm-icon i { font-size: 26px; }
.ftv-confirm-text { text-align: center; font-size: 13px; color: var(--ftv-c-text-2); line-height: 1.7; margin-bottom: 4px; }
.ftv-modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.ftv-modal-actions .ftv-btn { flex: 1; justify-content: center; }

/* ── Toolbar ── */
.ftv-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--ftv-c-border); flex-wrap: wrap; }
.ftv-search-box { display: flex; align-items: center; gap: 8px; background: var(--ftv-c-bg); border: 1px solid var(--ftv-c-border); border-radius: var(--ftv-radius-sm); padding: 0 10px; height: 34px; flex: 1; min-width: 180px; transition: border-color var(--ftv-transition); }
.ftv-search-box:focus-within { border-color: var(--ftv-c-accent); }
.ftv-search-box i { font-size: 15px; color: var(--ftv-c-text-3); flex-shrink: 0; }
.ftv-search-box input { border: none; outline: none; background: transparent; font-family: inherit; font-size: 12.5px; color: var(--ftv-c-text); width: 100%; height: 100%; }
.ftv-search-box input::placeholder { color: var(--ftv-c-text-3); }

/* ── Skeleton loading ── */
.ftv-skeleton { padding: 6px 14px; }
.ftv-skeleton-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--ftv-c-border); }
.ftv-skeleton-row:last-child { border-bottom: none; }
.ftv-skeleton-cell { height: 13px; border-radius: 4px; flex: 1; background: linear-gradient(90deg, var(--ftv-c-bg) 25%, var(--ftv-c-border) 37%, var(--ftv-c-bg) 63%); background-size: 400% 100%; animation: ftvShimmer 1.4s ease infinite; }
.ftv-skeleton-cell.narrow { flex: 0.4; }
@keyframes ftvShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── Empty state ── */
.ftv-empty { text-align: center; padding: 40px 20px; color: var(--ftv-c-text-3); }
.ftv-empty i { font-size: 34px; margin-bottom: 10px; display: block; opacity: 0.4; }
.ftv-empty p { font-size: 13px; margin-bottom: 12px; }

/* ── Hub page (public landing) ── */
.ftv-hub-banner { background: linear-gradient(120deg, var(--ftv-c-accent-bg), var(--ftv-c-surface)); height: 40px; border-radius: 8px; margin: 10px 0 20px; }
.ftv-hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 700px; margin: 0 auto 20px; }
.ftv-hub-card { border-radius: var(--ftv-radius-lg); text-align: center; padding: 14px; background: var(--ftv-c-accent-bg); cursor: pointer; transition: transform var(--ftv-transition); }
.ftv-hub-card:hover { transform: translateY(-2px); }
.ftv-hub-card img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.ftv-hub-card button { background: var(--ftv-c-accent); border: none; border-radius: 20px; color: #fff; padding: 6px 16px; font-size: 12px; cursor: pointer; font-family: inherit; }
.ftv-render-body { max-width: 700px; margin: 0 auto; }

/* ── Explorer (category → media browser) ── */
.ftv-explorer-list { display: flex; flex-direction: column; gap: 8px; }
.ftv-explorer-item { display: flex; align-items: center; gap: 10px; background: var(--ftv-c-bg); border-radius: var(--ftv-radius); padding: 8px 12px; cursor: pointer; transition: background var(--ftv-transition); }
.ftv-explorer-item:hover { background: var(--ftv-c-accent-bg); }
.ftv-explorer-item img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; }
.ftv-explorer-item span { flex: 1; font-weight: 500; }
.ftv-explorer-item i { color: var(--ftv-c-text-3); }

.ftv-media-group { margin-bottom: 18px; }
.ftv-media-group h4, .ftv-media-group-title { font-weight: 600; font-size: 13px; margin-bottom: 10px; border-bottom: 1px solid var(--ftv-c-border); padding-bottom: 6px; color: var(--ftv-c-text-2); }
.ftv-media-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.ftv-media-row.wrap { flex-wrap: wrap; overflow-x: visible; }
.ftv-media-card { flex: 0 0 auto; width: 120px; border-radius: var(--ftv-radius); background: var(--ftv-c-bg); padding: 6px; cursor: pointer; text-align: center; transition: transform var(--ftv-transition); }
.ftv-media-card:hover { transform: translateY(-3px); }
.ftv-media-card img { width: 100%; height: 76px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.ftv-media-card div { font-size: 11px; color: var(--ftv-c-text-2); }
.ftv-more-btn { flex: 0 0 auto; align-self: center; background: var(--ftv-c-surface); border: 1px solid var(--ftv-c-border-strong); border-radius: var(--ftv-radius-sm); padding: 6px 12px; font-size: 11px; cursor: pointer; }

.ftv-player { margin-top: 16px; padding: 14px; background: var(--ftv-c-bg); border-radius: var(--ftv-radius); text-align: center; }
.ftv-player h5 { margin: 0 0 8px; font-size: 13px; }
.ftv-player audio { width: 100%; margin-bottom: 8px; }

/* ── Submit form (user upload) ── */
.ftv-uploader { display: flex; flex-direction: column; gap: 12px; }
.ftv-upload-section { background: var(--ftv-c-bg); border: 1px solid var(--ftv-c-border); border-radius: var(--ftv-radius); padding: 12px; }
.ftv-upload-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--ftv-c-accent-text); display: flex; align-items: center; gap: 6px; }

/* Drag & Drop zone */
.ftv-dropzone { transition: background var(--ftv-transition), border-color var(--ftv-transition); }
.ftv-dropzone.drag { background: var(--ftv-c-accent-bg); border-color: var(--ftv-c-accent); border-style: dashed; }
.ftv-dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1.5px dashed var(--ftv-c-border-strong); border-radius: var(--ftv-radius-sm); text-align: center; }
.ftv-dropzone-inner i { font-size: 26px; color: var(--ftv-c-text-3); }
.ftv-dropzone-inner p { margin: 0; font-size: 12px; color: var(--ftv-c-text-3); }
.ftv-dropzone.drag .ftv-dropzone-inner { border-color: var(--ftv-c-accent); color: var(--ftv-c-accent-text); }

.ftv-hidden-input { display: none; }
.ftv-upload-errors { display: flex; flex-direction: column; gap: 6px; }
.ftv-upload-error { display: flex; justify-content: space-between; align-items: center; background: var(--ftv-c-danger-bg); color: var(--ftv-c-danger-text); border-radius: var(--ftv-radius-sm); padding: 6px 10px; font-size: 12px; }
.ftv-upload-error button { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; }
.ftv-upload-list { display: flex; flex-direction: column; gap: 8px; }
.ftv-upload-item { background: var(--ftv-c-surface); border: 1px solid var(--ftv-c-border); border-radius: var(--ftv-radius-sm); padding: 8px 10px; }
.ftv-upload-item-name { font-size: 12px; margin-bottom: 6px; }
.ftv-upload-item-size { color: var(--ftv-c-text-3); }
.ftv-progress-wrap { height: 6px; background: var(--ftv-c-bg); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.ftv-progress-bar { height: 100%; background: var(--ftv-c-accent); transition: width 0.3s ease; }
.ftv-upload-item-actions { display: flex; justify-content: flex-end; }
.ftv-upload-success { text-align: center; color: var(--ftv-c-success-text); font-weight: 600; font-size: 12px; margin-top: 8px; }

@media (max-width: 720px) {
  .ftv-toolbar { padding: 10px 12px; }
  .ftv-search-box { min-width: 0; }
  .ftv-modal-backdrop { padding: 0; align-items: flex-end; }
  .ftv-modal-box { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: ftvSheetUp 0.22s ease; }
  @keyframes ftvSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .ftv-modal-body { padding: 16px; }
  .ftv-page-hdr { flex-direction: column; align-items: stretch; gap: 12px; }
  .ftv-form-grid { grid-template-columns: 1fr; }
  td.ftv-row-actions { display: flex !important; justify-content: flex-start !important; gap: 6px; }
  .ftv-toast-wrap { bottom: 12px; left: 12px; right: 12px; }
  .ftv-toast { width: 100%; }
  .ftv-hub-grid { grid-template-columns: repeat(2, 1fr); max-width: 100%; }
}
