/* Blog Post Navigation */
.post-nav {
    background: var(--card-background, #161b22) !important;
    border-radius: var(--border-radius, 8px);
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color, #dee2e6);
}

.post-nav .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: transparent !important;
    color: var(--text-primary, #f5f5f5) !important;
    border: 2px solid var(--border-color, #dee2e6) !important;
}

.post-nav .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.post-nav .btn-outline-primary:hover {
    background: var(--primary-color, #007bff) !important;
    border-color: var(--primary-color, #007bff) !important;
    color: white !important;
}

.post-nav .btn-outline-secondary:hover {
    background: var(--text-muted, #6c757d) !important;
    border-color: var(--text-muted, #6c757d) !important;
    color: white !important;
}

/* Blog Content Styling */

/* Blog Post Container */
.blog-post {
    background: linear-gradient(135deg, #161b22 0%, #1a1f26 50%, #1e2328 100%);
    border: 1px solid rgba(33, 150, 243, 0.1);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.05);
    position: relative;
    overflow: hidden;
}

.blog-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(33, 150, 243, 0.02) 0%, transparent 70%);
    pointer-events: none;
}

.blog-post > * {
    position: relative;
    z-index: 1;
}

/* Blog Header Styling */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2196f3, #1976d2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    /* Fallback for browsers that don't support background-clip */
    color: #2196f3;
}

/* Support for Safari */
@supports (-webkit-background-clip: text) {
    h1 {
        color: transparent;
    }
}

h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Search Section */
.search-section {
    margin-bottom: 2em;
    padding: 1.5em;
    background: var(--card-background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 1em;
}

.search-input {
    flex: 1;
    padding: 0.5em 1em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
    background-color: var(--background-light);
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.25);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 0.5em 1.5em;
    background: var(--primary-color);
    color: var(--dark-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.clear-search {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9em;
    transition: var(--transition);
}

.clear-search:hover {
    color: var(--primary-color);
}

.search-results {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

.blog-meta {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--border-color);
}

.blog-meta .d-flex > span {
    margin-right: 1.5rem;
}

.blog-meta .d-flex > span:last-child {
    margin-right: 0;
}

.blog-meta .d-flex {
    gap: 1.5rem;
}

/* Blog Post Excerpts and Content */
.post-excerpt {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.post-excerpt p {
    margin-bottom: 0.75rem;
}

.post-excerpt p:last-child {
    margin-bottom: 0;
}

.post-excerpt br {
    line-height: 1.6;
}

.post-excerpt ul,
.post-excerpt ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.post-excerpt li {
    margin-bottom: 0.25rem;
}

.post-excerpt h1,
.post-excerpt h2,
.post-excerpt h3,
.post-excerpt h4,
.post-excerpt h5,
.post-excerpt h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.post-excerpt code {
    background: var(--background-light, #f8f9fa);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--text-primary);
}

.post-excerpt blockquote {
    border-left: 4px solid var(--primary-color, #007bff);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-muted);
}

.post-summary {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
}

.post-summary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.post-summary .card-title a {
    color: var(--text-primary, #f5f5f5);
    transition: color 0.2s ease;
}

.post-summary .card-title a:hover {
    color: var(--primary-color, #007bff);
}

.post-summary .btn {
    transition: all 0.2s ease;
}

.post-summary .btn:hover {
    transform: translateX(4px);
}

.post-meta {
    font-size: 0.9em;
    color: var(--text-muted);
}

.post-meta a {
    color: var(--primary-color);
    text-decoration: none;
}

.post-meta a:hover {
    text-decoration: underline;
}

.post-meta .mt-2 {
    margin-top: 1rem !important;
}

.post-meta i.fas {
    margin-right: 0.5rem;
    margin-left: 1rem;
}

.post-meta i.fas:first-child {
    margin-left: 0;
}

.blog-content {
    line-height: 1.8;
    max-width: none;
    color: var(--text-primary);
}

.blog-content p {
    margin-bottom: 1.2rem;
}

.blog-content br {
    line-height: 1.8;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1.2rem;
    padding-left: 2rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content blockquote {
    border-left: 4px solid var(--primary-color, #007bff);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-muted);
    background: var(--background-light, #f8f9fa);
    padding: 1rem 1.5rem;
    border-radius: 4px;
}

.blog-content code {
    background: var(--background-light, #f8f9fa);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.blog-content pre {
    background: var(--background-light, #f8f9fa);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color, #dee2e6);
}

.blog-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    margin-top: 2em;
    margin-bottom: 1em;
    color: var(--text-primary);
    white-space: normal;
}

.blog-content h1:first-child,
.blog-content h2:first-child,
.blog-content h3:first-child {
    margin-top: 0;
}

.blog-content p {
    margin-bottom: 1.5em;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.blog-content br {
    line-height: 1.8;
}

.blog-content pre {
    background: var(--card-background);
    padding: 1.5em;
    border-radius: 4px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin: 1.5em 0;
    color: var(--text-primary);
}

.blog-content code {
    background: var(--card-background);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.blog-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text-primary);
}

.blog-content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 1.5em 0;
    padding: 1em 1.5em;
    background: rgba(0, 188, 212, 0.1);
    color: var(--text-primary);
    font-style: italic;
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.blog-content ul,
.blog-content ol {
    margin: 1.5em 0;
    padding-left: 2em;
    color: var(--text-primary);
}

.blog-content li {
    margin-bottom: 0.5em;
    color: var(--text-primary);
}

/* Blog List Styles */
.blog-filters {
    margin-bottom: 2em;
    padding: 1em;
    background: var(--card-background, #f8f9fa);
    border-radius: 4px;
    border: 1px solid var(--border-color, #dee2e6);
}

.blog-filters h3 {
    margin: 0 0 1em 0;
    color: var(--text-primary, #333);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.blog-posts {
    display: grid;
    gap: 2em;
}

.blog-post-card {
    background: var(--card-background, white);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 1.5em;
    transition: box-shadow 0.2s;
}

.blog-post-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.blog-post-card h2 {
    margin: 0 0 0.5em 0;
}

.blog-post-card h2 a {
    color: var(--text-primary, #333);
    text-decoration: none;
}

.blog-post-card h2 a:hover {
    color: var(--primary-color, #007cba);
}

.blog-post-excerpt {
    color: var(--text-secondary, #666);
    line-height: 1.6;
    margin-bottom: 1em;
}

.blog-post-tags {
    margin-top: 1em;
}

/* Blog Tag Styling */
.blog-tags, .post-tags {
    margin-top: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blog-tags .badge, .post-tags .badge,
.badge.bg-light, .badge.bg-secondary {
    display: inline-flex;
    align-items: center;
    background: var(--card-background, #161b22) !important;
    color: var(--text-primary, #f5f5f5) !important;
    border: 1px solid var(--primary-color, #2196f3) !important;
    padding: 0.375rem 0.75rem;
    margin: 0;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    line-height: 1;
}

.blog-tags .badge:hover, .post-tags .badge:hover,
.badge.bg-light:hover, .badge.bg-secondary:hover {
    background: var(--primary-color, #2196f3) !important;
    color: var(--background-dark, #0d1117) !important;
    border-color: var(--primary-color, #2196f3) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.blog-tags .badge::before, .post-tags .badge::before,
.badge.bg-light::before, .badge.bg-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.blog-tags .badge:hover::before, .post-tags .badge:hover::before,
.badge.bg-light:hover::before, .badge.bg-secondary:hover::before {
    left: 100%;
}

/* Tag icon alignment */
.blog-tags .fas.fa-tags, .post-tags .fas.fa-tags {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
    align-self: center;
    line-height: 1;
}

/* Ensure tags are visible in both list and individual posts */
.mb-3 .badge, .mt-2 .badge {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

/* Comments */
.comments-section {
    margin-top: 3em;
    padding-top: 2em;
    border-top: 2px solid var(--border-color, #eee);
}

.comments-section h3 {
    margin-bottom: 1.5em;
    color: var(--text-primary, #333);
}

.comment-form {
    background: var(--card-background, transparent);
    padding: 1.5em;
    border-radius: 8px;
    margin-bottom: 2em;
    border: 1px solid var(--border-color, #dee2e6);
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 1em;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    background-color: var(--card-background, #161b22) !important;
    color: var(--text-primary, #f5f5f5) !important;
}

.comment-form textarea::placeholder {
    color: var(--text-muted, #888) !important;
}

.comment-form .btn {
    margin-top: 1em;
}

.comment-body {
    padding: 0;
}

.comment-form-header {
    border-bottom: 1px solid var(--border-color, #dee2e6);
    padding-bottom: 0.75em;
    margin-bottom: 1em;
}

.comment-form-body {
    padding: 0;
}

.login-prompt {
    background: var(--card-background, transparent);
    padding: 2em;
    border-radius: 8px;
    border: 1px solid var(--border-color, #dee2e6);
}

.login-prompt-body {
    padding: 0;
}

.comments-list {
    display: grid;
    gap: 1.5em;
}

.comment {
    background: var(--card-background, transparent);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 1.5em;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--border-color, #eee);
}

.comment-author {
    font-weight: bold;
    color: var(--text-primary, #f5f5f5) !important;
}

.comment-date {
    color: var(--text-muted, #888) !important;
    font-size: 0.9em;
}

.comment-content {
    line-height: 1.6;
    color: var(--text-primary, #f5f5f5) !important;
}

/* Comment Edit Form */
.comment-edit-form-hidden {
    display: none !important;
}

.comment-edit-form {
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 1rem;
    background: var(--card-background, transparent);
    margin-top: 0.5rem;
}

.comment-actions {
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .blog-post {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .blog-filters {
        margin-bottom: 1em;
    }

    .blog-post-card {
        padding: 1em;
    }

    .comment-form {
        padding: 1em;
    }

    .comment {
        padding: 1em;
    }

    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5em;
    }
}
