/**
 * ==============================================================================
 * نرم افزار: سافتما سی ام اس اسکیولایت (SOFTMA CMS SQLITE)
 * سازنده: softma.ir | ایمیل: softma.ir@gmail.com | همراه: 09106310989
 * 
 * استایل‌های اصلی فرانت‌اند (قالب سایت) - کاملاً راست‌چین و بدون وابستگی خارجی
 * ==============================================================================
 */

/* متغیرهای رنگی و استایل سیستم */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --font-stack: system-ui, -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* بازنشانی و پایه‌های اولیه */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  direction: rtl;
  text-align: right;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-stack);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

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

/* لایه‌بندی اصلی و کانتینر */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* هدر سایت */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ناوبری اصلی */
.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 18px;
  align-items: center;
}

.nav-links a {
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-form {
  display: flex;
  align-items: center;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: var(--bg-body);
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* بخش بنر و معرفی بالای صفحه اصلی */
.hero-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  padding: 40px 0;
  margin-bottom: 30px;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow-md);
}

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.hero-desc {
  font-size: 1.05rem;
  opacity: 0.92;
  line-height: 1.7;
}

/* بدنه و چیدمان اصلی ۲ ستونه */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  margin-bottom: 50px;
  flex: 1;
}

.content-area {
  min-width: 0;
}

.sidebar-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ابزارک‌های سایدبار */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  color: var(--text-main);
  position: relative;
}

.widget-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 40px;
  height: 2px;
  background: var(--primary);
}

.category-list {
  list-style: none;
}

.category-list li {
  margin-bottom: 8px;
}

.category-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  padding: 6px 8px;
  border-radius: 6px;
}

.category-list a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.badge {
  background: var(--bg-body);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
}

/* کارت‌های پست در صفحه اصلی */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.post-thumb {
  height: 190px;
  background: #e2e8f0;
  overflow: hidden;
  position: relative;
}

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card:hover .post-thumb img {
  transform: scale(1.04);
}

.post-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.post-category-tag {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}

.post-title a {
  color: var(--text-main);
}

.post-title a:hover {
  color: var(--primary);
}

.post-excerpt {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
  flex: 1;
}

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

/* صفحه تک نوشته (Single Post) و برگه (Single Page) */
.article-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.article-header {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

.article-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 14px;
  line-height: 1.4;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  flex-wrap: wrap;
}

.article-featured-image {
  margin-bottom: 24px;
  border-radius: 8px;
  overflow: hidden;
}

.article-content {
  font-size: 1.05rem;
  line-height: 2;
  color: #334155;
}

.article-content p {
  margin-bottom: 16px;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 28px;
  margin-bottom: 14px;
  color: var(--text-main);
}

.article-content ul,
.article-content ol {
  margin: 16px 28px;
}

.article-content li {
  margin-bottom: 6px;
}

.article-content audio,
.article-content video {
  width: 100%;
  max-width: 100%;
  margin: 16px 0;
  border-radius: 8px;
}

.article-tags {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-item {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 14px;
  transition: all 0.2s;
}

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

/* بخش نظرات (دیدگاه‌ها) */
.comments-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.comments-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.comment-item {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 700;
  color: var(--text-main);
}

.comment-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.comment-body {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.7;
}

/* فرم ارسال نظر */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* فوتر سایت */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 40px 0 20px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-col h3 {
  color: #f8fafc;
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.footer-col p {
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
}

.footer-bottom a {
  color: #38bdf8;
}

.footer-bottom a:hover {
  text-decoration: underline;
}

/* دکمه منو موبایل */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-main);
}

/* واکنش‌گرایی و مدیاکوئری برای موبایل‌ها */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 14px;
  }

  .site-nav.open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .search-form {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .hero-banner {
    padding: 24px 0;
  }

  .hero-title {
    font-size: 1.4rem;
  }

  .article-box,
  .comments-section {
    padding: 20px;
  }

  .article-title {
    font-size: 1.4rem;
  }
}
