/* ============================================================
   NewsTickerModule CSS
   دقیقاً هم‌شکل با geo-module.css / slideshow-module.css. همه‌چیز زیر
   .newsticker-module اسکوپ شده و متغیرها با پیشوند nt- نام‌گذاری شده‌اند.
   ============================================================ */

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

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

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

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

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

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

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

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

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

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

/* ── Form ── */
.nt-field { display: flex; flex-direction: column; gap: 5px; }
.nt-field label { font-size: 11px; font-weight: 600; color: var(--nt-c-text-2); letter-spacing: 0.02em; }
.nt-field label i { font-size: 12px; }
.nt-field input, .nt-field select, .nt-field textarea {
  border: 1px solid var(--nt-c-border-strong); border-radius: var(--nt-radius-sm); padding: 9px 11px;
  font-size: 13px; background: var(--nt-c-surface); color: var(--nt-c-text); font-family: inherit; outline: none;
  transition: border-color var(--nt-transition), box-shadow var(--nt-transition);
}
.nt-field input, .nt-field select { height: 36px; padding: 0 11px; }
.nt-field textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.nt-field input:focus, .nt-field select:focus, .nt-field textarea:focus { border-color: var(--nt-c-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.nt-form-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--nt-c-border); }
.nt-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nt-required { color: var(--nt-c-danger); }
.nt-hint { font-size: 11px; color: var(--nt-c-text-3); }
.nt-schedule-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--nt-c-bg); border: 1px solid var(--nt-c-border); border-radius: var(--nt-radius-sm);
  padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--nt-c-text-2); cursor: pointer; font-family: inherit;
}
.nt-schedule-toggle:hover { background: var(--nt-c-surface); }
.nt-schedule-toggle i { font-size: 14px; }

/* ── فرم دوستونه با پیش‌نمایش زنده ── */
.nt-form-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 22px; align-items: start; }
.nt-form-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.nt-form-preview { position: sticky; top: 0; }
.nt-preview-label {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  color: var(--nt-c-text-3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em;
}
.nt-preview-label i { font-size: 13px; }
.nt-preview-frame { border-radius: var(--nt-radius-lg); overflow: hidden; border: 1px solid var(--nt-c-border); background: var(--nt-c-bg); padding: 4px; }
@media (max-width: 860px) {
  .nt-form-layout { grid-template-columns: 1fr; }
  .nt-form-preview { position: static; }
}

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

/* ── Table extras: excerpt, pin toggle, quick-visibility switch ── */
.nt-tbl-excerpt { font-size: 11px; color: var(--nt-c-text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.nt-pin-toggle {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--nt-c-border);
  background: var(--nt-c-surface); color: var(--nt-c-text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.nt-pin-toggle i { font-size: 14px; }
.nt-pin-toggle:hover { border-color: var(--nt-c-warning-border); color: var(--nt-c-warning); }
.nt-pin-toggle.active { background: var(--nt-c-warning-bg); border-color: var(--nt-c-warning-border); color: var(--nt-c-warning); }

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

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

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

/* ── مودال «ادامه مطلب» ── */
.nt-detail-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.nt-detail-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--nt-radius); margin-bottom: 14px; }
.nt-detail-body { line-height: 1.9; font-size: 13.5px; color: var(--nt-c-text); white-space: pre-wrap; }

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

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

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

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

/* ── Public ticker (dashboard) — بازطراحی کامل ۲۴ اوت ۲۰۲۶ ──
   کارت‌های اطلاعیه (نه یک بنر تمام‌عرض مثل SlideShow — چون اینجا متن اصل مطلب است)، با
   تصویر/آیکن، دسته‌بندی، سنجاق‌شدن، ناوبری لمسی/کیبورد، و نشانگر پیشرفت به‌سبک استوری. */
.nt-badge-title {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: var(--nt-c-accent-text); background: var(--nt-c-accent-bg); border: 1px solid var(--nt-c-accent-border);
  border-radius: 20px; padding: 5px 14px; margin-bottom: 10px;
}
.nt-badge-title i { font-size: 13px; }

.nt-carousel-host {
  position: relative; width: 100%; border-radius: var(--nt-radius-lg); overflow: hidden;
  touch-action: pan-y; outline: none; background: var(--nt-c-surface); border: 1px solid var(--nt-c-border);
}
.nt-carousel-host:focus-visible { box-shadow: 0 0 0 3px var(--nt-c-accent); }
.nt-carousel-track { position: relative; width: 100%; min-height: 1px; }
.nt-item {
  position: absolute; inset: 0; width: 100%; min-width: 0;
  opacity: 0; visibility: hidden; transition: opacity 0.45s ease; z-index: 1;
}
.nt-item.active { opacity: 1; visibility: visible; z-index: 2; position: relative; }

/* یک کارت تنها (NewsTickerCardView) */
.nt-card-view { display: flex; align-items: flex-start; gap: 14px; padding: 16px 44px 16px 18px; position: relative; }
.nt-card-view.pinned { background: linear-gradient(90deg, var(--nt-c-warning-bg) 0%, transparent 60%); }
.nt-pin-badge {
  position: absolute; top: 12px; inset-inline-end: 14px; color: var(--nt-c-warning); font-size: 15px;
}
.nt-card-thumb { width: 64px; height: 64px; border-radius: var(--nt-radius); overflow: hidden; flex-shrink: 0; background: var(--nt-c-bg); }
.nt-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nt-card-icon {
  width: 64px; height: 64px; border-radius: var(--nt-radius); flex-shrink: 0;
  background: var(--nt-c-accent-bg); color: var(--nt-c-accent); display: flex; align-items: center; justify-content: center;
}
.nt-card-icon i { font-size: 26px; }
.nt-card-body { min-width: 0; flex: 1; }
.nt-card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.nt-cat-badge {
  font-size: 10.5px; font-weight: 700; color: var(--nt-c-accent-text); background: var(--nt-c-accent-bg);
  border-radius: 12px; padding: 2px 9px;
}
.nt-card-date { font-size: 10.5px; color: var(--nt-c-text-3); }
.nt-card-title { font-size: 13.5px; font-weight: 700; color: var(--nt-c-text); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-card-excerpt { font-size: 12px; color: var(--nt-c-text-2); line-height: 1.6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nt-read-more { display: inline-flex; align-items: center; gap: 4px; color: var(--nt-c-accent); cursor: pointer; font-size: 11.5px; font-weight: 700; margin-top: 6px; }
.nt-read-more i { font-size: 11px; }
.nt-read-more:hover { text-decoration: underline; }

.nt-carousel-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%;
  background: var(--nt-c-surface); border: 1px solid var(--nt-c-border); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--nt-c-text-2); z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  opacity: 0; transition: opacity var(--nt-transition), color var(--nt-transition);
}
.nt-carousel-host:hover .nt-carousel-nav, .nt-carousel-host:focus-within .nt-carousel-nav { opacity: 1; }
.nt-carousel-nav:hover { color: var(--nt-c-accent); }
.nt-carousel-nav.prev { right: 6px; }
.nt-carousel-nav.next { left: 6px; }

.nt-progress-row { display: flex; gap: 5px; padding: 0 14px 10px; }
.nt-progress-seg { flex: 1; height: 3px; border-radius: 3px; background: var(--nt-c-border-strong); overflow: hidden; border: none; padding: 0; cursor: pointer; }
.nt-progress-fill { display: block; height: 100%; width: 0; background: var(--nt-c-accent); border-radius: 3px; }
.nt-progress-fill.filled { width: 100%; }
.nt-progress-fill.running { animation: ntProgressFill linear forwards; animation-duration: 7000ms; }
@keyframes ntProgressFill { from { width: 0; } to { width: 100%; } }

@media (max-width: 480px) {
  .nt-card-view { padding: 13px 38px 13px 14px; gap: 10px; }
  .nt-card-thumb, .nt-card-icon { width: 52px; height: 52px; }
}

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

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

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

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

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