/* blog/static/blog/css/blog.css */

/* ============================================
   فونت‌های فارسی (با اولویت Vazir)
   ============================================ */
   @font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir.eot');
    src: url('../fonts/Vazir.eot?#iefix') format('embedded-opentype'),
         url('../fonts/Vazir.woff2') format('woff2'),
         url('../fonts/Vazir.woff') format('woff'),
         url('../fonts/Vazir.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Bold.eot');
    src: url('../fonts/Vazir-Bold.eot?#iefix') format('embedded-opentype'),
         url('../fonts/Vazir-Bold.woff2') format('woff2'),
         url('../fonts/Vazir-Bold.woff') format('woff'),
         url('../fonts/Vazir-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   استایل‌های پایه صفحه وبلاگ
   ============================================ */
body {
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* ============================================
   محتوای CKEditor 5
   ============================================ */

/* کانتینر اصلی محتوای CKEditor */
.ck-content,
.prose,
.blog-content {
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
    line-height: 1.8;
    color: #2c3e50;
    font-size: 16px;
}

/* استایل‌های تیترها */
.ck-content h1,
.prose h1,
.blog-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1.5rem 0 1rem;
    color: #1a202c;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.5rem;
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
}

.ck-content h2,
.prose h2,
.blog-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 1.3rem 0 1rem;
    color: #2c3e50;
    border-right: 4px solid #3498db;
    padding-right: 1rem;
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
}

.ck-content h3,
.prose h3,
.blog-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.2rem 0 0.8rem;
    color: #34495e;
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
}

.ck-content h4,
.prose h4,
.blog-content h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 1rem 0 0.7rem;
    color: #7f8c8d;
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
}

/* پاراگراف‌ها */
.ck-content p,
.prose p,
.blog-content p {
    margin-bottom: 1.2rem;
    text-align: justify;
    line-height: 1.8;
}

/* استایل‌های متن */
.ck-content strong,
.prose strong {
    font-weight: 700;
    color: #2c3e50;
}

.ck-content em,
.prose em {
    font-style: italic;
    color: #7f8c8d;
}

.ck-content u,
.prose u {
    text-decoration: underline;
}

.ck-content s,
.prose s {
    text-decoration: line-through;
}

.ck-content code,
.prose code {
    background-color: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e74c3c;
    direction: ltr;
    display: inline-block;
}

.ck-content pre,
.prose pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    direction: ltr;
    text-align: left;
}

.ck-content pre code,
.prose pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* لیست‌ها */
.ck-content ul,
.prose ul {
    list-style-type: disc;
    margin: 1rem 0 1rem 1.5rem;
    padding-right: 1.5rem;
}

.ck-content ol,
.prose ol {
    list-style-type: decimal;
    margin: 1rem 0 1rem 1.5rem;
    padding-right: 1.5rem;
}

.ck-content li,
.prose li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ck-content .todo-list,
.prose .todo-list {
    list-style: none;
    padding-right: 0;
}

.ck-content .todo-list li,
.prose .todo-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ck-content .todo-list .todo-list__label > input,
.prose .todo-list .todo-list__label > input {
    margin-left: 0.5rem;
}

/* بلوک نقل قول */
.ck-content blockquote,
.prose blockquote {
    background-color: #f8f9fa;
    border-right: 4px solid #3498db;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #555;
    position: relative;
}

.ck-content blockquote::before,
.prose blockquote::before {
    content: '"';
    font-size: 3rem;
    color: #3498db;
    opacity: 0.3;
    position: absolute;
    right: 0.5rem;
    top: -1rem;
}

/* جداول */
.ck-content table,
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    direction: rtl;
}

.ck-content table th,
.ck-content table td,
.prose table th,
.prose table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: right;
}

.ck-content table th,
.prose table th {
    background-color: #f2f2f2;
    font-weight: 600;
    color: #2c3e50;
}

.ck-content table tr:nth-child(even),
.prose table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ck-content table tr:hover,
.prose table tr:hover {
    background-color: #f5f5f5;
}

/* تصاویر */
.ck-content .image,
.prose .image {
    margin: 1.5rem 0;
    text-align: center;
}

.ck-content .image img,
.prose .image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ck-content .image-style-align-left,
.prose .image-style-align-left {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    max-width: 50%;
}

.ck-content .image-style-align-right,
.prose .image-style-align-right {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    max-width: 50%;
}

.ck-content .image-style-align-center,
.prose .image-style-align-center {
    margin: 0 auto;
    text-align: center;
}

.ck-content .image > figcaption,
.prose .image > figcaption {
    font-size: 0.875rem;
    color: #7f8c8d;
    text-align: center;
    margin-top: 0.5rem;
}

/* لینک‌ها */
.ck-content a,
.prose a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.ck-content a:hover,
.prose a:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

/* مدیا امبد (ویدیوها) */
.ck-content .media,
.prose .media {
    margin: 1.5rem 0;
    text-align: center;
}

.ck-content .media iframe,
.prose .media iframe {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* دکمه منبع‌یابی */
.ck-content .source-editing,
.prose .source-editing {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    font-family: monospace;
}

/* ============================================
   استایل‌های اختصاصی دکمه‌های فرمت CKEditor
   ============================================ */

/* استایل دکمه‌های toolbar */
.ck.ck-editor__main .ck-toolbar {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
    padding: 0.5rem;
}

.ck.ck-editor__main .ck-toolbar .ck-button {
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
}

.ck.ck-editor__main .ck-toolbar .ck-button:hover {
    background-color: #e9ecef;
}

.ck.ck-editor__main .ck-toolbar .ck-on {
    background-color: #3498db;
    color: white;
}

/* فاصله دار کردن ابزارها برای نمایش بهتر */
.ck.ck-toolbar .ck.ck-toolbar__items {
    gap: 0.25rem;
}

/* استایل dropdown فونت‌ها */
.ck.ck-dropdown .ck-dropdown__panel {
    max-height: 300px;
    overflow-y: auto;
}

.ck.ck-dropdown .ck-list__item {
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
    direction: rtl;
    text-align: right;
    padding: 0.5rem 1rem;
}

/* استایل رنگ متن و پس‌زمینه */
.ck-content .text-color-red { color: #e74c3c; }
.ck-content .text-color-blue { color: #3498db; }
.ck-content .text-color-green { color: #27ae60; }
.ck-content .text-color-orange { color: #e67e22; }
.ck-content .text-color-purple { color: #9b59b6; }

.ck-content .bg-color-yellow { background-color: #fff3cd; }
.ck-content .bg-color-gray { background-color: #f8f9fa; }
.ck-content .bg-color-blue { background-color: #d1ecf1; }
.ck-content .bg-color-green { background-color: #d4edda; }

/* ============================================
   استایل‌های کارت مقالات (Blog Card)
   ============================================ */
.blog-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.blog-card .blog-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image {
    transform: scale(1.05);
}

.blog-card .blog-card-content {
    padding: 1.25rem;
}

.blog-card .blog-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2c3e50;
    line-height: 1.4;
}

.blog-card .blog-card-title a {
    color: inherit;
    text-decoration: none;
}

.blog-card .blog-card-title a:hover {
    color: #3498db;
}

.blog-card .blog-card-summary {
    color: #7f8c8d;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.blog-card .blog-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #95a5a6;
    padding-top: 0.75rem;
    border-top: 1px solid #ecf0f1;
}

/* ============================================
   استایل‌های صفحه اصلی وبلاگ
   ============================================ */

/* Hero section */
.blog-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
}

.blog-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Sidebar filters */
.blog-filters-sidebar {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 1rem;
}

.blog-filters-sidebar h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.filter-category-item {
    display: block;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.filter-category-item:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

.filter-category-item.active {
    background-color: #3498db;
    color: white;
}

.filter-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    background-color: #ecf0f1;
    border-radius: 20px;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.filter-tag:hover,
.filter-tag.active {
    background-color: #3498db;
    color: white;
}

/* پاگینیشن */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.blog-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: #3498db;
    transition: all 0.3s ease;
}

.blog-pagination .page-link:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.blog-pagination .page-link.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* ============================================
   استایل‌های صفحه نمایش مقاله
   ============================================ */

/* Breadcrumb */
.blog-breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

.blog-breadcrumb a {
    color: #7f8c8d;
    text-decoration: none;
}

.blog-breadcrumb a:hover {
    color: #3498db;
}

.blog-breadcrumb .separator {
    color: #bdc3c7;
    margin: 0 0.5rem;
}

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

.article-header .article-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #7f8c8d;
    font-size: 0.875rem;
}

.article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Article categories & tags */
.article-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.article-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e8f4fd;
    color: #3498db;
    border-radius: 20px;
    font-size: 0.75rem;
    text-decoration: none;
}

.article-category:hover {
    background-color: #3498db;
    color: white;
}

.article-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #f0f0f0;
    color: #666;
    border-radius: 20px;
    font-size: 0.75rem;
    text-decoration: none;
}

.article-tag:hover {
    background-color: #666;
    color: white;
}

/* Featured image */
.article-featured-image {
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Article summary box */
.article-summary {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-right: 4px solid #3498db;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.article-summary p {
    margin: 0;
    font-size: 1.125rem;
    color: #555;
    line-height: 1.6;
}

/* Share buttons */
.article-share {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem 0;
    margin: 2rem 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.share-button:hover {
    opacity: 0.8;
}

.share-button.twitter { background-color: #1da1f2; }
.share-button.linkedin { background-color: #0077b5; }
.share-button.email { background-color: #6c757d; }

/* Related posts */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #ecf0f1;
}

.related-posts h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

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

/* ============================================
   استایل‌های ریسپانسیو
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .ck-content h1,
    .prose h1,
    .blog-content h1,
    .article-header .article-title {
        font-size: 1.75rem;
    }
    
    .ck-content h2,
    .prose h2,
    .blog-content h2 {
        font-size: 1.5rem;
    }
    
    .ck-content h3,
    .prose h3,
    .blog-content h3 {
        font-size: 1.25rem;
    }
    
    .blog-hero h1 {
        font-size: 1.75rem;
    }
    
    .blog-filters-sidebar {
        position: static;
        margin-bottom: 1.5rem;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .ck-content .image-style-align-left,
    .ck-content .image-style-align-right,
    .prose .image-style-align-left,
    .prose .image-style-align-right {
        float: none;
        margin: 1rem auto;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .article-share {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .share-buttons {
        flex-wrap: wrap;
    }
    
    .blog-pagination {
        flex-wrap: wrap;
    }
}

/* ============================================
   انیمیشن‌ها و افکت‌ها
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-card,
.article-content {
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   استایل‌های اضافی برای CKEditor
   ============================================ */

/* نمایش بهتر اعداد در لیست‌های فارسی */
.ck-content ol,
.prose ol {
    direction: rtl;
}

.ck-content ol li::marker,
.prose ol li::marker {
    content: counter(list-item) ".";
    font-weight: bold;
}

/* فاصله مناسب بین عناصر در موبایل */
@media (max-width: 640px) {
    .ck-content,
    .prose,
    .blog-content {
        font-size: 14px;
    }
    
    .ck-content p,
    .prose p,
    .blog-content p {
        line-height: 1.6;
    }
}

/* برای حالت RTL - عکس در چپ و متن در راست */
.blog-card-horizontal .flex {
    direction: rtr; /* موقتاً direction را چپ می‌کنیم */
}

.blog-card-horizontal .md\:w-1\/3 {
    order: 1; /* عکس اول */
}

.blog-card-horizontal .md\:w-2\/3 {
    order: 2; /* متن دوم */
}

/* محتوای داخلی را RTL می‌کنیم */
.blog-card-horizontal .p-6 {
    direction: rtl;
    text-align: right;
}

/* ریسپانسیو برای موبایل */
@media (max-width: 768px) {
    .blog-card-horizontal .flex {
        flex-direction: column;
    }
    
    .blog-card-horizontal .md\:w-1\/3,
    .blog-card-horizontal .md\:w-2\/3 {
        order: 0;
    }
}

