/**
 * Blog Post Frontend Styles
 * Modern, responsive styling for blog post display
 */

/* ============================================
   Layout & Container
   ============================================ */

.blog-post-wrapper {
    width: 100%;
    min-height: 100vh;
    background: #ffffff;
}

.blog-post-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.blog-post-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 0;
}

@media (min-width: 1024px) {
    .blog-post-layout {
        grid-template-columns: 1fr 320px;
        gap: 60px;
    }
}

.blog-post-main {
    min-width: 0; /* Prevents grid overflow */
}

.blog-post-sidebar {
    min-width: 0;
}

/* ============================================
   Article Structure
   ============================================ */

.blog-post-article {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

/* ============================================
   Header Section
   ============================================ */

.blog-post-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.blog-post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
}

.blog-post-separator {
    color: #d1d5db;
}

.blog-post-author,
.blog-post-date,
.blog-post-views {
    color: #6b7280;
}

.blog-post-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    color: #111827;
    margin: 0 0 16px 0;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .blog-post-title {
        font-size: 2rem;
    }
}

.blog-post-excerpt {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #4b5563;
    margin: 0;
}

/* ============================================
   Featured Image
   ============================================ */

.blog-post-featured-image {
    margin-bottom: 40px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.featured-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* ============================================
   Content Area - CRITICAL
   ============================================ */

.blog-post-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 200px;
    font-size: 18px;
    line-height: 1.8;
    color: #374151;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure content is always visible - override any conflicting styles */
.blog-post-content * {
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================
   Typography - Headings
   ============================================ */

.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4,
.blog-post-content h5,
.blog-post-content h6 {
    margin-top: 48px;
    margin-bottom: 24px;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
    word-wrap: break-word;
}

.blog-post-content h1:first-child,
.blog-post-content h2:first-child,
.blog-post-content h3:first-child,
.blog-post-content h4:first-child,
.blog-post-content h5:first-child,
.blog-post-content h6:first-child {
    margin-top: 0;
}

.blog-post-content h1 {
    font-size: 2.5em;
}

.blog-post-content h2 {
    font-size: 2em;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 12px;
}

.blog-post-content h3 {
    font-size: 1.75em;
}

.blog-post-content h4 {
    font-size: 1.5em;
}

.blog-post-content h5 {
    font-size: 1.25em;
}

.blog-post-content h6 {
    font-size: 1.1em;
}

/* ============================================
   Typography - Paragraphs
   ============================================ */

.blog-post-content p {
    margin-bottom: 24px;
    line-height: 1.8;
    color: #374151;
}

.blog-post-content p:last-child {
    margin-bottom: 0;
}

/* Empty paragraphs should still take space */
.blog-post-content p:empty {
    min-height: 1.8em;
    margin-bottom: 24px;
}

/* ============================================
   Typography - Lists
   ============================================ */

.blog-post-content ul,
.blog-post-content ol {
    margin: 24px 0;
    padding-left: 32px;
    line-height: 1.8;
}

.blog-post-content li {
    margin-bottom: 12px;
    color: #374151;
}

.blog-post-content ul {
    list-style-type: disc;
}

.blog-post-content ol {
    list-style-type: decimal;
}

.blog-post-content ul ul,
.blog-post-content ol ol,
.blog-post-content ul ol,
.blog-post-content ol ul {
    margin-top: 12px;
    margin-bottom: 12px;
}

/* ============================================
   Typography - Blockquotes
   ============================================ */

.blog-post-content blockquote {
    border-left: 4px solid #3b82f6;
    padding: 20px 24px;
    margin: 32px 0;
    background: #f9fafb;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #4b5563;
}

.blog-post-content blockquote p {
    margin-bottom: 12px;
}

.blog-post-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-post-content cite {
    display: block;
    margin-top: 12px;
    font-size: 0.9em;
    font-style: normal;
    color: #6b7280;
}

/* ============================================
   Typography - Code
   ============================================ */

.blog-post-content code {
    background: #f3f4f6;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
    color: #ef4444;
    word-break: break-word;
}

.blog-post-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 32px 0;
    line-height: 1.6;
    font-size: 0.9em;
}

.blog-post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
    word-break: normal;
}

/* ============================================
   Images
   ============================================ */

.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 32px 0;
    display: block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.blog-post-content figure {
    margin: 32px 0;
    text-align: center;
}

.blog-post-content figure img {
    margin: 0 auto;
}

.blog-post-content figcaption {
    margin-top: 12px;
    font-size: 0.9em;
    color: #6b7280;
    font-style: italic;
}

/* ============================================
   Tables
   ============================================ */

.blog-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    overflow-x: auto;
    display: block;
}

@media (min-width: 768px) {
    .blog-post-content table {
        display: table;
    }
}

.blog-post-content table th,
.blog-post-content table td {
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    text-align: left;
}

.blog-post-content table th {
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
}

.blog-post-content table tr:nth-child(even) {
    background: #f9fafb;
}

/* ============================================
   Horizontal Rule
   ============================================ */

.blog-post-content hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 48px 0;
}

/* ============================================
   Links
   ============================================ */

.blog-post-content a {
    color: #3b82f6;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.blog-post-content a:hover {
    color: #2563eb;
}

/* ============================================
   Image Carousel (Swiper)
   ============================================ */

.blog-post-content .image-carousel {
    margin: 40px 0;
    border-radius: 12px;
    overflow: hidden;
}

.blog-post-content .swiper {
    width: 100%;
    height: 500px;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .blog-post-content .swiper {
        height: 300px;
    }
}

.blog-post-content .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-post-content .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}

.blog-post-content .swiper-pagination {
    bottom: 20px;
}

.blog-post-content .swiper-button-next,
.blog-post-content .swiper-button-prev {
    color: white;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.blog-post-content .swiper-button-next:after,
.blog-post-content .swiper-button-prev:after {
    font-size: 18px;
}

/* ============================================
   Callout Boxes
   ============================================ */

.blog-post-content .callout {
    padding: 20px 24px;
    border-radius: 8px;
    margin: 32px 0;
    border-left: 4px solid;
}

.blog-post-content .callout-info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.blog-post-content .callout-success {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.blog-post-content .callout-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.blog-post-content .callout-error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.blog-post-content .callout-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.blog-post-content .callout-message {
    margin: 0;
    line-height: 1.6;
}

/* ============================================
   Toggle/Spoiler
   ============================================ */

.blog-post-content .toggle-container {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin: 32px 0;
    overflow: hidden;
    background: #ffffff;
}

.blog-post-content .toggle-header {
    padding: 16px 20px;
    background: #f9fafb;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.blog-post-content .toggle-header:hover {
    background: #f3f4f6;
}

.blog-post-content .toggle-title {
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.blog-post-content .toggle-icon {
    transition: transform 0.2s;
    color: #6b7280;
}

.blog-post-content .toggle-container.expanded .toggle-icon {
    transform: rotate(180deg);
}

.blog-post-content .toggle-content {
    padding: 20px;
    display: none;
    border-top: 1px solid #e5e7eb;
}

.blog-post-content .toggle-container.expanded .toggle-content {
    display: block;
}

/* ============================================
   File Attachment
   ============================================ */

.blog-post-content .file-attachment {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin: 32px 0;
    background: #f9fafb;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: box-shadow 0.2s;
}

.blog-post-content .file-attachment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blog-post-content .file-attachment-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.blog-post-content .file-attachment-info {
    flex: 1;
    min-width: 0;
}

.blog-post-content .file-attachment-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #111827;
    word-break: break-word;
}

.blog-post-content .file-attachment-size {
    color: #6b7280;
    font-size: 0.9em;
}

.blog-post-content .file-attachment-download {
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.blog-post-content .file-attachment-download:hover {
    background: #2563eb;
}

/* ============================================
   Audio Player
   ============================================ */

.blog-post-content .audio-player {
    margin: 32px 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #f9fafb;
}

.blog-post-content .audio-player audio {
    width: 100%;
    outline: none;
}

.blog-post-content .audio-caption {
    margin-top: 12px;
    color: #6b7280;
    font-size: 0.9em;
    font-style: italic;
    text-align: center;
}

/* ============================================
   Embed Container
   ============================================ */

.blog-post-content .embed-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 32px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.blog-post-content .embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   Link Tool
   ============================================ */

.blog-post-content .link-tool {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin: 32px 0;
    background: #f9fafb;
    transition: box-shadow 0.2s;
}

.blog-post-content .link-tool:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blog-post-content .link-tool-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #111827;
}

.blog-post-content .link-tool-url {
    color: #6b7280;
    font-size: 0.9em;
    text-decoration: none;
    word-break: break-all;
}

.blog-post-content .link-tool-url:hover {
    text-decoration: underline;
    color: #3b82f6;
}

/* ============================================
   Warning Block
   ============================================ */

.blog-post-content .warning-block {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    padding: 20px 24px;
    border-radius: 8px;
    margin: 32px 0;
}

.blog-post-content .warning-title {
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.blog-post-content .warning-message {
    color: #78350f;
    margin: 0;
    line-height: 1.6;
}

/* ============================================
   Checklist
   ============================================ */

.blog-post-content .checklist {
    list-style: none;
    padding-left: 0;
    margin: 24px 0;
}

.blog-post-content .checklist li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-left: 32px;
    position: relative;
}

.blog-post-content .checklist input[type="checkbox"] {
    position: absolute;
    left: 0;
    margin-right: 12px;
    margin-top: 4px;
    cursor: not-allowed;
    width: 18px;
    height: 18px;
}

/* ============================================
   Actions Section
   ============================================ */

.blog-post-actions {
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 32px 0;
    margin: 48px 0;
}

.blog-post-actions-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
}

.blog-like-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.blog-like-button:hover {
    background: #fee2e2;
    color: #dc2626;
}

.blog-like-button.liked {
    background: #fee2e2;
    color: #dc2626;
}

.blog-share-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.blog-share-label {
    color: #6b7280;
    font-size: 14px;
}

.blog-share-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 18px;
}

.blog-share-link:hover {
    background: #e5e7eb;
    color: #111827;
    transform: scale(1.1);
}

.blog-post-points {
    margin-top: 16px;
    font-size: 14px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

.blog-post-points i {
    color: #fbbf24;
}

/* ============================================
   Comments Section
   ============================================ */

.blog-post-comments {
    margin-top: 48px;
}

.blog-comments-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 32px;
}

.blog-comment-form-wrapper {
    background: #f9fafb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 32px;
}

.blog-comment-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.blog-comment-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.blog-comment-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.blog-comment-submit {
    align-self: flex-start;
    padding: 12px 24px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.blog-comment-submit:hover {
    background: #2563eb;
}

.blog-comments-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.blog-comment-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.blog-comment-content {
    display: flex;
    gap: 16px;
}

.blog-comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6b7280;
}

.blog-comment-body {
    flex: 1;
    min-width: 0;
}

.blog-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.blog-comment-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.blog-comment-author {
    font-weight: 600;
    color: #111827;
}

.blog-comment-date {
    font-size: 14px;
    color: #6b7280;
}

.blog-comment-delete {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.blog-comment-delete:hover {
    background: #fee2e2;
}

.blog-comment-text {
    color: #374151;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
}

.blog-comments-empty {
    text-align: center;
    padding: 48px 20px;
    color: #6b7280;
}

/* ============================================
   Toast Notification
   ============================================ */

.blog-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.blog-toast.hidden {
    display: none;
}

.blog-toast:not(.hidden) {
    transform: translateX(0);
}

.blog-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   Error Messages
   ============================================ */

.blog-content-error {
    padding: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    text-align: center;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1023px) {
    .blog-post-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-post-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .blog-post-container {
        padding: 0 16px;
    }
    
    .blog-post-layout {
        padding: 24px 0;
        gap: 32px;
    }
    
    .blog-post-header {
        margin-bottom: 32px;
    }
    
    .blog-post-title {
        font-size: 1.75rem;
    }
    
    .blog-post-excerpt {
        font-size: 1.125rem;
    }
    
    .blog-post-content {
        font-size: 16px;
    }
    
    .blog-post-content h1 {
        font-size: 2em;
    }
    
    .blog-post-content h2 {
        font-size: 1.75em;
    }
    
    .blog-post-content h3 {
        font-size: 1.5em;
    }
    
    .blog-post-actions-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .blog-share-buttons {
        justify-content: center;
    }
    
    .blog-comment-content {
        flex-direction: column;
    }
    
    .blog-comment-avatar {
        width: 32px;
        height: 32px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .blog-post-sidebar,
    .blog-post-actions,
    .blog-post-comments,
    .blog-toast {
        display: none;
    }
    
    .blog-post-content .toggle-content {
        display: block !important;
    }
    
    .blog-post-content .swiper-button-next,
    .blog-post-content .swiper-button-prev {
        display: none;
    }
    
    .blog-post-content a {
        color: #000;
        text-decoration: underline;
    }
    
    .blog-post-content a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.blog-post-content:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}

/* Ensure all interactive elements are keyboard accessible */
.blog-like-button:focus,
.blog-share-link:focus,
.blog-comment-submit:focus,
.blog-comment-delete:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ============================================
   Content Visibility Override
   ============================================ */

/* Force content to be visible - override any conflicting styles */
.blog-post-content {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Block-level elements */
.blog-post-content p,
.blog-post-content div,
.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4,
.blog-post-content h5,
.blog-post-content h6,
.blog-post-content ul,
.blog-post-content ol,
.blog-post-content li,
.blog-post-content blockquote,
.blog-post-content pre,
.blog-post-content table,
.blog-post-content figure {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Inline elements should remain inline */
.blog-post-content span,
.blog-post-content a,
.blog-post-content code,
.blog-post-content strong,
.blog-post-content em,
.blog-post-content u,
.blog-post-content s {
    visibility: visible !important;
    opacity: 1 !important;
    display: inline !important;
}

/* Images and figures */
.blog-post-content img,
.blog-post-content figure {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
