/* ==========================================================================
   Blog Styles — Digikala-inspired (RTL, white theme)
   ========================================================================== */

/* ---------- Container ---------- */
.blog-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ---------- Breadcrumb ---------- */
.blog-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #81858b;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.blog-breadcrumb a { color: #81858b; transition: color 0.2s; }
.blog-breadcrumb a:hover { color: #ef394e; }
.blog-breadcrumb .sep { color: #c0c2c5; }

/* ---------- Featured slider area ---------- */
.blog-featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}
.blog-featured-main {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    grid-row: span 2;
    min-height: 380px;
}
.blog-featured-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.blog-featured-main .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.75));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
}
.blog-featured-main .overlay h2 {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.8;
    margin: 0 0 8px;
}
.blog-featured-main .overlay p {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
}

.blog-featured-side {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    min-height: 180px;
}
.blog-featured-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.blog-featured-side .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.7));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}
.blog-featured-side .overlay h3 {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.7;
    margin: 0;
}

/* ---------- Category tabs ---------- */
.blog-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f1;
}
.blog-cat-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e0e0e2;
    font-size: 13px;
    font-weight: 700;
    color: #3f4064;
    background: #fff;
    transition: all 0.2s;
    white-space: nowrap;
}
.blog-cat-link:hover,
.blog-cat-link.active {
    background: #ef394e;
    color: #fff;
    border-color: #ef394e;
}
.blog-cat-link .count {
    font-size: 11px;
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 10px;
}
.blog-cat-link.active .count {
    background: rgba(255,255,255,0.2);
}

/* ---------- Post grid ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.blog-card {
    background: #fff;
    border: 1px solid #f0f0f1;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s, transform 0.3s;
    display: flex;
    flex-direction: column;
}
.blog-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}

.blog-card-img {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f0f0f1;
}
.blog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}
.blog-card:hover .blog-card-img img {
    transform: scale(1.05);
}
.blog-card-img .cat-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef394e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
}
.blog-card-img .placeholder-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #c0c2c5;
}

.blog-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.blog-card-body h3 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.8;
    margin: 0 0 8px;
    color: #3f4064;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card-body h3 a {
    color: inherit;
    text-decoration: none;
}
.blog-card-body h3 a:hover { color: #ef394e; }

.blog-card-excerpt {
    font-size: 13px;
    color: #81858b;
    line-height: 1.7;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #a1a3a8;
    padding-top: 12px;
    border-top: 1px solid #f0f0f1;
}
.blog-card-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---------- Sidebar ---------- */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}
.blog-layout-main { min-width: 0; }

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 120px;
}
.blog-sidebar-card {
    background: #fff;
    border: 1px solid #f0f0f1;
    border-radius: 12px;
    padding: 20px;
}
.blog-sidebar-card h4 {
    font-size: 15px;
    font-weight: 700;
    color: #3f4064;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f1;
}
.blog-sidebar-cats {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.blog-sidebar-cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 14px;
    color: #3f4064;
    border-bottom: 1px solid #f0f0f1;
    transition: color 0.2s;
}
.blog-sidebar-cat-link:last-child { border-bottom: none; }
.blog-sidebar-cat-link:hover { color: #ef394e; }
.blog-sidebar-cat-link .cat-count {
    font-size: 12px;
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 10px;
    color: #81858b;
}

.blog-popular-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
    align-items: center;
}
.blog-popular-item:last-child { border-bottom: none; }
.blog-popular-item img {
    width: 72px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
.blog-popular-item h5 {
    font-size: 13px;
    font-weight: 700;
    color: #3f4064;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-popular-item h5 a { color: inherit; text-decoration: none; }
.blog-popular-item h5 a:hover { color: #ef394e; }

/* ---------- Post detail ---------- */
.blog-article {
    background: #fff;
    border: 1px solid #f0f0f1;
    border-radius: 12px;
    padding: 32px;
}
.blog-article-header {
    margin-bottom: 24px;
}
.blog-article-header h1 {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.8;
    color: #3f4064;
    margin: 0 0 16px;
}
.blog-article-info {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: #81858b;
    flex-wrap: wrap;
}
.blog-article-info .info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.blog-article-cover {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}
.blog-article-cover img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
}
.blog-article-content {
    font-size: 16px;
    line-height: 2.2;
    color: #2b2d42;
    word-break: break-word;
}
.blog-article-content p { 
    margin: 0 0 20px; 
}
.blog-article-content h1, 
.blog-article-content h2, 
.blog-article-content h3, 
.blog-article-content h4 {
    color: #09090b;
    font-weight: 800;
    margin: 32px 0 16px;
    line-height: 1.5;
}
.blog-article-content h2 { 
    font-size: 22px; 
    border-bottom: 2px solid #f0f0f1; 
    padding-bottom: 8px; 
}
.blog-article-content h3 { 
    font-size: 19px; 
}
.blog-article-content h4 { 
    font-size: 17px; 
}
.blog-article-content img { 
    max-width: 100%; 
    height: auto !important;
    border-radius: 12px; 
    margin: 20px auto; 
    display: block;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.blog-article-content figure {
    margin: 24px 0;
    text-align: center;
}
.blog-article-content figure figcaption {
    font-size: 13px;
    color: #81858b;
    margin-top: 8px;
}
.blog-article-content a {
    color: #ef394e;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.2s;
}
.blog-article-content a:hover {
    color: #c9182d;
}
.blog-article-content blockquote {
    border-right: 4px solid #09090b;
    padding: 16px 24px;
    margin: 24px 0;
    background: #f8f9fa;
    border-radius: 0 12px 12px 0;
    color: #4a4b68;
    font-style: italic;
    font-size: 15.5px;
}
.blog-article-content ul, .blog-article-content ol {
    padding-right: 28px;
    margin: 16px 0;
}
.blog-article-content li { 
    margin-bottom: 10px; 
    line-height: 1.9;
}
.blog-article-content table {
    width: 100% !important;
    border-collapse: collapse;
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e4e4e7;
    font-size: 14px;
}
.blog-article-content table th {
    background: #f4f4f5;
    padding: 12px 16px;
    border: 1px solid #e4e4e7;
    font-weight: 700;
    text-align: right;
}
.blog-article-content table td {
    padding: 12px 16px;
    border: 1px solid #e4e4e7;
}
.blog-article-content table tr:nth-child(even) {
    background: #fafafa;
}
.blog-article-content pre {
    background: #18181b;
    color: #f4f4f5;
    padding: 16px 20px;
    border-radius: 10px;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
    font-size: 13.5px;
    margin: 20px 0;
}
.blog-article-content code {
    background: #f4f4f5;
    color: #09090b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 90%;
    direction: ltr;
    display: inline-block;
}
.blog-article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* ---------- Comments ---------- */
.blog-comments {
    background: #fff;
    border: 1px solid #f0f0f1;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}
.blog-comments h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f1;
}

.blog-comment {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f1;
}
.blog-comment:last-child { border-bottom: none; }
.blog-comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.blog-comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #81858b;
    flex-shrink: 0;
}
.blog-comment-name {
    font-size: 14px;
    font-weight: 700;
    color: #3f4064;
}
.blog-comment-date {
    font-size: 12px;
    color: #a1a3a8;
}
.blog-comment-body {
    font-size: 14px;
    line-height: 1.8;
    color: #62666d;
    padding-right: 52px;
}
.blog-comment-reply-btn {
    font-size: 12px;
    color: #008eb2;
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px 0;
    margin-right: 52px;
    font-family: inherit;
}

.blog-comment-replies {
    padding-right: 52px;
}
.blog-comment-replies .blog-comment {
    border-bottom: none;
    padding: 8px 0 8px 0;
    border-right: 3px solid #f0f0f1;
    padding-right: 16px;
    margin-top: 8px;
}

.blog-comment-form textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e0e0e2;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}
.blog-comment-form textarea:focus {
    outline: none;
    border-color: #3f4064;
}
.blog-comment-form button {
    margin-top: 12px;
    padding: 12px 32px;
    background: #ef394e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.blog-comment-form button:hover { background: #d32f42; }

/* ---------- Related posts ---------- */
.blog-related {
    margin-top: 20px;
}
.blog-related h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
}
.blog-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ---------- Search results ---------- */
.blog-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.blog-search-header h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}
.blog-search-header .result-count {
    font-size: 14px;
    color: #81858b;
}
.blog-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.blog-search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e2;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}
.blog-search-box input:focus { outline: none; border-color: #3f4064; }
.blog-search-box button {
    padding: 12px 24px;
    background: #ef394e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

/* ---------- Pagination ---------- */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
}
.blog-pagination a,
.blog-pagination span {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid #e0e0e2;
    color: #3f4064;
    transition: all 0.2s;
}
.blog-pagination a:hover { background: #f0f0f1; }
.blog-pagination .current {
    background: #ef394e;
    color: #fff;
    border-color: #ef394e;
}

/* ---------- Empty state ---------- */
.blog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 24px;
    text-align: center;
}
.blog-empty-icon { font-size: 56px; margin-bottom: 16px; }
.blog-empty h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.blog-empty p { font-size: 14px; color: #81858b; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
    .blog-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .blog-sidebar-card { flex: 1; min-width: 280px; }
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
    .blog-featured { grid-template-columns: 1fr; }
    .blog-featured-main { grid-row: auto; }
    .blog-related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .blog-grid { grid-template-columns: 1fr; }
    .blog-related-grid { grid-template-columns: 1fr; }
    .blog-article { padding: 20px; }
    .blog-article-header h1 { font-size: 20px; }
}
