/**
 * Mini CMS - Main Stylesheet
 * Responsive, SEO-friendly CSS
 */

/* CSS Variables */
:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 10px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
    --max-width: 1200px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

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

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Header */
.site-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo svg {
    stroke: var(--primary-color);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-color);
    font-weight: 500;
    padding: 5px 0;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 6rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: white;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-actions .btn-primary {
    background: white;
    color: var(--primary-color);
}

.hero-actions .btn-secondary {
    background: transparent;
    color: white;
    border-color: white;
}

.hero-actions .btn-secondary:hover {
    background: white;
    color: var(--primary-color);
}

/* Latest Posts */
.latest-posts {
    padding: 5rem 0;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* Post Card */
.post-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.post-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.post-card-image {
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    background-size: cover;
    background-position: center;
}

.post-card-content {
    padding: 1.5rem;
}

.post-card-category {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-light);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.post-card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Single Post */
.post-single {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 20px;
}

.post-header {
    text-align: center;
    margin-bottom: 2rem;
}

.post-meta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.post-meta span::before {
    content: '';
}

.post-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.post-author {
    color: var(--text-light);
}

.post-featured-image {
    margin: 2rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.post-content h2 {
    margin-top: 2rem;
}

.post-content img {
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

.post-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.post-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-light);
}

.post-content pre {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
}

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.post-tags {
    margin-bottom: 1rem;
}

.post-tags span {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.post-share {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.share-btn {
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Comments */
.post-comments {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.comment-form {
    margin-top: 2rem;
    background: var(--bg-light);
    padding: 2rem;
    border-radius: var(--radius);
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Page Content */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 20px;
}

.page-title {
    text-align: center;
    margin-bottom: 2rem;
}

.page-body {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Error Page */
.error-page {
    padding: 6rem 0;
    text-align: center;
}

.error-content {
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    color: var(--text-light);
}

.error-content h1 {
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Footer */
.site-footer {
    background: var(--bg-light);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-light);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-bottom p {
    margin-bottom: 0.5rem;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        box-shadow: var(--shadow);
        display: none;
    }

    .nav-menu.active {
        display: flex;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .post-title {
        font-size: 1.75rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .post-share,
    .post-comments,
    .hero-actions {
        display: none;
    }

    .post-single {
        max-width: 100%;
        padding: 0;
    }
}


/* Favorite Button */
.post-favorite {
    margin-bottom: 1.5rem;
}

.favorite-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    transition: var(--transition);
}

.favorite-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.favorite-btn.favorited {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.favorite-btn svg {
    transition: var(--transition);
}

/* Comments with Voting */
.post-comments h3 {
    margin-bottom: 1.5rem;
}

.comment {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.comment-author strong {
    color: var(--text-color);
}

.comment-author-link {
    color: var(--primary-color);
    font-size: 0.85rem;
}

.comment-author-link:hover {
    text-decoration: underline;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.comment-content {
    line-height: 1.7;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.comment-actions {
    display: flex;
    gap: 1rem;
}

.comment-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-light);
    transition: var(--transition);
}

.comment-vote-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.comment-vote-btn.like.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

.comment-vote-btn.dislike.active {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.vote-count {
    font-weight: 600;
}
