/* ============================================================
   SlideShowModule CSS
   دقیقاً هم‌شکل با geo-module.css (همان متغیرها، همان اسکلت بصری) تا همه‌ی
   ماژول‌های Faradanesh یک UX یکسان داشته باشند. همه‌چیز زیر .slideshow-module
   اسکوپ شده و متغیرها با پیشوند ss- نام‌گذاری شده‌اند.
   ============================================================ */

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

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

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

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

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

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

.ss-btn-primary {
  background: var(--ss-c-accent);
  border-color: var(--ss-c-accent);
  color: #fff;
}
.ss-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ── Card / table ── */
.ss-card {
  background: var(--ss-c-surface);
  border: 1px solid var(--ss-c-border);
  border-radius: var(--ss-radius-lg);
  overflow: hidden;
}
.ss-mb-16 { margin-bottom: 16px; }
.ss-tbl-wrap { overflow-x: auto; }

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

table.ss-tbl th.sortable { cursor: pointer; user-select: none; }
table.ss-tbl th.sortable:hover { color: var(--ss-c-text-2); }
table.ss-tbl th.sortable .sort-ico { font-size: 12px; margin-inline-start: 3px; vertical-align: -1px; opacity: 0.35; }
table.ss-tbl th.sortable.active .sort-ico { opacity: 1; color: var(--ss-c-accent); }

/* ── Badge ── */
.ss-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;
}
.ss-badge i { font-size: 11px; }
.ss-b-success { background: var(--ss-c-success-bg); color: var(--ss-c-success-text); border-color: var(--ss-c-success-border); }
.ss-b-warning { background: var(--ss-c-warning-bg); color: var(--ss-c-warning-text); border-color: var(--ss-c-warning-border); }
.ss-b-danger  { background: var(--ss-c-danger-bg);  color: var(--ss-c-danger-text);  border-color: var(--ss-c-danger-border); }
.ss-b-accent  { background: var(--ss-c-accent-bg);  color: var(--ss-c-accent-text);  border-color: var(--ss-c-accent-border); }

/* ── Form ── */
.ss-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ss-field { display: flex; flex-direction: column; gap: 5px; }
.ss-field label { font-size: 11px; font-weight: 600; color: var(--ss-c-text-2); letter-spacing: 0.02em; }

.ss-field input, .ss-field select, .ss-field textarea {
  height: 36px;
  border: 1px solid var(--ss-c-border-strong);
  border-radius: var(--ss-radius-sm);
  padding: 0 11px;
  font-size: 13px;
  background: var(--ss-c-surface);
  color: var(--ss-c-text);
  font-family: inherit;
  outline: none;
  transition: border-color var(--ss-transition), box-shadow var(--ss-transition);
}
.ss-field input:focus, .ss-field select:focus, .ss-field textarea:focus {
  border-color: var(--ss-c-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.ss-field input::placeholder { color: var(--ss-c-text-3); }

.ss-form-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--ss-c-border); }

.ss-required { color: var(--ss-c-danger); }
.ss-hint { font-size: 11px; color: var(--ss-c-text-3); }

.ss-schedule-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--ss-c-surface-2); border: 1px solid var(--ss-c-border); border-radius: var(--ss-radius-sm);
  padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--ss-c-text-2); cursor: pointer; font-family: inherit;
}
.ss-schedule-toggle:hover { background: var(--ss-c-bg); }
.ss-schedule-toggle i { font-size: 14px; }

/* ── فرم دو‌ستونه با پیش‌نمایش زنده (بازطراحی ۲۴ اوت ۲۰۲۶) ── */
.ss-form-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; align-items: start; }
.ss-form-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ss-form-preview { position: sticky; top: 0; }
.ss-preview-label {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  color: var(--ss-c-text-3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em;
}
.ss-preview-label i { font-size: 13px; }
.ss-preview-frame {
  border-radius: var(--ss-radius-lg); overflow: hidden; border: 1px solid var(--ss-c-border);
  aspect-ratio: 21 / 9; background: var(--ss-c-bg);
}
.ss-preview-frame .ss-slide { position: relative; width: 100%; height: 100%; }
@media (max-width: 860px) {
  .ss-form-layout { grid-template-columns: 1fr; }
  .ss-form-preview { position: static; }
  .ss-preview-frame { aspect-ratio: 16 / 9; }
}

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

/* ── Table: thumbnail, subtitle, reorder, switch (جدول مدیریت، بازطراحی ۲۴ اوت ۲۰۲۶) ── */
.ss-tbl-thumb {
  width: 64px; height: 40px; border-radius: var(--ss-radius-sm); overflow: hidden;
  background: var(--ss-c-bg); border: 1px solid var(--ss-c-border);
}
.ss-tbl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ss-tbl-thumb-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--ss-c-text-3); }
.ss-tbl-thumb-empty i { font-size: 16px; }
.ss-tbl-subtitle { font-size: 11px; color: var(--ss-c-text-3); margin-top: 2px; }

.ss-reorder { display: flex; align-items: center; gap: 4px; }
.ss-reorder span { min-width: 16px; text-align: center; font-weight: 600; }
.ss-reorder-btn {
  width: 20px; height: 20px; border: 1px solid var(--ss-c-border); background: var(--ss-c-surface);
  border-radius: 5px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--ss-c-text-2);
}
.ss-reorder-btn i { font-size: 12px; }
.ss-reorder-btn:hover:not(:disabled) { background: var(--ss-c-accent-bg); color: var(--ss-c-accent); border-color: var(--ss-c-accent-border); }
.ss-reorder-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.ss-switch { position: relative; display: inline-block; width: 32px; height: 18px; margin-inline-end: 6px; vertical-align: middle; cursor: pointer; }
.ss-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.ss-switch-track {
  position: absolute; inset: 0; background: var(--ss-c-border-strong); border-radius: 20px; transition: background var(--ss-transition);
}
.ss-switch-track::before {
  content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; border-radius: 50%;
  background: #fff; transition: transform var(--ss-transition); box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.ss-switch input:checked + .ss-switch-track { background: var(--ss-c-success); }
.ss-switch input:checked + .ss-switch-track::before { transform: translateX(-14px); }

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

/* ── Modal ── */
.ss-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;
}
.ss-modal-backdrop.open { display: flex; animation: ssFadeIn 0.15s ease; }
@keyframes ssFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ss-modal-box {
  width: 100%; max-width: 640px;
  background: var(--ss-c-surface);
  border-radius: var(--ss-radius-lg);
  border: 1px solid var(--ss-c-border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.32);
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: ssModalPop 0.18s ease;
}
.ss-modal-box:has(.ss-form-layout) { max-width: 900px; }
@keyframes ssModalPop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.ss-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--ss-c-border); flex-shrink: 0;
}
.ss-modal-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ss-modal-close {
  width: 30px; height: 30px; border: none; background: var(--ss-c-bg);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--ss-c-text-2); cursor: pointer; flex-shrink: 0;
}
.ss-modal-close:hover { background: var(--ss-c-border); color: var(--ss-c-text); }
.ss-modal-body { padding: 20px; overflow-y: auto; }

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

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

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

/* ── Empty state ── */
.ss-empty { text-align: center; padding: 48px 20px; color: var(--ss-c-text-3); }
.ss-empty i { font-size: 38px; margin-bottom: 12px; display: block; opacity: 0.4; }
.ss-empty p { font-size: 13px; margin-bottom: 16px; }
.ss-empty .ss-btn { display: inline-flex; }

/* ── Public carousel (dashboard) — بازطراحی کامل ۲۴ اوت ۲۰۲۶ ──
   بنر تمام‌عرض هیرو با تصویر پس‌زمینه (نه یک آیکن ۸۰ پیکسلی کنار متن)، گرادیانِ خوانایی،
   عنوان/زیرعنوان/دکمه، ناوبری با لمس/کیبورد، و نشانگرهای پیشرفت به‌سبک استوری. */
.ss-carousel-host {
  position: relative; width: 100%; aspect-ratio: 21 / 9; border-radius: var(--ss-radius-lg);
  overflow: hidden; touch-action: pan-y; outline: none; background: var(--ss-c-bg);
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
}
.ss-carousel-host:focus-visible { box-shadow: 0 0 0 3px var(--ss-c-accent), 0 8px 28px rgba(0,0,0,0.12); }

.ss-carousel-track { position: relative; width: 100%; height: 100%; }
.ss-item {
  position: absolute; inset: 0; width: 100%; height: 100%; cursor: default;
  opacity: 0; visibility: hidden; transition: opacity 0.5s ease;
  z-index: 1;
}
.ss-item.active { opacity: 1; visibility: visible; z-index: 2; }
.ss-item.clickable { cursor: pointer; }

/* یک اسلاید تنها (SlideShowSlideView) — تصویر کامل + گرادیان + کپشن */
.ss-slide { position: relative; width: 100%; height: 100%; overflow: hidden; }
.ss-slide-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.ss-slide-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.32) 42%, rgba(0,0,0,0) 72%);
  pointer-events: none;
}
.ss-slide-caption {
  position: absolute; inset-inline: 0; bottom: 0; padding: 22px 26px 30px; color: #fff;
  display: flex; flex-direction: column; gap: 6px; max-width: 640px;
}
.ss-slide-title { font-size: clamp(16px, 2.6vw, 26px); font-weight: 700; line-height: 1.35; text-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.ss-slide-subtitle { font-size: clamp(11.5px, 1.4vw, 14px); color: rgba(255,255,255,0.88); line-height: 1.6; }
.ss-slide-cta {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; width: fit-content;
  background: #fff; color: #16171b; font-size: 12.5px; font-weight: 700;
  padding: 8px 16px; border-radius: 30px; transition: transform var(--ss-transition), box-shadow var(--ss-transition);
}
.ss-item.clickable:hover .ss-slide-cta { transform: translateX(-3px); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.ss-slide-cta i { font-size: 13px; }

.ss-carousel-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(20,20,22,0.38); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; z-index: 3; font-size: 17px;
  opacity: 0; transition: opacity var(--ss-transition), background var(--ss-transition);
}
.ss-carousel-host:hover .ss-carousel-nav, .ss-carousel-host:focus-within .ss-carousel-nav { opacity: 1; }
.ss-carousel-nav:hover { background: rgba(20,20,22,0.6); }
.ss-carousel-nav.prev { right: 12px; }
.ss-carousel-nav.next { left: 12px; }

/* نشانگرهای پیشرفت به‌سبک استوری — هر بخش، زمان باقی‌مانده تا اسلاید بعدی را واقعاً پر می‌کند */
.ss-progress-row {
  position: absolute; top: 12px; inset-inline: 14px; z-index: 3;
  display: flex; gap: 5px;
}
.ss-progress-seg {
  flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.32); overflow: hidden;
  border: none; padding: 0; cursor: pointer;
}
.ss-progress-fill { display: block; height: 100%; width: 0; background: #fff; border-radius: 3px; }
.ss-progress-fill.filled { width: 100%; }
.ss-progress-fill.running { animation: ssProgressFill linear forwards; animation-duration: 6000ms; }
@keyframes ssProgressFill { from { width: 0; } to { width: 100%; } }

@media (max-width: 640px) {
  .ss-carousel-host { aspect-ratio: 4 / 3; border-radius: var(--ss-radius); }
  .ss-slide-caption { padding: 16px 16px 20px; }
  .ss-carousel-nav { width: 32px; height: 32px; font-size: 15px; opacity: 1; }
  .ss-progress-row { top: 10px; inset-inline: 10px; }
}

@media (max-width: 720px) {
  .ss-toolbar { padding: 10px 12px; }
  .ss-search-box { min-width: 0; }

  .ss-modal-backdrop { padding: 0; align-items: flex-end; }
  .ss-modal-box {
    max-width: 100% !important; max-height: 92vh;
    border-radius: 18px 18px 0 0;
    animation: ssSheetUp 0.22s ease;
  }
  @keyframes ssSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .ss-modal-body { padding: 16px; }

  .ss-page-hdr { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .ss-page-hdr > div[style*="display:flex"] { flex-wrap: wrap; }
  .ss-page-hdr > div[style*="display:flex"] .ss-btn { flex: 1; justify-content: center; }

  .ss-form-grid { grid-template-columns: 1fr; }

  td.ss-row-actions { display: flex !important; justify-content: flex-start !important; gap: 6px; }

  .ss-toast-wrap { bottom: 12px; left: 12px; right: 12px; }
  .ss-toast { width: 100%; }
}
