/* ============================================================
   زیستگاه مُدرن v3 — طراحی حرفه‌ای مجله علمی-پژوهشی
   الهام از مجلات دانشگاهی معتبر + ظاهر مدرن و معتبر
   ============================================================ */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --primary: #1b4d3e;
  --primary-dark: #0f3329;
  --primary-light: #2d6b56;
  --accent: #c9a227;
  --accent-light: #e8d48b;
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --border: #e0dbd0;
  --sidebar-bg: #f0ede6;
  --header-h: 0;
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  --font-en: 'Georgia', 'Times New Roman', serif;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
h1,h2,h3,h4 { font-weight: 700; line-height: 1.4; margin: 0 0 .6em; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ========== TOP BAR ========== */
.top-bar {
  background: var(--primary-dark);
  color: #c8ddd4;
  font-size: 0.8rem;
  padding: 6px 0;
}
.top-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.top-bar a { color: #c8ddd4; }
.top-bar a:hover { color: #fff; }

/* ========== HEADER ========== */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 0;
  border-bottom: 4px solid var(--accent);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  flex-wrap: wrap;
}
.header-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 4px;
  flex-shrink: 0;
}
.header-logo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
}
.header-titles { flex: 1; min-width: 200px; }
.header-titles h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.header-titles .en-title {
  font-family: var(--font-en);
  font-size: 0.95rem;
  opacity: .85;
  margin-top: 2px;
  direction: ltr;
  text-align: right;
}
.header-titles .slogan {
  font-size: 0.82rem;
  opacity: .75;
  margin-top: 4px;
  font-weight: 400;
}
.header-meta {
  text-align: left;
  font-size: 0.78rem;
  opacity: .8;
  direction: ltr;
  line-height: 1.6;
}

/* ========== NAV ========== */
.main-nav {
  background: var(--primary-dark);
  border-top: 1px solid rgba(255,255,255,.1);
}
.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.main-nav a {
  display: block;
  padding: 10px 16px;
  color: #d4e8df;
  font-size: 0.88rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all .2s;
}
.main-nav a:hover, .main-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-bottom-color: var(--accent);
}

/* ========== LAYOUT ========== */
.page-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  padding: 28px 0 40px;
  align-items: start;
}
@media (max-width: 900px) {
  .page-body { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}

/* ========== MAIN CONTENT ========== */
.main-content { min-width: 0; }

.section-title {
  font-size: 1.15rem;
  color: var(--primary);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}

/* Current Issue Banner */
.issue-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.issue-banner .cover {
  width: 110px;
  height: 145px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  flex-shrink: 0;
  background: #e8e4dc;
}
.issue-banner h2 { margin: 0 0 6px; font-size: 1.2rem; color: var(--primary); }
.issue-banner .meta { font-size: 0.85rem; color: var(--text-muted); }

/* Article Card */
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, border-color .2s;
}
.article-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
}
.article-card .cat {
  display: inline-block;
  background: #e8f0ec;
  color: var(--primary);
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
}
.article-card h3 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--primary); }
.article-card .en-title {
  font-family: var(--font-en);
  font-size: 0.88rem;
  color: #666;
  direction: ltr;
  text-align: right;
  margin-bottom: 6px;
}
.article-card .authors { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 6px; }
.article-card .abstract {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.7;
  margin: 8px 0;
}
.article-card .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: #888;
  margin-top: 8px;
  align-items: center;
}
.article-card .doi { direction: ltr; font-family: monospace; font-size: 0.78rem; }
.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.btn-pdf:hover { background: var(--primary-dark); color: #fff !important; }

/* News cards */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.news-card:hover { transform: translateY(-3px); }
.news-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}
.news-card .body { padding: 12px 14px; }
.news-card h4 { font-size: 0.95rem; margin: 0 0 4px; }
.news-card h4 a { color: var(--text); }
.news-card .date { font-size: 0.78rem; color: #999; }

/* ========== SIDEBAR ========== */
.sidebar { position: sticky; top: 16px; }
.side-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.side-box-title {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
}
.side-box-body { padding: 12px 16px; }
.side-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.side-box ul li {
  border-bottom: 1px solid var(--border);
}
.side-box ul li:last-child { border-bottom: none; }
.side-box ul a {
  display: block;
  padding: 8px 0;
  font-size: 0.88rem;
  color: var(--text);
}
.side-box ul a:hover { color: var(--primary); padding-right: 6px; }

/* Stats */
.stats-table { width: 100%; font-size: 0.85rem; }
.stats-table td { padding: 5px 0; border-bottom: 1px solid #eee; }
.stats-table td:last-child { text-align: left; font-weight: 700; color: var(--primary); direction: ltr; }

/* Search box */
.side-search {
  display: flex;
  gap: 0;
}
.side-search input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  border-left: none;
}
.side-search button {
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  font-family: inherit;
}

/* ========== FOOTER ========== */
.site-footer {
  background: var(--primary-dark);
  color: #a8c4b8;
  padding: 36px 0 20px;
  margin-top: 40px;
  font-size: 0.88rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.footer-grid h4 { color: #fff; font-size: 0.95rem; margin-bottom: 10px; }
.footer-grid a { color: #a8c4b8; display: block; padding: 3px 0; }
.footer-grid a:hover { color: var(--accent-light); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 16px;
  text-align: center;
  font-size: 0.8rem;
}

/* ========== ARTICLE PAGE ========== */
.article-full .title { font-size: 1.4rem; color: var(--primary); }
.article-full .en-title { font-family: var(--font-en); font-size: 1.05rem; color: #555; direction: ltr; text-align: right; }
.article-full .meta-bar {
  background: #f0ede6;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin: 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.abstract-box {
  background: #f8f6f0;
  border-right: 4px solid var(--accent);
  padding: 16px 20px;
  margin: 16px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.abstract-box strong { color: var(--primary); }
.pdf-viewer {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pdf-viewer iframe, .pdf-viewer embed, .pdf-viewer object {
  width: 100%;
  height: 700px;
  border: none;
}
.pdf-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .2s;
}
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary) !important;
}
.btn-outline:hover { background: var(--primary); color: #fff !important; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 0.9rem; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,77,62,.12); }

/* ========== UTILS ========== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; }
.alert-success { background: #e8f5e9; color: #1b5e20; }
.alert-error { background: #ffebee; color: #b71c1c; }
.text-muted { color: var(--text-muted); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #c8e6c9; color: #1b5e20; }
.badge-warning { background: #fff9c4; color: #f57f17; }

@media (max-width: 600px) {
  .header-titles h1 { font-size: 1.2rem; }
  .header-logo, .header-logo-placeholder { width: 56px; height: 56px; }
  .issue-banner { flex-direction: column; }
}
