/*
|--------------------------------------------------------------------------
| Blog Styles
|--------------------------------------------------------------------------
| Clean, modern blog design with RTL support
*/

/* ============ Variables ============ */
:root {
    --blog-primary: #1a202c;
    --blog-secondary: #4a5568;
    --blog-muted: #718096;
    --blog-light: #a0aec0;
    --blog-border: #e2e8f0;
    --blog-bg: #f7fafc;
    --blog-white: #ffffff;
    --blog-accent: #3182ce;
    --blog-success: #38a169;
    --blog-warning: #d69e2e;
    --blog-danger: #e53e3e;
    --blog-radius: 12px;
    --blog-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --blog-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --blog-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reading Progress Bar ============ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--blog-accent), #667eea);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ============ Blog Container ============ */
.blog-container,
.article-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ============ Blog Header ============ */
.blog-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-top: 1rem;
}

.blog-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--blog-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.blog-subtitle {
    font-size: 1.1rem;
    color: var(--blog-muted);
    margin-bottom: 1.5rem;
}

.header-divider {
    width: 60px;
    height: 3px;
    background: var(--blog-primary);
    margin: 0 auto;
    border-radius: 2px;
}

/* ============ Search Box ============ */
.search-box {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: 50px;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    transition: var(--blog-transition);
    box-shadow: var(--blog-shadow);
}

.search-input-wrapper:focus-within {
    border-color: var(--blog-accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--blog-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: var(--blog-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--blog-light);
}

.search-btn {
    padding: 0.65rem 1.5rem;
    background: var(--blog-primary);
    color: var(--blog-white);
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--blog-transition);
}

.search-btn:hover {
    background: var(--blog-secondary);
}

/* ============ Categories Navigation ============ */
.categories-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--blog-white);
    color: var(--blog-secondary);
    border: 1px solid var(--blog-border);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--blog-transition);
}

.category-pill:hover {
    border-color: var(--blog-primary);
    color: var(--blog-primary);
}

.category-pill.active {
    background: var(--blog-primary);
    color: var(--blog-white);
    border-color: var(--blog-primary);
}

.category-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ============ Featured Section ============ */
.featured-section {
    margin-bottom: 3rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blog-primary);
    margin-bottom: 1.5rem;
}

.section-title svg {
    width: 24px;
    height: 24px;
    color: var(--blog-warning);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* ============ Blog Layout ============ */
.blog-layout,
.article-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: start;
}

.posts-section,
.article-main {
    min-width: 0;
}

/* ============ Posts Grid ============ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ============ Post Card ============ */
.post-card {
    background: var(--blog-white);
    border-radius: var(--blog-radius);
    overflow: hidden;
    box-shadow: var(--blog-shadow);
    transition: var(--blog-transition);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--blog-shadow-lg);
}

.post-card--featured {
    grid-column: span 1;
}

.post-image-link {
    display: block;
    position: relative;
    padding-top: 60%;
    overflow: hidden;
    background: var(--blog-bg);
}

.post-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-image {
    transform: scale(1.05);
}

.post-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blog-bg);
}

.post-image-placeholder svg {
    width: 48px;
    height: 48px;
    color: var(--blog-border);
}

.post-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.35rem 0.85rem;
    background: var(--blog-warning);
    color: var(--blog-white);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
}

.post-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Post Meta */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--blog-muted);
    margin-bottom: 0.75rem;
}

.post-meta svg {
    width: 14px;
    height: 14px;
}

.meta-date,
.meta-reading-time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-separator {
    color: var(--blog-border);
}

.meta-category {
    color: var(--blog-accent);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.meta-category:hover {
    text-decoration: underline;
}

/* Post Title */
.post-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.post-title a {
    color: var(--blog-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.post-title a:hover {
    color: var(--blog-accent);
}

/* Post Excerpt */
.post-excerpt {
    color: var(--blog-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Footer */
.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--blog-bg);
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 28px;
    height: 28px;
    background: var(--blog-primary);
    color: var(--blog-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.author-name {
    font-size: 0.85rem;
    color: var(--blog-secondary);
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--blog-accent);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: gap 0.2s;
}

.read-more:hover {
    gap: 0.6rem;
}

.read-more svg {
    width: 16px;
    height: 16px;
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--blog-white);
    border-radius: var(--blog-radius);
    border: 2px dashed var(--blog-border);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--blog-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--blog-border);
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--blog-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--blog-muted);
    margin-bottom: 1.5rem;
}

.btn-back-home {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--blog-primary);
    color: var(--blog-white);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--blog-transition);
}

.btn-back-home:hover {
    background: var(--blog-secondary);
}

/* ============ Pagination ============ */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* ============ Breadcrumbs ============ */
.breadcrumbs {
    margin-bottom: 1.5rem;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--blog-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--blog-accent);
}

.breadcrumbs .separator {
    color: var(--blog-border);
}

.breadcrumbs .current {
    color: var(--blog-secondary);
    font-weight: 500;
}

/* ============ Article Header ============ */
.article-header {
    margin-bottom: 2rem;
}

.article-category {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: var(--blog-bg);
    color: var(--blog-accent);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 50px;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: var(--blog-transition);
}

.article-category:hover {
    background: var(--blog-accent);
    color: var(--blog-white);
}

.article-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--blog-primary);
    line-height: 1.3;
    margin-bottom: 1.25rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    color: var(--blog-muted);
    font-size: 0.9rem;
}

.article-meta .author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-meta .reading-time,
.article-meta .views-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.article-meta svg {
    width: 16px;
    height: 16px;
}

/* ============ Featured Image ============ */
.article-featured-image {
    margin: 0 0 2rem;
    border-radius: var(--blog-radius);
    overflow: hidden;
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============ Article Content ============ */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--blog-secondary);
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--blog-primary);
    margin: 2.5rem 0 1rem;
}

.article-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--blog-primary);
    margin: 2rem 0 0.75rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content a {
    color: var(--blog-accent);
    text-decoration: underline;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.article-content blockquote {
    border-left: 4px solid var(--blog-accent);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--blog-bg);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-right: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content pre {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-content th,
.article-content td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--blog-border);
    text-align: right;
}

.article-content th {
    background: var(--blog-bg);
    font-weight: 600;
}

/* ============ Share Section ============ */
.share-section {
    margin: 2.5rem 0;
    padding: 1.5rem;
    background: var(--blog-bg);
    border-radius: var(--blog-radius);
    text-align: center;
}

.share-section h3 {
    font-size: 1rem;
    color: var(--blog-secondary);
    margin-bottom: 1rem;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: var(--blog-transition);
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

.share-twitter {
    background: #1da1f2;
    color: white;
}

.share-facebook {
    background: #1877f2;
    color: white;
}

.share-linkedin {
    background: #0a66c2;
    color: white;
}

.share-whatsapp {
    background: #25d366;
    color: white;
}

.share-copy {
    background: var(--blog-secondary);
    color: white;
}

.share-btn:hover {
    transform: scale(1.1);
}

/* ============ Author Bio ============ */
.author-bio {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    margin: 2rem 0;
}

.author-avatar-large {
    width: 64px;
    height: 64px;
    background: var(--blog-primary);
    color: var(--blog-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.author-details h4 {
    font-size: 1.1rem;
    color: var(--blog-primary);
    margin-bottom: 0.25rem;
}

.author-details p {
    color: var(--blog-muted);
    font-size: 0.9rem;
}

/* ============ Post Navigation ============ */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.nav-link {
    display: block;
    padding: 1.25rem;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    text-decoration: none;
    transition: var(--blog-transition);
}

.nav-link:hover {
    border-color: var(--blog-accent);
}

.nav-prev {
    text-align: right;
}

.nav-next {
    text-align: left;
}

.nav-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--blog-muted);
    margin-bottom: 0.5rem;
}

.nav-prev .nav-label {
    justify-content: flex-start;
}

.nav-next .nav-label {
    justify-content: flex-end;
}

.nav-label svg {
    width: 16px;
    height: 16px;
}

.nav-title {
    display: block;
    font-weight: 600;
    color: var(--blog-primary);
}

/* ============ Comments Section ============ */
.comments-section {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--blog-white);
    border-radius: var(--blog-radius);
    border: 1px solid var(--blog-border);
}

.comments-title {
    font-size: 1.25rem;
    color: var(--blog-primary);
    margin-bottom: 1.5rem;
}

.comments-count {
    color: var(--blog-muted);
    font-weight: 400;
}

/* Comment Form */
.comment-form {
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--blog-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--blog-border);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--blog-primary);
    transition: var(--blog-transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blog-accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.submit-btn {
    padding: 0.75rem 1.5rem;
    background: var(--blog-primary);
    color: var(--blog-white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--blog-transition);
}

.submit-btn:hover {
    background: var(--blog-secondary);
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
}

/* Comments List */
.comments-list {
    margin-top: 2rem;
}

.comment {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--blog-bg);
}

.comment:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    background: var(--blog-bg);
    color: var(--blog-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.comment-author {
    color: var(--blog-primary);
}

.comment-date {
    font-size: 0.8rem;
    color: var(--blog-muted);
}

.comment-content {
    color: var(--blog-secondary);
    line-height: 1.6;
}

.comment-replies {
    margin-top: 1rem;
    padding-right: 1rem;
    border-right: 2px solid var(--blog-bg);
}

.comment.reply {
    padding: 1rem 0;
}

/* ============ Related Posts ============ */
.related-posts {
    margin: 3rem 0;
}

.related-posts h3 {
    font-size: 1.25rem;
    color: var(--blog-primary);
    margin-bottom: 1.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.related-card {
    display: block;
    background: var(--blog-white);
    border-radius: var(--blog-radius);
    overflow: hidden;
    border: 1px solid var(--blog-border);
    text-decoration: none;
    transition: var(--blog-transition);
}

.related-card:hover {
    border-color: var(--blog-accent);
    transform: translateY(-2px);
}

.related-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.related-placeholder {
    width: 100%;
    height: 120px;
    background: var(--blog-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-placeholder svg {
    width: 32px;
    height: 32px;
    color: var(--blog-border);
}

.related-info {
    padding: 1rem;
}

.related-info h4 {
    font-size: 0.95rem;
    color: var(--blog-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.related-info time {
    font-size: 0.8rem;
    color: var(--blog-muted);
}

/* ============ Back to Blog ============ */
.back-to-blog {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--blog-border);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--blog-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--blog-transition);
}

.back-btn:hover {
    color: var(--blog-accent);
}

.back-btn svg {
    width: 18px;
    height: 18px;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {

    .blog-layout,
    .article-layout {
        grid-template-columns: 1fr;
    }

    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .blog-container,
    .article-container {
        padding: 1.5rem 1rem;
    }

    .blog-title {
        font-size: 2rem;
    }

    .article-title {
        font-size: 1.75rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .article-meta .meta-separator {
        display: none;
    }
}