:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --section-bg: #f9fafb;
    --border-color: #e5e7eb;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --max-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

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

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.hidden {
    display: none !important;
}

/* Header & Navigation */
header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

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

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-color);
    cursor: pointer;
}

nav ul {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-light);
    transition: var(--transition);
    position: relative;
}

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

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

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-card {
    animation: fadeIn 0.5s ease forwards;
}

.single-post-view {
    animation: fadeIn 0.5s ease forwards;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    outline: none;
    font-size: 0.875rem;
    width: 200px;
    transition: var(--transition);
}

.search-container input:focus {
    width: 250px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-container i {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 3rem 0;
}

.post-card {
    background: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

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

.post-img {
    height: 200px;
    width: 100%;
    object-fit: cover;
}

.post-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-category {
    display: inline-block;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

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

.post-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-light);
}

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

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    font-size: 1rem;
    transition: var(--transition);
}

.back-btn:hover {
    transform: translateX(-5px);
}

.single-post-header {
    margin-bottom: 2rem;
}

.single-post-header .post-category {
    font-size: 0.875rem;
}

.single-post-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.5rem 0 1rem;
    line-height: 1.2;
}

.single-post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
}

.single-post-img {
    width: 100%;
    border-radius: 1rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
}

.post-body {
    font-size: 1.125rem;
    color: var(--text-color);
    line-height: 1.8;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1rem;
}

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

.comments-section h3 {
    margin-bottom: 2rem;
}

#comments-display {
    margin-bottom: 3rem;
}

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

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    font-size: 0.9375rem;
}

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

.comment-text {
    font-size: 0.9375rem;
}

.comment-form-container {
    background: var(--section-bg);
    padding: 2rem;
    border-radius: 1rem;
}

.comment-form-container h4 {
    margin-bottom: 1.5rem;
}

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

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    outline: none;
    font-family: inherit;
    font-size: 0.9375rem;
}

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

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

.submit-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    background: var(--secondary-color);
}

/* Footer */
footer {
    background: #111827;
    color: var(--white);
    padding: 4rem 0 2rem;
    margin-top: 5rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-logo a {
    font-size: 1.5rem;
    font-weight: 700;
}

.footer-logo span {
    color: var(--primary-color);
}

.footer-logo p {
    margin-top: 0.5rem;
    color: #9ca3af;
    max-width: 300px;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
}

.footer-social a {
    font-size: 1.25rem;
    color: #9ca3af;
    transition: var(--transition);
}

.footer-social a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Responsiveness */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    nav {
        position: relative;
    }

    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--white);
        width: 200px;
        padding: 1rem;
        box-shadow: var(--shadow-md);
        border-radius: 0.5rem;
        gap: 1rem;
    }

    nav ul.active {
        display: flex;
    }
    
    .search-container {
        display: none; /* Hide search on mobile for simplicity, or move to menu */
    }
    
    .single-post-header h1 {
        font-size: 2rem;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-logo p {
        margin: 0.5rem auto;
    }
}
