/* Modernes Dark Mode Design für BitBlog */
:root {
    /* Light Mode Variablen (Standard) */
    --light-fg: #1a1a1a;
    --light-bg: #ffffff;
    --light-muted: #6c757d;
    --light-link: #2563eb;
    --light-border: #e9ecef;
    --light-header-bg: #e3f2fd;
    --light-header-fg: #0b3b5c;
    --light-code-bg: #f8f9fa;
    --light-pre-bg: #f8f9fa;
    --light-footer-bg: #f8f9fa;
    --light-footer-fg: #495057;

    /* Dark Mode Variablen (werden via prefers-color-scheme überschrieben) */
    --dark-fg: #e9ecef;
    --dark-bg: #1a1a1a;
    --dark-muted: #868e96;
    --dark-link: #90b4f8;
    --dark-border: #2d2d2d;
    --dark-header-bg: #1e3a5f;
    --dark-header-fg: #e9ecef;
    --dark-code-bg: #2d2d2d;
    --dark-pre-bg: #2d2d2d;
    --dark-footer-bg: #2d2d2d;
    --dark-footer-fg: #868e96;

    /* Aktuell aktive Variablen (Standard: Light) */
    --fg: var(--light-fg);
    --bg: var(--light-bg);
    --muted: var(--light-muted);
    --link: var(--light-link);
    --border: var(--light-border);
    --header-bg: var(--light-header-bg);
    --header-fg: var(--light-header-fg);
    --code-bg: var(--light-code-bg);
    --pre-bg: var(--light-pre-bg);
    --footer-bg: var(--light-footer-bg);
    --footer-fg: var(--light-footer-fg);
}

/* Dark Mode via Systempräferenz */
@media (prefers-color-scheme: dark) {
    :root {
        --fg: var(--dark-fg);
        --bg: var(--dark-bg);
        --muted: var(--dark-muted);
        --link: var(--dark-link);
        --border: var(--dark-border);
        --header-bg: var(--dark-header-bg);
        --header-fg: var(--dark-header-fg);
        --code-bg: var(--dark-code-bg);
        --pre-bg: var(--dark-pre-bg);
        --footer-bg: var(--dark-footer-bg);
        --footer-fg: var(--dark-footer-fg);
    }
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--fg);
    background: var(--bg);
    transition: background-color 0.3s ease, color 0.2s ease;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
    filter: brightness(1.2);
}

/* Layout */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    border-radius: 12px;
    margin: 24px 16px;
    padding: 16px 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-title {
    margin: 0;
    padding: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.site-title a {
    color: var(--header-fg);
    text-decoration: none;
}

/* Post List */
.post-list {
    list-style: none;
    padding: 0;
}

.post-item {
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.3s ease;
}

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

/* Post Content */
.post-item .content > *:last-child {
    margin-bottom: 2.5rem;
}

.post-item h3,
.post h3 {
    font-size: 2rem;
    margin: 0 0 16px 0;
    line-height: 1.3;
    font-weight: 600;
}

.post-item h3 a,
.post h3 {
    color: var(--link);
    text-decoration: none;
}

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

/* Meta line with share button */
.meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
    transition: color 0.3s ease;
}

/* Share Button */
.share-button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s, background-color 0.2s;
    line-height: 1;
    margin-left: auto;
    color: var(--fg);
}

.share-button:hover {
    opacity: 1;
    transform: scale(1.05);
    background-color: var(--border);
}

/* Code Blocks */
pre {
    background: var(--pre-bg);
    color: var(--fg);
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

code {
    background: var(--code-bg);
    color: #e83e8c;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.9em;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    box-shadow: none;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

img.blog {
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

a:has(img.blog) {
    display: inline-block;
    transition: transform 0.3s ease;
}

a:has(img.blog):hover {
    transform: scale(1.02);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 48px 0 24px;
    padding: 24px 0 0;
    border-top: 1px solid var(--border);
    transition: border-color 0.3s ease;
}

.pagination-link {
    background: var(--link);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.pagination-link:hover {
    background: color-mix(in srgb, var(--link) 80%, black);
    text-decoration: none;
    transform: translateY(-1px);
}

.pagination-info {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

/* Heading Sizes & Styles */
h1 { font-size: 2.2rem; font-weight: 700; }
h2 { font-size: 1.8rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1.1rem; font-weight: 600; }
h6 { font-size: 1rem; font-weight: 600; }

h1, h2, h3, h4, h5, h6 {
    margin: 2rem 0 1rem 0;
    line-height: 1.3;
    color: var(--fg);
    transition: color 0.3s ease;
}

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

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding: 3rem 0;
    border-top: 1px solid var(--border);
    background: var(--footer-bg);
    color: var(--footer-fg);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.site-footer .container {
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
}

.site-footer .container p {
    margin: 0 0 0.5rem 0;
}

.site-footer .categories {
    margin: 1rem 0;
    line-height: 1.6;
}

.site-footer .categories a {
    color: var(--link);
    white-space: nowrap;
    margin-right: 0.5rem;
}

/* Search Component */
.search-container {
    position: relative;
    margin: 2rem 0;
    max-width: 100%;
}

.search-toggle {
    cursor: pointer;
    color: var(--link);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.search-toggle:hover {
    background-color: var(--border);
}

.search-input-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.search-input-wrapper.expanded {
    max-height: 500px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    margin-top: 1rem;
    background: var(--bg);
    color: var(--fg);
    transition: border-color 0.2s ease, background-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--link);
}

.search-help {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
    display: none;
    z-index: 999;
    line-height: 1.5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.search-help.active {
    display: block;
}

.search-help code {
    background: var(--code-bg);
    color: var(--link);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85em;
}

.search-results {
    position: absolute;
    top: calc(100% + 1rem);
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

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

.search-result-item:hover {
    background: var(--code-bg);
    text-decoration: none;
}

.search-result-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--link);
    font-size: 1.1rem;
}

.search-result-excerpt {
    font-size: 0.9rem;
    color: var(--muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 0 20px;
    }

    .site-header {
        margin: 16px 12px;
        padding: 12px 16px;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .post-item h3,
    .post h3 {
        font-size: 1.5rem;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }

    .pagination {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination-link {
        width: 100%;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .share-button,
    .search-container {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}
