/* Blog Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0066cc;
    --primary-dark: #0052a3;
    --danger: #dc3545;
    --success: #28a745;
    --info: #17a2b8;
    --light: #f8f9fa;
    --border: #dee2e6;
    --text: #333;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: #fafafa;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
}

.nav-brand {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
}

.nav-brand a {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--primary);
}

.brand-logo {
    display: block;
    width: 60px !important;
    height: 60px !important;
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

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

.nav-link:hover {
    color: var(--primary);
}

.user-greeting {
    font-size: 0.9rem;
    color: #666;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: var(--success);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: var(--danger);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: var(--info);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
}

.checkbox-label { display: flex !important; align-items: center; gap: 0.5rem; margin-top: 0.75rem; font-weight: 400 !important; }
.checkbox-label input { width: auto; }
.featured-image-preview { display: block; width: min(320px, 100%); max-height: 200px; object-fit: cover; margin-top: 0.75rem; border: 1px solid var(--border); border-radius: 5px; }
.rich-editor { border: 1px solid var(--border); border-radius: 5px; background: white; overflow: hidden; }
.rich-editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1); }
.rich-editor-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.5rem; background: var(--light); border-bottom: 1px solid var(--border); }
.rich-editor-toolbar button { padding: 0.35rem 0.55rem; border: 1px solid #c7ccd1; border-radius: 3px; background: white; color: var(--text); cursor: pointer; font: inherit; font-size: 0.85rem; }
.rich-editor-toolbar button:hover, .rich-editor-toolbar button:focus { border-color: var(--primary); color: var(--primary); }
.rich-editor-surface { min-height: 340px; padding: 1rem; outline: none; overflow-y: auto; }
.rich-editor-surface p, .rich-editor-surface h2, .rich-editor-surface blockquote, .rich-editor-surface ul, .rich-editor-surface ol { margin-bottom: 0.85rem; }
.rich-editor-surface blockquote { padding-left: 1rem; border-left: 4px solid var(--border); color: #555; }
.rich-editor-source { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0 !important; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Auth Container */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-logo {
    display: block;
    width: 120px !important;
    height: 120px !important;
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    margin: -0.5rem auto 1rem;
}

.auth-container h2 {
    margin-bottom: 1.5rem;
}

.auth-container p {
    margin-top: 1rem;
    text-align: center;
}

.auth-container a {
    color: var(--primary);
    text-decoration: none;
}

.auth-container a:hover {
    text-decoration: underline;
}

/* Search */
.search-section {
    margin: 2rem 0;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

/* Posts List */
.posts-list {
    margin: 2rem 0;
}

.post-preview {
    background: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.post-preview:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-preview-image { width: 100%; height: 260px; object-fit: cover; border-radius: 5px; margin-bottom: 1rem; }

.post-preview h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

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

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

.post-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.post-preview p {
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

/* Single Post */
.post-single {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.post-single h1 {
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.post-content {
    margin-top: 2rem;
    line-height: 1.8;
    color: #444;
}

.post-featured-image { display: block; width: 100%; max-height: 520px; object-fit: cover; border-radius: 6px; margin-bottom: 1.5rem; }

.post-content p {
    margin-bottom: 1rem;
}

.post-content strong {
    font-weight: 600;
}

.post-content em {
    font-style: italic;
}

/* Comments */
.comments-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.comments-section h3 {
    margin-bottom: 1.5rem;
}

.comment-form {
    background: var(--light);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 5px;
}

.comment-form .form-group {
    margin-bottom: 1rem;
}

.comment-form textarea {
    resize: vertical;
}

.comments-list {
    margin-top: 2rem;
}

.comment {
    background: var(--light);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border-left: 4px solid var(--primary);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.comment-header strong {
    font-size: 1rem;
}

.comment-date {
    font-size: 0.85rem;
    color: #666;
}

.delete-link {
    color: var(--danger);
    text-decoration: none;
    font-size: 0.85rem;
}

.delete-link:hover {
    text-decoration: underline;
}

.comment-body {
    color: #555;
    line-height: 1.6;
}

.no-comments {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.5rem 0.75rem;
    background: white;
    color: var(--primary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--primary);
    color: white;
}

.page-info {
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

footer p {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .brand-logo {
        width: 52px !important;
        height: 52px !important;
    }

    .nav-brand {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input {
        width: 100%;
    }

    .post-single,
    .comments-section {
        padding: 1rem;
    }

    .post-single h1 {
        font-size: 1.5rem;
    }

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

    .pagination {
        font-size: 0.9rem;
    }

    .page-link,
    .page-info {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
}
/* Forms styled as links are used for CSRF-protected POST actions. */
.nav-inline-form,
.inline-form {
    display: inline;
    margin: 0;
}

.nav-button,
.link-button {
    appearance: none;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.link-button {
    color: #b42318;
    text-decoration: underline;
}
