/* /css/blog_style.css */

.blog-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 20px;
}

.blog-header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 3rem;
}
.blog-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.blog-header p {
    font-size: 1.2rem;
    color: #6b7280;
}

/* --- Post List (blog/index.php) --- */
.post-list {
    display: grid;
    gap: 2rem;
}
.post-card {
    display: block;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}
.post-card-image {
    height: 250px;
    background-size: cover;
    background-position: center;
}
.post-card-content {
    padding: 1.5rem;
}
.post-card-content h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}
.post-card-content p {
    color: #4b5563;
    line-height: 1.6;
    margin: 0 0 1rem 0;
}
.post-meta {
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

/* --- Single Post (blog/post.php) --- */
.single-post .post-header {
    text-align: left;
    border-bottom: none;
    margin-bottom: 2rem;
}
.single-post .post-header h1 {
    font-size: 2.8rem;
    line-height: 1.2;
}
.single-post .post-header .post-meta {
    margin-top: 1rem;
    justify-content: flex-start;
    gap: 1rem;
    align-items: center;
}
.author-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #374151;
}
.post-content h2, .post-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}
.post-content p { margin-bottom: 1.5rem; }
.post-content img, .post-content .youtube-embed-wrapper { 
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
}

/* --- START: NEW STYLE FOR THE TOP FEATURED IMAGE --- */
.post-featured-image {
    width: 100%; /* Make it span the full width of the content area */
    height: auto;
    border-radius: 12px; /* A slightly larger radius for a hero image */
    margin-bottom: 2.5rem; /* More space below the main image */
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}
/* --- END: NEW STYLE --- */

/* --- Styles for Blog Post YouTube Embed --- */
.youtube-embed-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    margin-bottom: 2rem;
    /* We can also add the margin from the img rule here for consistency */
    margin-top: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px; /* Apply radius to the wrapper too */
}

.youtube-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px; /* Ensure iframe corners are also rounded */
}

/* --- Comment Section --- */
.comment-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}
.comment-section h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
}
/* Styles for comments would be very similar to your flipbook comments */
.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}
.comment-form button {
    display: block;
    margin-top: 10px;
    margin-left: auto;
    padding: 10px 20px;
    /* ... reuse your button styles ... */
}

/* --- NEW: Styles for Blog Comments --- */
.no-comments-yet {
    text-align: center;
    color: #6b7280;
    padding: 2rem 0;
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
}
.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.comment-content-wrapper {
    flex-grow: 1;
}
.comment-author {
    font-weight: 600;
    font-size: 0.95rem;
    margin-right: 8px;
    color: #1f2937;
}
.author-badge {
    font-size: 0.7rem;
    font-weight: bold;
    color: #1d4ed8;
    background-color: #dbeafe;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}
.comment-timestamp {
    font-size: 0.8rem;
    color: #9ca3af;
}
.comment-text {
    margin: 4px 0 6px 0;
    line-height: 1.6;
}
.comment-actions button {
    font-size: 0.8rem;
    background: none;
    border: none;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}
.comment-actions button:hover {
    text-decoration: underline;
}

.comment-replies {
    margin-left: 30px;
    margin-top: 1.5rem;
    padding-left: 20px;
    border-left: 2px solid #e5e7eb;
}

/* --- STYLES FOR BLOG PAGINATION --- */

.blog-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.pagination-link {
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}
.pagination-link:hover {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.page-indicator {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

/* Specific alignment for the "next" button */
.pagination-link.next {
    margin-left: auto; /* Pushes it to the far right */
}

/* --- STYLES FOR REFERENCED FLIPBOOKS --- */
.referenced-flipbooks {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}
.referenced-flipbooks h3 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: #1f2937;
}

/* We can re-use the dashboard grid styles. Make sure these are in a global stylesheet or copy them here. */
.flipbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
/* --- START: THIS IS THE FIX --- */
/*
  This is a more specific rule that ONLY applies to the grid
  inside our "Referenced Flipbooks" section.
*/
.referenced-flipbooks .flipbook-grid {
    /* On larger screens, don't let the cards get too big. Limit to 3 columns max. */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

@media (min-width: 992px) {
    .referenced-flipbooks .flipbook-grid {
        /* On desktop, force a 3-column layout for a clean look */
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/*
  This targets the card itself. We'll make it look more like
  the homepage blog post cards.
*/
.referenced-flipbooks .flipbook-card {
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); /* Softer shadow */
}

.referenced-flipbooks .flipbook-card .thumbnail {
    /* Make the thumbnail image smaller */
    padding-top: 70.7%; /* This controls the height (aspect ratio) */
}

.referenced-flipbooks .flipbook-card .card-content {
    padding: 1rem; /* Slightly less padding */
}

.referenced-flipbooks .flipbook-card .title {
    font-size: 0.9rem; /* Smaller title font */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Add ... for long titles */
}
/*
  This is a specific override that only affects the thumbnail images
  in the "Featured Flipbooks" section on a blog post.
*/
.referenced-flipbooks .thumbnail img {
    object-fit: contain; /* Change from 'cover' to 'contain' */
    
    /* Optional: Add a little padding to give the contained image some breathing room */
    padding: 8px;
    box-sizing: border-box; /* Ensures padding is included in the element's total size */
}
/* --- END: THE FIX --- */
.flipbook-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.flipbook-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.thumbnail-link { display: block; }
.thumbnail {
    position: relative;
    padding-top: 70.7%; /* A4-ish aspect ratio */
    background-color: #f3f4f6;
}
.thumbnail img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.view-overlay { /* ... same as your dashboard styles ... */ }
.flipbook-card .card-content {
    padding: 1rem;
}
.flipbook-card .title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

/* --- NEW: Two-Column Layout --- */
.blog-container.two-column {
    display: grid;
    grid-template-columns: 1fr 280px; /* Main content and a 280px sidebar */
    gap: 3rem;
    max-width: 1100px; /* Wider container for two columns */
    align-items: flex-start;
}

.main-column {
    /* No special styles needed */
}

.sidebar-column {
    position: sticky;
    top: 2rem; /* Sticks to the top as you scroll */
}

/* --- NEW: Categories Widget Styles --- */
.categories-widget {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
}
.categories-widget h3 {
    font-size: 1.2rem;
    margin: 0 0 1rem 0;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
}
.categories-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.categories-widget li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #e5e7eb;
    transition: color 0.2s;
}
.categories-widget li:last-child a {
    border-bottom: none;
}
.categories-widget li a:hover {
    color: #1d4ed8;
}
.categories-widget li.active a {
    color: #1d4ed8;
    font-weight: 700;
}
.post-count {
    background-color: #e5e7eb;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 99px;
}
.categories-widget li.active .post-count {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Responsive adjustments for mobile */
@media (max-width: 992px) {
    .blog-container.two-column {
        grid-template-columns: 1fr; /* Stack columns on smaller screens */
    }
    .sidebar-column {
        position: static; /* Un-stick the sidebar on mobile */
        margin-top: 3rem;
    }
}

/* --- Style for links inside the blog post content --- */
.post-content a {
    color: #1d4ed8; /* A nice, readable blue */
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid #dbeafe; /* A subtle underline effect */
    transition: background-color 0.2s;
}

.post-content a:hover {
    background-color: #dbeafe; /* Highlight on hover */
}

/* /css/blog_style.css */

/* --- STYLES FOR BLOG POST SHARE BUTTON --- */

.post-meta {
    /* Add this to allow the dropdown to be positioned correctly */
    position: relative; 
}

.share-dropdown-container {
    margin-left: auto; /* Pushes the button to the far right */
    position: relative; /* Anchor for the dropdown menu */
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.share-btn:hover {
    background-color: #e5e7eb;
}
.share-btn svg {
    width: 16px;
    height: 16px;
}

.share-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px); /* Position it right below the button */
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #f3f4f6;
    width: 200px;
    z-index: 10;
    overflow: hidden; /* To apply border-radius to children */
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.share-dropdown-menu:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.share-dropdown-menu a,
.share-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    text-decoration: none;
    color: #374151;
    font-size: 0.9rem;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.share-dropdown-menu a:hover,
.share-dropdown-menu button:hover {
    background-color: #f9fafb;
}
.share-dropdown-menu svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    color: #6b7280;
}
/* --- START: THIS IS THE FIX --- */
/*
  This is a specific override for the X.com icon.
  We make it slightly smaller and adjust its position to
  visually align with the other, more square icons.
*/
#share-x svg {
    width: 15px;  /* Make it slightly narrower */
    height: 15px; /* Make it slightly shorter */
}
/* --- END: THE FIX --- */

/* --- STYLES FOR RELATED POSTS SECTION --- */

.related-posts-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem; /* <-- Increased top padding for more separation */
    border-top: 1px solid #e5e7eb;
}

/* This is a general rule for section titles we can reuse */
.section-title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 3rem;
    position: relative; /* For the underline pseudo-element */
    padding-bottom: 1rem;
}

/* The decorative underline */
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: #3b82f6; /* A nice brand blue */
    border-radius: 2px;
}

/* --- START: THIS IS THE FIX FOR CARD SIZE --- */
/*
  This more specific rule ONLY affects the post-list grid
  inside the "Related Posts" section. It forces a 3-column
  layout on desktop screens, just like the homepage.
*/
@media (min-width: 768px) {
    .related-posts-section .post-list {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* --- END: THE FIX FOR CARD SIZE --- */

/* /css/blog_style.css */

/* --- STYLES FOR STICKY AUDIO PLAYER --- */
.sticky-audio-player {
    position: sticky;
    top: 10px; /* Stick to the top after scrolling a bit */
    z-index: 100;
    
    max-width: 450px;
    margin: 2rem auto;
    padding: 1rem;
    
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sticky-audio-player .player-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dbeafe; /* Light blue */
    color: #1e40af; /* Dark blue */
    border-radius: 50%;
}
.sticky-audio-player .player-icon svg {
    width: 24px;
    height: 24px;
}

.sticky-audio-player .player-text {
    flex-grow: 1;
}
.sticky-audio-player .player-text strong {
    display: block;
    font-size: 1rem;
    color: #1f2937;
}
.sticky-audio-player .player-text span {
    font-size: 0.875rem;
    color: #6b7280;
}

.sticky-audio-player audio {
    width: 100%; /* Make the default player responsive */
    max-width: 200px;
    display: none; /* Hide by default, will be shown by JS */
}

#close-audio-player {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    flex-shrink: 0;
}

/* State when player is "open" */
.sticky-audio-player.is-playing .player-text {
    display: none;
}
.sticky-audio-player.is-playing audio {
    display: block;
}

/* --- V2: STYLES FOR BLOG SEARCH (HEADER VERSION) --- */

.search-widget {
    /* Center the widget and give it space from the subtitle */
    max-width: 600px;
    margin: 2rem auto 0 auto;
}

.blog-search-form {
    position: relative;
    display: flex;
}

.blog-search-form input[type="search"] {
    width: 100%;
    /* Make the search bar taller and bolder */
    padding: 15px 50px 15px 20px;
    font-size: 1.1rem;
    
    border: 1px solid #d1d5db;
    border-radius: 50px; /* Fully rounded "pill" shape */
    
    /* Add a subtle shadow for depth */
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}
.blog-search-form input[type="search"]::placeholder {
    color: #9ca3af;
}
.blog-search-form input[type="search"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Style the button to sit inside the input field */
.blog-search-form button {
    position: absolute;
    right: 8px; /* Position from the right edge of the form */
    top: 50%;
    transform: translateY(-50%);
    
    background: #3b82f6; /* A nice brand blue */
    color: white;
    border-radius: 50%; /* Make the button a circle */
    width: 40px;
    height: 40px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.blog-search-form button:hover {
    background-color: #2563eb;
}
.blog-search-form button svg {
    width: 20px;
    height: 20px;
}

/* --- ZINE-SPECIFIC CARD THEME --- */
.flipbook-card.zine-card-style {
    background-color: #020617 !important; /* Deep Blue-Black matching Zine Theater */
    border: 1px solid #1e293b !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.flipbook-card.zine-card-style:hover {
    border-color: #38bdf8 !important; /* Glow blue on hover */
    transform: translateY(-5px);
}

/* Ensure the title text is bright on the dark background */
.flipbook-card.zine-card-style .card-content .title a {
    color: #f8fafc !important;
    font-weight: 700;
}

/* Style the thumbnail area for zines */
.flipbook-card.zine-card-style .thumbnail {
    background: #0f172a; /* Slightly lighter blue for the image area */
    border-bottom: 1px solid #1e293b;
}

/* View overlay customization for Zines */
.flipbook-card.zine-card-style .view-overlay {
    background: rgba(56, 189, 248, 0.2) !important;
}