/* Reset and base styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Typography */
h1,
h2,
h3 {
    line-height: 1.2;
    margin-top: 0;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header */
header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

header h1 {
    margin-bottom: 0;
}

/* Admin header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Posts */
.post {
    background: #fff;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.post h2 {
    margin-bottom: 0.5rem;
}

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

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    padding: 0 1rem;
    background-color: #0066cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #0052a3;
    text-decoration: none;
}

.btn-secondary {
    background-color: #666;
}

.btn-secondary:hover {
    background-color: #555;
}

.btn-primary {
    background-color: #28a745;
}

.btn-primary:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
}

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

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

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

.form-actions {
    margin-top: 1.5rem;
}

/* Editor form */
.editor-form {
    background: #fff;
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#upload-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

/* Table */
.posts-table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.posts-table th,
.posts-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.posts-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.posts-table tbody tr:hover {
    background-color: #f8f9fa;
}

.posts-table .actions {
    white-space: nowrap;
}

.posts-table .actions .btn {
    margin-right: 0.25rem;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-draft {
    background-color: #ffc107;
    color: #856404;
}

.status-published {
    background-color: #28a745;
    color: #fff;
}

/* Pagination */
.pagination {
    margin-top: 2rem;
    text-align: center;
}

/* Error messages */
.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Login page */
.login-page {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.login-page h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-page button {
    width: 100%;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0.25rem;
    }

    .post {
        padding: 0.5rem;
        border-radius: 0;
        box-shadow: none;
        margin-bottom: 1rem;
    }

    .post-content img {
        width: calc(100% + 1rem);
        max-width: calc(100% + 1rem);
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
    }

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

    .posts-table {
        font-size: 0.9rem;
    }

    .posts-table th,
    .posts-table td {
        padding: 0.5rem;
    }

    .posts-table .actions {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .posts-table .actions .btn {
        margin-right: 0;
    }

    .btn-small {
        height: 2.25rem;
        padding: 0 0.5rem;
    }

    .login-page {
        margin: 1rem;
        padding: 1rem;
    }
}
