* { box-sizing: border-box; }

body {
  font-family: Tahoma, Vazirmatn, IRANSans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.20), transparent 28rem),
    linear-gradient(135deg, #08111f 0%, #0f172a 48%, #111827 100%);
  color: #f8fafc;
  margin: 0;
  min-height: 100vh;
  padding: 22px;
}

.container { max-width: 1120px; margin: auto; }

header {
  text-align: center;
  margin-bottom: 28px;
  padding: 24px 16px;
}

header h1 {
  margin: 0 0 18px;
  font-size: clamp(25px, 5vw, 42px);
  letter-spacing: -1px;
}

#url-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  max-width: 760px;
  margin: 0 auto;
}

input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.88);
  color: white;
  outline: none;
  font-size: 15px;
}

input:focus { border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18); }

button, .yt-link {
  padding: 12px 18px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

button:hover, .yt-link:hover { transform: translateY(-1px); background: #2563eb; }
button:disabled { opacity: 0.6; cursor: wait; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.processing-strip {
  grid-column: 1 / -1;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.24);
}

.strip-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: #bfdbfe;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 0 rgba(56, 189, 248, 0.7);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.processing-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.processing-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 12px;
}

.processing-title {
  font-size: 14px;
  line-height: 1.8;
  color: #f8fafc;
  font-weight: 700;
}

.processing-item small { color: #cbd5e1; line-height: 1.7; }

.card {
  background: rgba(30, 41, 59, 0.92);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.18);
  transition: 0.25s ease;
  box-shadow: 0 16px 34px rgba(2, 6, 23, 0.25);
}

.card:hover { transform: translateY(-5px); border-color: #60a5fa; box-shadow: 0 22px 48px rgba(2, 6, 23, 0.34); }
.card.is-read { opacity: 0.72; }
.card.is-unread { border-color: rgba(59, 130, 246, 0.38); }

.thumb-wrap { position: relative; height: 156px; background: #0f172a; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(2, 6, 23, 0.60), transparent 58%);
}

.status-badge, .read-badge, .read-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge { color: #06111f; }
.status-done { background: #86efac; }
.status-processing { background: #7dd3fc; }
.status-queued { background: #fde68a; }
.status-failed { background: #fca5a5; }

.read-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.thumb-wrap .status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.read-badge.is-read, .read-pill.is-read { background: rgba(148, 163, 184, 0.88); color: #0f172a; }
.read-badge.is-unread, .read-pill.is-unread { background: #3b82f6; color: #fff; }

.card-content { padding: 16px; }
.video-title {
  font-size: 15.5px;
  line-height: 1.9;
  margin: 0 0 10px;
  color: #f8fafc;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-stage {
  min-height: 46px;
  margin: 0 0 14px;
  color: #cbd5e1;
  line-height: 1.8;
  font-size: 13px;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rating { color: #facc15; font-size: 13px; letter-spacing: 1px; }
.mark-read-btn {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.35);
  font-size: 12px;
}

.hidden { display: none !important; }
.back-btn { margin: 0 0 20px; background: #475569; }

#detail-container { max-width: 980px; }
.loading-state, .error-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  color: #cbd5e1;
}
.empty-icon { font-size: 42px; margin-bottom: 8px; }

.detail-hero {
  display: grid;
  grid-template-columns: minmax(220px, 330px) 1fr;
  gap: 22px;
  align-items: stretch;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 20px 55px rgba(2, 6, 23, 0.32);
}

.detail-thumb {
  width: 100%;
  min-height: 190px;
  border-radius: 16px;
  object-fit: cover;
  background: #0f172a;
}

.detail-hero-body { display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.detail-badges, .detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-hero h2 { margin: 0; font-size: clamp(21px, 4vw, 32px); line-height: 1.75; letter-spacing: -0.5px; }
.detail-stage { margin: 0; color: #cbd5e1; line-height: 1.9; }
.secondary-btn { background: #1d4ed8; }
.yt-link { background: #ef4444; }
.yt-link:hover { background: #dc2626; }

.detail-section { margin-top: 22px; }
.detail-section h3 {
  margin: 0 0 12px;
  color: #bfdbfe;
  font-size: 18px;
}

.detail-box {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 20px;
  color: #e2e8f0;
  line-height: 2.15;
  font-size: 15.5px;
}

.readable-text { max-width: 80ch; margin-inline: auto; }
.readable-text h4, .reason-line h4 {
  color: #f8fafc;
  font-size: 17px;
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.readable-text h4:first-child { margin-top: 0; }
.readable-text p, .reason-line p { margin: 0 0 12px; }
.readable-text ul, .reason-line ul { margin: 8px 0 16px; padding: 0 22px 0 0; }
.readable-text li, .reason-line li { margin: 8px 0; padding-right: 4px; }
.readable-text strong, .reason-line strong { color: #93c5fd; }
.rating-line { color: #facc15; margin-bottom: 12px; }

@media (max-width: 720px) {
  body { padding: 14px; }
  #url-form { flex-direction: column; }
  #url-form input, #url-form button { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-thumb { min-height: 170px; }
  .detail-box { padding: 16px; font-size: 15px; line-height: 2.05; }
}
