/* ==========================================================================
   RECART NEWS PORTAL - LUXURY STYLING SYSTEM
   Typography: Peyda (Headlines) + IRANSansX (Body)
   ========================================================================== */

@font-face {
  font-family: 'Peyda';
  src: url('../fonts/PeydaWebFaNum-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Peyda';
  src: url('../fonts/PeydaWebFaNum-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'IRANSansX';
  src: url('../fonts/IRANSansXFaNum-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'IRANSansX';
  src: url('../fonts/IRANSansXFaNum-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --font-heading: 'Peyda', system-ui, -apple-system, sans-serif;
  --font-body: 'IRANSansX', system-ui, -apple-system, sans-serif;
  
  /* Light Theme Variables */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-subtle: #e2e8f0;
  
  --border-color: #e2e8f0;
  --border-focus: #0284c7;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --brand-primary: #0284c7;
  --brand-hover: #0369a1;
  --brand-glow: rgba(2, 132, 199, 0.15);
  
  --cat-tech: #0ea5e9;
  --cat-ai: #8b5cf6;
  --cat-economy: #10b981;
  --cat-world: #f59e0b;
  --cat-media: #ec4899;
  --cat-iran: #ef4444;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --container-width: 1280px;
  --header-height: 72px;
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #0f172a;
  --bg-card: #131d33;
  --bg-muted: #1e293b;
  --bg-subtle: #334155;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --brand-primary: #38bdf8;
  --brand-hover: #7dd3fc;
  --brand-glow: rgba(56, 189, 248, 0.2);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.7);
}

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

html {
  font-family: var(--font-body);
  direction: rtl;
  text-align: right;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #0284c7);
  width: 0%;
  z-index: 9999;
  transition: width 0.1s ease;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-svg {
  height: 40px;
  width: auto;
}

.brand-name {
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--brand-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* ==========================================================================
   BREAKING TICKER
   ========================================================================== */

.ticker-bar {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  overflow: hidden;
}

.ticker-inner {
  display: flex;
  align-items: center;
  height: 40px;
}

.ticker-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #ef4444;
  color: #fff;
  padding: 0.25rem 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-left: 1rem;
}

.ticker-pulse {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

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

.ticker-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
}

.ticker-scroll {
  display: flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: tickerSlide 40s linear infinite;
  gap: 2.5rem;
}

.ticker-scroll:hover {
  animation-play-state: paused;
}

.ticker-item {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ticker-item:hover {
  color: var(--brand-primary);
}

@keyframes tickerSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(50%); }
}

/* ==========================================================================
   HERO & FEATURED SECTION
   ========================================================================== */

.hero-section {
  padding: 2rem 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 1.5rem;
}

.hero-main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  min-height: 440px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-main-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.hero-main:hover .hero-main-img {
  transform: scale(1.03);
}

.hero-main-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 20%, rgba(9, 13, 22, 0.95) 90%);
}

.hero-main-content {
  position: relative;
  z-index: 2;
  padding: 2rem;
  color: #fff;
}

.hero-main-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0.6rem 0;
  color: #fff;
}

.hero-side-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-side-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.hero-side-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

.hero-side-thumb {
  width: 100px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.hero-side-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-side-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   SECTION TITLES & BADGES
   ========================================================================== */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}

.section-more {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.badge-tech { background: rgba(14, 165, 233, 0.15); color: #0284c7; }
.badge-ai { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.badge-economy { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-world { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-media { background: rgba(236, 72, 153, 0.15); color: #db2777; }
.badge-iran { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

[data-theme="dark"] .badge-tech { color: #38bdf8; }
[data-theme="dark"] .badge-ai { color: #a78bfa; }
[data-theme="dark"] .badge-economy { color: #34d399; }
[data-theme="dark"] .badge-world { color: #fbbf24; }
[data-theme="dark"] .badge-media { color: #f472b6; }
[data-theme="dark"] .badge-iran { color: #f87171; }

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   ARTICLE CARDS & GRIDS
   ========================================================================== */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.news-card-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 ratio */
  overflow: hidden;
  background: var(--bg-muted);
}

.news-card-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.news-card:hover .news-card-thumb {
  transform: scale(1.05);
}

.news-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.news-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0.6rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-snippet {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   SINGLE ARTICLE FULL VIEW
   ========================================================================== */

.single-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.article-title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.article-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.tool-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.article-lead {
  font-size: 1.15rem;
  line-height: 1.8;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-card);
  border-right: 4px solid var(--brand-primary);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.article-featured-img-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.article-featured-img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}

.article-img-caption {
  padding: 0.5rem 1rem;
  background: var(--bg-muted);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-content {
  font-size: 1.1rem;
  line-height: 2;
  color: var(--text-primary);
  transition: font-size 0.2s ease;
}

.article-content[data-size="sm"] { font-size: 0.95rem; line-height: 1.8; }
.article-content[data-size="md"] { font-size: 1.1rem; line-height: 2; }
.article-content[data-size="lg"] { font-size: 1.25rem; line-height: 2.1; }

.article-content p {
  margin-bottom: 1.5rem;
  text-align: justify;
}

.article-content h2, .article-content h3 {
  font-family: var(--font-heading);
  margin: 2rem 0 1rem;
  color: var(--text-primary);
}

.article-content blockquote {
  border-right: 4px solid var(--brand-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-tags-wrap {
  margin: 2.5rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.tag-badge:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.article-source-box {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
}

.share-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.share-telegram { background: #229ed9; }
.share-x { background: #000; }
.share-copy { background: #475569; }

/* ==========================================================================
   SEARCH & FILTERS
   ========================================================================== */

.search-page-box {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  font-family: inherit;
  font-size: 1.1rem;
  background: var(--bg-muted);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--brand-primary);
}

.search-icon-pos {
  position: absolute;
  right: 1rem;
  color: var(--text-muted);
}

.search-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.filter-select {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg-muted);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 3.5rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .header-nav {
    display: none;
  }
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .article-title {
    font-size: 1.5rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}
