:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #f72585;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #0055aa;
    text-decoration: underline;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary), #3a0ca3);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.logo span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

.nav-links a {
    color: var(--light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: white;
}

/* Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-btn {
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn {
    background: blue;
    border: 1px solid white;
    color: white;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.register-btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: white;
}

.register-btn:hover {
    background: #e5177e;
    border-color: #e5177e;
}

/* Mobile Menu Styles */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu-overlay.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary);
}

.mobile-menu-links {
    padding: 20px;
}

.mobile-menu-links a {
    display: block;
    padding: 15px 0;
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #f5f5f5;
}

.mobile-menu-links a:hover {
    color: var(--primary);
}

.mobile-auth-buttons {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Blog Title Section */
.page-title {
    background: #f5f5f5;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.page-title h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--dark);
}

.page-title p {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content Layout */
.main-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Sidebar Styles */
.sidebar {
    flex: 0 0 300px;
}

.search-box {
    display: flex;
    margin-bottom: 1.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.search-box button {
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: var(--secondary);
}

.categories, .recent-posts {
    background: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.categories h3, .recent-posts h3 {
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    color: var(--dark);
}

.categories ul, .recent-posts ul {
    list-style: none;
}

.categories li, .recent-posts li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.categories li:last-child, .recent-posts li:last-child {
    border-bottom: none;
}

.categories a, .recent-posts a {
    color: #333;
    display: block;
    padding: 0.3rem 0;
}

.categories a:hover, .recent-posts a:hover {
    color: var(--primary);
}

/* Content Area Styles */
.content-area {
    flex: 1;
}

/* Article Styles */
.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.article-image {
    height: 180px;
    background-size: cover;
    background-position: center;
}

.article-content {
    padding: 1.5rem;
}

.article-content h2 {
    margin-top: 0;
    font-size: 1.3rem;
    line-height: 1.3;
    color: var(--dark);
}

.article-meta {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 0.8rem;
}

.article-excerpt {
    margin-bottom: 1rem;
    color: #555;
}

.read-more {
    display: inline-block;
    font-weight: bold;
    color: var(--primary);
}

.read-more:hover {
    text-decoration: none;
}

/* Single Article View */
.single-article {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
}

.back-to-blog {
    background: #f5f5f5;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s;
}

.back-to-blog:hover {
    background: #e5e5e5;
}

.single-article h1 {
    font-size: 2rem;
    margin-top: 0;
    color: var(--dark);
}

.single-article .article-meta {
    margin: 1rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

#single-article-featured-image {
    margin: 1.5rem 0;
}

#single-article-featured-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

#single-article-content {
    line-height: 1.7;
}

#single-article-content p {
    margin: 1.2rem 0;
}

#single-article-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 4px;
}

.article-tags {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.article-tags span {
    display: inline-block;
    background: #f0f0f0;
    padding: 0.3rem 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #555;
}

/* Article Editor Styles */
.article-editor {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: none;
}

.article-editor h2 {
    margin-top: 0;
    color: var(--dark);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    min-height: 300px;
}

.formatting-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.formatting-buttons button {
    background: #f0f0f0;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.formatting-buttons button:hover {
    background: #e0e0e0;
}

#publish-article-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

#publish-article-btn:hover {
    background: #219653;
}

/* Admin Controls */
.admin-controls {
    margin-bottom: 1.5rem;
    text-align: right;
}

.admin-controls button {
    padding: 0.6rem 1.2rem;
    margin-left: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s;
}

.admin-controls button:first-child {
    margin-left: 0;
}

#new-article-btn, #save-article-btn {
    background: #27ae60;
    color: white;
}

#new-article-btn:hover, #save-article-btn:hover {
    background: #219653;
}

#edit-article-btn {
    background: #3498db;
    color: white;
}

#edit-article-btn:hover {
    background: #2980b9;
}

#cancel-edit-btn {
    background: #e74c3c;
    color: white;
}

#cancel-edit-btn:hover {
    background: #c0392b;
}

/* Comments section styling */
.comments-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.comments-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

#comments-container {
    margin-bottom: 1.5rem;
}

.comment {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f9f9f9;
    border-radius: 5px;
}

.comment-author {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.comment-date {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.comment-content {
    line-height: 1.5;
}

#new-comment {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-height: 100px;
}

#submit-comment {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#submit-comment:hover {
    background: var(--secondary);
}

/* Social sharing buttons */
.social-sharing {
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
}

.share-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.3s;
}

.share-btn:hover {
    opacity: 0.9;
}

.share-btn.facebook {
    background: #3b5998;
}

.share-btn.twitter {
    background: #1da1f2;
}

.share-btn.linkedin {
    background: #0077b5;
}

/* Auth Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.auth-modal.active {
    opacity: 1;
    visibility: visible;
}

.auth-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    background: none;
    border: none;
}

.close-modal:hover {
    color: var(--dark);
}

.auth-form h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.auth-form .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.auth-submit-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-submit-btn:hover {
    background: var(--secondary);
}

.switch-auth {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.switch-auth-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
}

.switch-auth-btn:hover {
    color: var(--secondary);
}

.form-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}

.form-group.error input {
    border-color: #dc3545;
}

.form-group.error .form-error {
    display: block;
}

/* Footer Styles */
.blog-footer {
    background: var(--dark);
    color: white;
    padding: 40px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-column h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 10px;
}

.footer-column ul li a {
    color: #adb5bd;
    transition: color 0.3s;
}

.footer-column ul li a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: white;
    font-size: 20px;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #adb5bd;
    font-size: 14px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-links {
        display: none;
    }
    
    .auth-buttons {
        display: none;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        flex: 1;
        order: 2;
    }
    
    .content-area {
        order: 1;
    }
    
    .articles-container {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .blog-footer {
        padding: 60px 0 20px;
    }
    
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 40px;
        margin-bottom: 40px;
    }
    
    .footer-column h3 {
        font-size: 18px;
    }
    
    .copyright {
        font-size: inherit;
    }
}

/* User Info Styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: white;
    font-size: 0.9rem;
}

.logout-btn {
    background: #e74c3c;
    border: 1px solid #e74c3c;
    color: white;
}

.logout-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.mobile-user-info {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    color: var(--dark);
}

.mobile-user-info span {
    display: block;
    text-align: center;
}

@media (max-width: 768px) {
    .mobile-user-info {
        display: flex;
    }
}