/* ==========================================================================
   ZIZ News Portal - Modern Persian Typography & Theme Stylesheet
   ========================================================================== */

:root {
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Dark Theme Colors */
  --bg-body: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --border-color: #30363d;
  --border-subtle: #21262d;
  
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  --accent-red: #f85149;
  --accent-red-bg: rgba(248, 81, 73, 0.15);
  --accent-blue: #58a6ff;
  --accent-blue-bg: rgba(88, 166, 255, 0.12);
  --accent-green: #3fb950;
  --accent-gold: #d29922;

  --telegram-blue: #229ed9;
  --telegram-hover: #1c8ac0;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-mode {
  --bg-body: #f6f8fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4f6;
  --border-color: #d0d7de;
  --border-subtle: #eaeef2;
  
  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8c959f;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Top Announcement Bar */
.top-bar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  padding: 8px 0;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--accent-red);
}

.live-pulse {
  width: 10px;
  height: 10px;
  background-color: var(--accent-red);
  border-radius: 50%;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* Main Navigation */
.main-nav {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.main-nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  gap: 20px;
}

.logo-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-accent {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--accent-blue);
}

.logo-sub {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-red);
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-right: 2px solid var(--border-color);
  padding-right: 12px;
  display: none;
}

@media (min-width: 768px) {
  .brand-tagline { display: inline-block; }
}

.search-box {
  flex: 1;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 40px 10px 36px;
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

.search-icon {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.btn-clear {
  position: absolute;
  left: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.btn-telegram {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--telegram-blue);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 18px;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(34, 158, 217, 0.3);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-telegram:hover {
  background-color: var(--telegram-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 158, 217, 0.45);
}

/* Breaking News Ticker */
.breaking-news-bar {
  background: var(--accent-red-bg);
  border-bottom: 1px solid rgba(248, 81, 73, 0.3);
  padding: 8px 0;
  animation: slide-down 0.3s ease;
}

.breaking-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breaking-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--accent-red);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.breaking-marquee {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Category Filter Bar */
.categories-bar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 0;
}

.tags-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.tags-scroll::-webkit-scrollbar { display: none; }

.tag-chip {
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.tag-chip:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.tag-chip.active {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 2px 8px var(--accent-blue-bg);
}

/* Layout Grid */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  padding-top: 24px;
  padding-bottom: 40px;
}

@media (min-width: 992px) {
  .layout-grid {
    grid-template-columns: 1fr 340px;
  }
}

/* News Feed Section */
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-subtle);
}

.feed-title {
  font-size: 1.3rem;
  font-weight: 800;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#newsCountBadge {
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.sync-indicator {
  color: var(--accent-green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* News Cards */
.news-stream {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.news-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md);
}

.news-card.new-highlight {
  animation: flash-highlight 2s ease;
}

@keyframes flash-highlight {
  0% { border-color: var(--accent-green); box-shadow: 0 0 15px rgba(63, 185, 80, 0.4); }
  100% { border-color: var(--border-color); box-shadow: var(--shadow-sm); }
}

.news-card.is-breaking {
  border-right: 4px solid var(--accent-red);
}

.news-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--accent-blue);
}

.badge-tag.tag-breaking {
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.card-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.news-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.5;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.news-title a:hover {
  color: var(--accent-blue);
}

.news-media {
  margin: 14px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.news-media img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.news-media img:hover {
  transform: scale(1.02);
}

.news-media video {
  width: 100%;
  max-height: 480px;
  display: block;
}

.news-body {
  font-size: 0.98rem;
  color: var(--text-primary);
  line-height: 1.8;
  word-break: break-word;
}

.news-body b, .news-body strong {
  font-weight: 700;
  color: #ffffff;
}

body.light-mode .news-body b, body.light-mode .news-body strong {
  color: #000000;
}

.news-body a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.news-body a:hover {
  color: var(--accent-red);
}

.news-body blockquote {
  border-right: 3px solid var(--accent-blue);
  padding: 6px 14px;
  margin: 10px 0;
  background: var(--accent-blue-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}

.news-body code {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  direction: ltr;
  display: inline-block;
}

.news-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-card-action {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-card-action:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

/* Sidebar Cards */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Channel Card */
.channel-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.channel-avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--telegram-blue), #0f588c);
  color: #fff;
  font-weight: 900;
  font-size: 1.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(34, 158, 217, 0.35);
}

.channel-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.channel-badge {
  font-size: 0.75rem;
  color: var(--accent-green);
  font-weight: 600;
}

.channel-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 18px;
}

.btn-join {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--telegram-blue);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 3px 10px rgba(34, 158, 217, 0.3);
  transition: var(--transition);
}

.btn-join:hover {
  background-color: var(--telegram-hover);
  transform: translateY(-2px);
}

/* Highlights List */
.highlights-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.highlight-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.highlight-item:hover {
  border-color: var(--accent-blue);
  transform: translateX(-4px);
}

.highlight-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.5;
}

.highlight-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Stats Card */
.stats-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.88rem;
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-subtle);
}

.stats-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.badge-pill {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.color-success { color: var(--accent-green); }

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.lightbox-close:hover {
  background: var(--accent-red);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #fff;
  border: 1px solid var(--accent-green);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 30px 0;
  margin-top: 40px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-logo {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent-blue);
  letter-spacing: 1px;
}

/* Spinner */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  color: var(--text-secondary);
  gap: 14px;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-card-delete:hover {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

