/* ============================================================
   استایل ویجت‌های اضافه طرهان وب
   ============================================================ */

/* ── ویجت اخبار فانتزی ── */
.tw-fn-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; }

.tw-fn-card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  transition: transform .28s ease, box-shadow .28s ease;
}
.tw-fn-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,.26); }

.tw-fn-img-wrap {
  position: relative;
  overflow: hidden;
  display: block;
}
.tw-fn-img { width: 100%; display: block; object-fit: cover; transition: transform .4s; }
.tw-fn-card:hover .tw-fn-img { transform: scale(1.05); }
.tw-fn-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.6) 0%, transparent 60%);
  pointer-events: none;
}
.tw-fn-cat-badge {
  position: absolute; top: 10px; right: 10px;
  z-index: 2;
}

.tw-fn-body { padding: 12px 14px; }
.tw-fn-title {
  font-size: 13.5px; font-weight: 800; line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tw-fn-title a { text-decoration: none; color: inherit; }
.tw-fn-title a:hover { opacity: .85; }
.tw-fn-excerpt {
  font-size: 12px; line-height: 1.7; opacity: .8; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tw-fn-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tw-fn-meta { font-size: 11px; opacity: .7; }
.tw-fn-more-btn {
  margin-right: auto;
  padding: 4px 12px; border-radius: 99px;
  font-size: 11px; font-weight: 700; color: #fff; text-decoration: none;
  transition: opacity .2s;
}
.tw-fn-more-btn:hover { opacity: .85; color: #fff; }

/* ── ویجت اخبار متحرک عمودی ── */
@keyframes twTickerScroll {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.tw-ticker-wrap { position: relative; overflow: hidden; }
.tw-ticker-list { padding: 0; list-style: none; }
.tw-ticker-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid rgba(0,0,0,.06);
}
.tw-ticker-bullet {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 4px;
}
.tw-ticker-link {
  font-size: 13px; font-weight: 600; line-height: 1.5;
  text-decoration: none; flex: 1; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tw-ticker-link:hover { text-decoration: underline; }
.tw-ticker-time {
  font-size: 10px; color: var(--muted);
  white-space: nowrap; flex-shrink: 0;
}

/* ── ویجت آپارات ── */
.tw-aparat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tw-aparat-item { }
.tw-aparat-thumb-wrap {
  display: block; position: relative;
  border-radius: 8px; overflow: hidden;
  aspect-ratio: 16/9;
  background: #000;
}
.tw-aparat-thumb { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tw-aparat-thumb-wrap:hover .tw-aparat-thumb { transform: scale(1.05); }
.tw-aparat-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.4);
  font-size: 22px; color: #fff;
  opacity: 0; transition: opacity .25s;
}
.tw-aparat-thumb-wrap:hover .tw-aparat-play { opacity: 1; }
.tw-aparat-title { font-size: 11px; font-weight: 600; margin-top: 5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tw-aparat-title a { color: var(--text); text-decoration: none; }
.tw-aparat-title a:hover { color: var(--primary); }

/* ── ویجت پرمخاطب پیشرفته ── */
.tw-pop-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px; border-bottom: 1px solid var(--bg);
  transition: background .18s;
}
.tw-pop-item:last-child { border: 0; }
.tw-pop-item:hover { background: var(--bg); border-radius: 8px; }
.tw-pop-rank {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 7px; font-size: 12px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.tw-pop-thumb-wrap { flex-shrink: 0; }
.tw-pop-thumb { width: 50px; height: 42px; object-fit: cover; border-radius: 6px; display: block; }
.tw-pop-body { flex: 1; min-width: 0; }
.tw-pop-title {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  text-decoration: none; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tw-pop-title:hover { color: var(--primary); }
.tw-pop-bar-wrap {
  height: 5px; background: var(--bg); border-radius: 99px;
  overflow: hidden; margin-top: 4px;
}
.tw-pop-bar { height: 100%; border-radius: 99px; transition: width .5s ease; }
.tw-pop-views { font-size: 10px; color: var(--muted); display: block; margin-top: 2px; }

/* ── امتیازدهی ── */
.tw-rating-wrap {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.tw-rating-title { font-size: 13px; font-weight: 800; color: var(--dark); }
.tw-stars { display: flex; gap: 4px; direction: ltr; }
.tw-star {
  font-size: 26px; cursor: pointer; transition: transform .15s;
  color: #d1d5db; /* خاکستری */
  line-height: 1;
  user-select: none;
}
.tw-star.active, .tw-star.hover { color: #f59e0b; transform: scale(1.15); }
.tw-star:hover ~ .tw-star { color: #d1d5db !important; }
.tw-rating-score {
  font-size: 22px; font-weight: 900; color: var(--primary);
  display: flex; align-items: center; gap: 4px;
}
.tw-rating-score-small { font-size: 12px; color: var(--muted); font-weight: 400; }
.tw-rating-voted-msg { font-size: 12px; color: var(--accent); font-weight: 700; }

/* ── گالری تصاویر در پست ── */
.tw-gallery-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 16px 0;
}
.tw-gallery-item {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: pointer;
  position: relative;
}
.tw-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tw-gallery-item:hover img { transform: scale(1.06); }
.tw-gallery-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; opacity: 0; transition: opacity .25s;
}
.tw-gallery-item:hover .tw-gallery-overlay { opacity: 1; }

/* Lightbox گالری */
.tw-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.tw-lightbox img {
  max-width: 94vw; max-height: 90vh; object-fit: contain;
  border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.tw-lightbox-close {
  position: absolute; top: 16px; left: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  font-size: 20px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tw-lightbox-prev, .tw-lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  font-size: 20px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.tw-lightbox-prev:hover, .tw-lightbox-next:hover { background: rgba(255,255,255,.3); }
.tw-lightbox-prev { right: 16px; }
.tw-lightbox-next { left: 16px; }
.tw-lightbox-caption {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; font-weight: 600;
  background: rgba(0,0,0,.5); padding: 6px 16px; border-radius: 99px;
}

/* پلیر ویدئو */
.tw-video-player-wrap {
  position: relative; width: 100%; border-radius: 12px; overflow: hidden;
  background: #000; margin-bottom: 16px;
  aspect-ratio: 16/9;
}
.tw-video-player-wrap video,
.tw-video-player-wrap iframe {
  width: 100%; height: 100%; display: block;
}

/* تاریخ انتشار */
.tw-publish-date {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
  background: var(--bg);
}
.tw-publish-date-label { font-weight: 700; color: var(--text); }

@media (max-width: 768px) {
  .tw-fn-list { padding: 8px; gap: 8px; }
  .tw-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .tw-aparat-grid { grid-template-columns: 1fr 1fr; }
  .tw-rating-wrap { gap: 10px; }
  .tw-star { font-size: 22px; }
}
@media (max-width: 480px) {
  .tw-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .tw-aparat-grid { grid-template-columns: 1fr; }
}

