/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    font-size: 16px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
}

/* Header */
header {
    padding: 40px 0;
    border-bottom: 1px solid #e1e5e9;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin: 0;
}

header h1 a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

header h1 a:hover {
    color: #666;
}

.main-nav {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #333;
}

.btn:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

.btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

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

.btn-secondary:hover {
    background: #545b62;
    border-color: #545b62;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

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

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

/* Login form */
.login-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.login-form input[type="password"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Filter section */
.filter-section {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.filter-section label {
    font-weight: 500;
    margin-right: 12px;
}

.filter-section select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Posts */
.posts {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.post {
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.post:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-header {
    padding: 24px 24px 0 24px;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.post-meta time {
    color: #666;
    font-size: 14px;
}

.post-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    background: #f1f3f4;
    color: #5f6368;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease;
}

.tag:hover {
    background: #e8eaed;
}

.post-content {
    padding: 0 24px;
    line-height: 1.7;
    color: #444;
}

.post-content p {
    margin-bottom: 16px;
}

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

.post-content ul, .post-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 4px;
}

.post-content a {
    color: #007bff;
    text-decoration: none;
}

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

.post-footer {
    padding: 16px 24px 24px 24px;
}

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #666;
}

.empty-state a {
    color: #007bff;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Write/Edit forms */
.write-form {
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    padding: 32px;
}

.write-form h2 {
    margin-bottom: 24px;
    font-size: 1.75rem;
    font-weight: 600;
}

.post-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-group label {
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

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

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.tag-suggestion {
    display: block;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.tag-suggestion:hover {
    background: #f8f9fa;
}

.tag-suggestion:last-child {
    border-bottom: none;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Danger zone */
.danger-zone {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #e1e5e9;
}

.danger-zone h3 {
    color: #dc3545;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

/* Messages */
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin-bottom: 20px;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    header {
        padding: 20px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .login-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .post-content {
        font-size: 15px;
    }
    
    .write-form {
        padding: 24px 16px;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .post {
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .filter-section {
        margin: 0 -16px 30px -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .write-form {
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}