/* Base styles - terminal-inspired, brutalist aesthetic */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f5f5f5;
    --bg-alt: #e8e8e8;
    --text: #333333;
    --text-muted: #666666;
    --accent: #4a90d9;
    --border: #ccc;
    --border-light: #ddd;
    --error: #d94a4a;
    --success: #4ad94a;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

/* Header */
header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
}

nav {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--text);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#auth-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Main content */
main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

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

/* Footer */
footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
}

/* Buttons */
button, .btn {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    cursor: pointer;
    border-radius: 2px;
}

button:hover, .btn:hover {
    background: var(--border-light);
}

button.primary, .btn.primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

button.primary:hover, .btn.primary:hover {
    background: #3a7ac9;
}

button.danger {
    color: var(--error);
    border-color: var(--error);
}

/* Forms */
input, textarea, select {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: 2px;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

textarea {
    min-height: 200px;
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: bold;
}


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

/* Home page */
.home-intro {
    text-align: center;
    padding: 3rem 0;
}

.home-intro h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.home-intro p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Blog profile */
.blog-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.blog-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.blog-header .bio {
    color: var(--text-muted);
}

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

.post-list li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.post-list h2 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.post-list .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.post-list .excerpt {
    color: var(--text-muted);
}

.post-list .status {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    margin-left: 0.5rem;
}

.post-list .status.draft {
    color: var(--text-muted);
}

.post-list .status.published {
    color: var(--success);
    border-color: var(--success);
}

/* Single post */
.post-header {
    margin-bottom: 2rem;
}

.post-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

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

.post-content {
    line-height: 1.8;
}

.post-content h1, .post-content h2, .post-content h3 {
    margin: 1.5rem 0 0.75rem;
}

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

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

.post-content blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1rem;
    color: var(--text-muted);
    margin: 1rem 0;
}

.post-content code {
    background: var(--bg-alt);
    padding: 0.2rem 0.4rem;
    border-radius: 2px;
    font-size: 0.9rem;
}

.post-content pre {
    background: var(--bg-alt);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.post-content pre code {
    background: none;
    padding: 0;
}

/* Language toggle */
.lang-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lang-toggle button {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.lang-toggle button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Language blocks - hidden by default */
.lang-block {
    display: none;
}

.lang-block.active {
    display: block;
}

/* Images in posts */
.blog-image {
    margin: 1.5rem 0;
}

.blog-image img {
    max-width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

.blog-image figcaption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

/* Gallery */
.gallery {
    margin: 1.5rem 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    cursor: pointer;
}

.gallery-caption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lightbox.hidden {
    display: none;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 1rem;
}

.lightbox-close {
    top: 0;
    right: 0;
}

.lightbox-prev {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Editor */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    min-height: 400px;
}

.editor-container textarea {
    min-height: 400px;
    font-family: 'Courier New', monospace;
}

.editor-preview {
    border: 1px solid var(--border);
    padding: 1rem;
    background: white;
    overflow-y: auto;
    max-height: 500px;
}

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.editor-toolbar button {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.editor-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Image library */
.image-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.image-library-item {
    position: relative;
    aspect-ratio: 1;
}

.image-library-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.image-library-item .id-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

.image-library-item .delete-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(217, 74, 74, 0.9);
    color: white;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
    display: none;
}

.image-library-item:hover .delete-btn {
    display: block;
}

/* Storage indicator */
.storage-indicator {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
}

.storage-bar {
    height: 8px;
    background: var(--border-light);
    margin-top: 0.5rem;
}

.storage-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}

.storage-bar-fill.warning {
    background: #d9a54a;
}

.storage-bar-fill.danger {
    background: var(--error);
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dashboard-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-tabs button {
    border: none;
    background: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.dashboard-tabs button.active {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1rem;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(74, 144, 217, 0.05);
}

.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(74, 144, 217, 0.1);
}

.upload-zone input[type="file"] {
    display: none;
}

/* Error message */
.error-message {
    background: rgba(217, 74, 74, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Success message */
.success-message {
    background: rgba(74, 217, 74, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Blog cards */
.blog-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.blog-card {
    background: white;
    border: 1px solid var(--border);
    padding: 1rem;
}

.blog-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.blog-card-url {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.blog-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.blog-card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.blog-card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.blog-card-actions button {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
}

/* Privacy badge */
.privacy-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background: var(--text-muted);
    color: white;
    margin-left: 0.5rem;
    vertical-align: middle;
    font-weight: normal;
}

.blog-url {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
    }

    .editor-preview {
        display: none;
    }

    .editor-container.preview-mode .editor-preview {
        display: block;
    }

    .editor-container.preview-mode textarea {
        display: none;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
