/* Theme CSS Variables */
:root {
    --bg-primary: #181818;
    --bg-secondary: #303030;
    --bg-tertiary: #252525;
    --text-primary: #fff;
    --text-secondary: #ccc;
    --text-muted: #888;
    --border-color: #404040;
    --accent-color: gold;
    --accent-hover: #ffe780;

    --bg-primary-alt: #e0e0e0;
    --bg-secondary-alt: #f5f5f5;
    --bg-tertiary-alt: #ffffff;
    --text-primary-alt: #1a1a1a;
    --text-secondary-alt: #444;
    --text-muted-alt: #666;
    --border-color-alt: #ccc;
    --accent-color-alt: #b8860b;
    --accent-hover-alt: #996515;
}

/* Light mode overrides */
body.light-mode {
    --bg-primary: #e0e0e0;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #444;
    --text-muted: #666;
    --border-color: #ccc;
    --accent-color: #b8860b;
    --accent-hover: #996515;

    --bg-primary-alt: #181818;
    --bg-secondary-alt: #303030;
    --bg-tertiary-alt: #252525;
    --text-primary-alt: #fff;
    --text-secondary-alt: #ccc;
    --text-muted-alt: #888;
    --border-color-alt: #404040;
    --accent-color-alt: gold;
    --accent-hover-alt: #ffe780;
}

body {
    background-color: var(--bg-primary);
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    font-family: Arial, Helvetica, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 100px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    cursor: pointer;
}

/* Blog Header */
.blog-header {
    background-color: var(--bg-secondary);
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    transition: background-color 0.3s ease;
}

.blog-header h1 {
    margin: 0 0 15px 0;
    font-size: 32pt;
    color: var(--text-primary);
}

.blog-header p {
    margin: 10px 0 0;
    font-size: 14pt;
    color: var(--text-secondary);
}

/* Search Bar */
.search-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

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

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

body.light-mode .search-input:focus {
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.2);
}

.search-clear {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s ease;
}

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

/* Tag Filter Container */
#tagFilterContainer {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* Tag Filter Bar */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    max-width: 95%;
    margin: 0 auto;
}

.tag-filter-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-right: 5px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.tag-filter-label:hover {
    color: var(--text-primary);
}

.tag-filter-label .chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    margin-left: 2px;
    font-size: 10px;
}

.tag-filter-bar.collapsed .chevron {
    transform: rotate(-90deg);
}

.tag-filter-bar.collapsed .tag-filter {
    display: none;
}

.tag-filter {
    display: inline-block;
    padding: 6px 14px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.tag-filter:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.tag-filter.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--bg-primary);
}

/* Blog Feed Container */
.blog-feed {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Blog Post Card */
.blog-post {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 30px;
    overflow: hidden;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Post Featured Image/Embed */
.post-media {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
}

.post-media img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.post-media .embed-container {
    width: 100%;
}

.post-media .embed-container iframe {
    width: 100%;
    max-width: 100%;
}

/* Post Content */
.post-content {
    padding: 20px 25px;
}

/* Post Header with Date */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.post-title {
    margin: 0;
    font-size: 22pt;
    color: var(--text-primary);
    flex: 1;
}

.post-date {
    color: var(--text-muted);
    font-size: 12pt;
    white-space: nowrap;
}

/* Post Body */
.post-body {
    font-size: 14pt;
    color: var(--text-secondary);
    line-height: 1.7;
}

.post-body p {
    margin: 0 0 15px;
}

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

.post-body h1, .post-body h2, .post-body h3,
.post-body h4, .post-body h5, .post-body h6 {
    color: var(--text-primary);
    margin: 20px 0 10px;
}

.post-body ul, .post-body ol {
    margin: 15px 0;
    padding-left: 25px;
}

.post-body li {
    margin-bottom: 8px;
}

.post-body a {
    color: var(--accent-color);
}

.post-body a:hover {
    color: var(--accent-hover);
}

/* Post Tags */
.post-tags {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.post-tag {
    display: inline-block;
    padding: 4px 12px;
    margin: 4px 4px 4px 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-muted);
    font-size: 11pt;
    transition: all 0.3s ease;
}

.post-tag:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

/* Embed container for videos */
.embed-container {
    text-align: center;
}

.embed-container iframe {
    max-width: 100%;
}

/* Image styling */
img {
    max-width: 100%;
}

.image-caption {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 8px;
}

/* PDF/Document Download Button */
.pdf-download-container {
    text-align: center;
    margin: 20px 0;
}

.pdf-download-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14pt;
    text-decoration: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.pdf-download-button:hover {
    background-color: var(--border-color);
    text-decoration: none;
}

.pdf-icon {
    margin-right: 8px;
}

/* Link Button */
.link-button-container {
    text-align: center;
    margin: 20px 0;
}

.link-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14pt;
    text-decoration: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.link-button:hover {
    background-color: var(--border-color);
    text-decoration: none;
}

.link-icon {
    margin-right: 8px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-primary);
    font-weight: bold;
}

tr:last-child td {
    border-bottom: none;
}

/* Loading State */
.loading-posts {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14pt;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16pt;
}

/* Floating footer */
.pluribus-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    padding: 8px 20px;
    text-align: center;
    font-size: 14pt;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.pluribus-footer a {
    color: var(--accent-color);
}

.pluribus-footer a:hover {
    color: var(--accent-hover);
}

.history-link {
    cursor: pointer;
    color: var(--text-secondary);
}

.history-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Theme toggle in footer */
.theme-toggle {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-primary-alt);
    color: var(--text-primary-alt);
}

/* History modal */
.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.history-modal {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.history-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.history-close {
    background: transparent;
    border: none;
    color: #ff4444;
    font-size: 24px;
    cursor: pointer;
}

.history-item {
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-sha {
    color: var(--accent-color);
    font-family: monospace;
}

.history-date {
    color: var(--text-muted);
    font-size: 12px;
}

.history-message {
    margin-top: 5px;
}

.history-author {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 5px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-changes {
    margin-top: 8px;
    padding: 8px;
    background-color: var(--bg-primary);
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.history-change-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.change-icon {
    width: 16px;
    text-align: center;
    font-weight: bold;
}

.change-file {
    word-break: break-all;
}

.change-added .change-icon { color: #4caf50; }
.change-modified .change-icon { color: #ff9800; }
.change-deleted .change-icon { color: #f44336; }
.change-added .change-file { color: #4caf50; }
.change-modified .change-file { color: var(--text-primary); }
.change-deleted .change-file { color: #f44336; text-decoration: line-through; }

/* Line-level diff styles */
.history-diff {
    margin-top: 4px;
    margin-left: 24px;
    padding: 4px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow-x: auto;
}

.diff-line {
    display: flex;
    white-space: pre;
    line-height: 1.4;
}

.diff-prefix {
    width: 16px;
    flex-shrink: 0;
    user-select: none;
    font-weight: bold;
}

.diff-content {
    flex: 1;
}

.diff-add {
    background-color: rgba(33, 150, 243, 0.15);
    color: #2196f3;
}

.diff-del {
    background-color: rgba(244, 67, 54, 0.15);
    color: #f44336;
}

.diff-truncated {
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.pagination-btn {
    padding: 8px 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--border-color);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 13px;
}

/* Subscribe Widget (inside footer) */
.subscribe-widget {
    display: flex;
    align-items: center;
    gap: 6px;
}

.subscribe-form {
    display: flex;
    gap: 4px;
    align-items: center;
}

.subscribe-input {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    outline: none;
    width: 160px;
    transition: border-color 0.3s ease;
}

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

.subscribe-input:focus {
    border-color: var(--accent-color);
}

.subscribe-button {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: bold;
    background-color: var(--accent-color);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.subscribe-button:hover {
    background-color: var(--accent-hover);
}

.subscribe-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.subscribe-status {
    font-size: 11px;
    white-space: nowrap;
}

.subscribe-success {
    color: #4caf50;
}

.subscribe-error {
    color: #f44336;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .blog-header h1 {
        font-size: 22pt;
    }

    .blog-header p {
        font-size: 12pt;
    }

    .post-title {
        font-size: 18pt;
    }

    .post-body {
        font-size: 12pt;
    }

    .post-header {
        flex-direction: column;
    }

    .post-date {
        order: -1;
    }

    .tag-filter {
        font-size: 10pt;
        padding: 4px 10px;
    }

    .pluribus-footer {
        font-size: 10pt;
        gap: 10px;
        flex-wrap: wrap;
    }

    .subscribe-input {
        width: 120px;
    }
}
