
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark mode styles */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --header-gradient: linear-gradient(135deg, #4a4a4a 0%, #2d2d2d 100%);
    --shadow-color: rgba(0,0,0,0.3);
}

[data-theme="light"] {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: white;
    --border-color: #eee;
    --header-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-color: rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.header {
    background: var(--header-gradient);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.theme-toggle {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.posts-header, .post-card, .no-posts {
    background: var(--card-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.post-header {
    border-bottom: 1px solid var(--border-color);
}

.post-title {
    color: var(--text-color);
}

.post-content {
    color: var(--text-color);
}

.post-actions {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.blog-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
}

/* Main content */
.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Posts view */
.posts-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.posts-header h2 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.posts-count {
    color: #666;
    font-size: 0.9rem;
}

.posts-list {
    display: grid;
    gap: 2rem;
}

.post-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.post-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.post-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.post-content {
    padding: 1.5rem;
    color: #555;
    line-height: 1.7;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.post-actions {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-more {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: #764ba2;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #c82333;
}

/* No posts */
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-posts h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.no-posts p {
    color: #666;
    margin-bottom: 2rem;
}

/* New post form */
.post-form-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.post-form-container h2 {
    color: #667eea;
    margin-bottom: 2rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Editor */
.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border: 2px solid #e1e5e9;
    border-bottom: none;
}

.toolbar-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.content-editor {
    min-height: 300px;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 0 0 8px 8px;
    background: white;
    font-size: 1rem;
    line-height: 1.6;
    outline: none;
    transition: border-color 0.3s ease;
}

.content-editor:focus {
    border-color: #667eea;
}

.content-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.content-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.back-btn {
    margin-bottom: 2rem;
}

/* Single post view */
.single-post {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.single-post h1 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 2rem;
    line-height: 1.3;
}

.single-post .post-meta {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.single-post .post-content {
    padding: 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        text-align: center;
    }

    .blog-title {
        margin-bottom: 1rem;
    }

    .nav {
        justify-content: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .editor-toolbar {
        flex-wrap: wrap;
    }

    .post-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .post-form-container {
        padding: 1rem;
    }
    
    .blog-title {
        font-size: 1.5rem;
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}


/* Form and editor dark mode styles */
[data-theme="dark"] .post-form-container {
    background: var(--card-bg);
    box-shadow: 0 4px 15px var(--shadow-color);
}

[data-theme="dark"] .form-group label {
    color: var(--text-color);
}

[data-theme="dark"] .form-group input {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .editor-toolbar {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .toolbar-btn {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .toolbar-btn:hover {
    background: var(--border-color);
}

[data-theme="dark"] .content-editor {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .content-editor:empty:before {
    color: #666;
}

.content-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.back-btn {
    margin-bottom: 2rem;
}

/* Single post view */
.single-post {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.single-post h1 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 2rem;
    line-height: 1.3;
}

.single-post .post-meta {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.single-post .post-content {
    padding: 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        text-align: center;
    }

    .blog-title {
        margin-bottom: 1rem;
    }

    .nav {
        justify-content: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .editor-toolbar {
        flex-wrap: wrap;
    }

    .post-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .post-form-container {
        padding: 1rem;
    }
    
    .blog-title {
        font-size: 1.5rem;
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}
