/* css/blog-post.css */

/* === START: Updated Styles for Tables and Arabic Text === */

/* Helper class for blocks of Arabic text */
.arabic-block {
    direction: rtl;
    text-align: right;
    font-size: 1.25rem; /* Larger font size for readability */
}

/* Apply Noto Sans Arabic font where Arabic script is used */
.post-content {
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
}

/* New Table Styles */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 1rem;
    background-color: #ffffff;
    border: 1px solid #e5e7eb; /* Softer border */
    border-radius: 0.5rem;
    overflow: hidden;
}

.post-content table th,
.post-content table td {
    padding: 1rem 1.25rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

/* Remove bottom border from the last row */
.post-content table tr:last-child td {
    border-bottom: none;
}

/* Styling for the table header */
.post-content table th {
    background-color: #f9fafb; /* Lighter background */
    font-weight: 600;
    color: #374151; /* Darker, more standard text color */
    font-size: 0.875rem;
    text-transform: none; /* Removed uppercase for a cleaner look */
    letter-spacing: normal;
}

/* Hover effect for data rows */
.post-content table tbody tr:hover {
    background-color: #f5f8ff;
}

/* Apply fonts to table cells */
.post-content table td, .post-content table th {
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
}
.post-content table .arabic-block {
    font-size: 1.1rem; /* Slightly smaller for tables */
}

/* === END: Updated Styles === */


/* Responsive table */
@media (max-width: 768px) {
    .post-content table {
        font-size: 0.875rem;
    }
    
    .post-content table th,
    .post-content table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Blog post specific styles */
.blog-post-container {
    background-color: #ffffff;
    margin-bottom: 0;
    padding-bottom: 3rem;
}

.post-header {
    text-align: center;
    padding: 2rem 0 18rem; /* Adjust padding to create space for the fade */
    background-color: #fffaf2;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100"><path d="M 10 10 C 20 20, 40 20, 50 10 S 70 0, 90 10 M 10 30 C 20 40, 40 40, 50 30 S 70 20, 90 30 M 10 50 C 20 60, 40 60, 50 50 S 70 40, 90 50 M 10 70 C 20 80, 40 80, 50 70 S 70 60, 90 70 M 10 90 C 20 100, 40 100, 50 90 S 70 80, 90 90" fill="none" stroke="%23ad5207" stroke-width="1" opacity="0.3"/></svg>');
    background-repeat: repeat;
    position: relative; /* Required for the pseudo-element */
    z-index: 5;
}

.post-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px; /* Controls the height of the fade area */
    background: linear-gradient(to bottom, transparent 0%, #ffffff 100%);
    z-index: 10;
}


.post-category a {
    background-color: #fff0e1;
    color: #ad5207;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color 0.3s;
}

.post-category a:hover {
    background-color: #e88e07;
    color: white;
}

.post-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin: 1rem 0;
}

.post-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    flex-wrap: wrap;
}

.post-meta i {
    color: #ad5207;
    margin-right: 0.5rem;
}

.featured-image {
    width: 100%;
    max-width: 800px; /* Increased max-width */
    margin: 0 auto 2rem auto;
    padding: 0 1rem;
    box-sizing: border-box;
    margin-top: -15rem; /* Pulls the image up into the fade area */
    position: relative;
    z-index: 20; /* Ensures image is on top of the gradient */
}

.featured-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .featured-image {
        padding: 0 0.5rem;
        max-width: 100%;
    }
}

@media (min-width: 1024px) {
    .post-header h1 {
        padding: 0 5rem;
    }
}

.post-content {
    background-color: #ffffff;
    padding-top: 1rem;
    padding-bottom: 0;
    max-width: 800px;
    line-height: 1.7;
    margin: 0 auto;
    position: relative;
    z-index: 15; /* Ensures content is above the fade */
}

.post-content p {
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
}

.post-content h2 {
    font-size: 1.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.post-content ul {
    list-style-type: disc;
    padding-left: 2rem;
    margin-bottom: 1.5rem;
}

.post-content ul li {
    margin-bottom: 0.75rem;
}

.post-content blockquote {
    margin: 2rem 0;
    padding-left: 1.5rem;
    border-left: 4px solid #ad5207;
    font-style: italic;
    font-size: 1.25rem;
    color: #4b5563;
}

.post-content blockquote footer {
    margin-top: 0.5rem;
    font-style: normal;
    font-size: 1rem;
    color: #374151;
}

/* Inline Image Style */
.inline-post-image {
    width: 100%;
    max-width: 700px;
    height: auto;
    display: block;
    margin: 2.5rem auto; /* Centers the image and adds space above/below */
    border-radius: 0.5rem; /* Matches the rounded corners of your featured image */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Optional shadow effect */
}

/* === NEW: Comments Section Styles === */
.comments-section {
    padding-top: 3rem;
    padding-bottom: 3rem;
    background-color: #fffaf2; /* Light background for the whole section */
    border-top: 1px solid #eee;
}

.comments-section .content-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.comments-section h2 {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 2.5rem;
    text-align: center;
}

.comment-form {
    max-width: 800px;
    margin: 0 auto 3rem auto;
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(173, 82, 7, 0.1);
}

.comment-form h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.comments-list {
    max-width: 800px;
    margin: 0 auto;
}

.comment-item {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.comment-author-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-author-avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background-color: #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #9ca3af;
}

.comment-author-name {
    font-weight: 600;
    color: #1f2937;
}

.comment-date {
    font-size: 0.875rem;
    color: #6b7280;
}

.comment-body p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

/* === START: Related Posts Section Styles === */

.related-posts-section {
    padding: 3rem 0;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.related-posts-section .content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.related-posts-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 2.5rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Re-using blog card styles for consistency */
.blog-post-card {
    background-color: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.08);
}

.blog-post-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.blog-post-card .card-content {
    padding: 1.5rem;
}

.blog-post-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
}

.blog-post-card h3 a {
    text-decoration: none;
    color: #1f2937;
    transition: color 0.2s;
}

.blog-post-card h3 a:hover {
    color: #ad5207;
}

.blog-post-card .excerpt {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 1rem;
}

.blog-post-card .read-more-link {
    text-decoration: none;
    color: #ad5207;
    font-weight: 600;
}

/* === END: Related Posts Section Styles === */