:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --heading-color: #0f172a;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --sidebar-width: 320px;
    --container-width: 1100px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    overflow-x: hidden;
}

a {
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.main-layout {
    display: flex;
    gap: 2.5rem;
    margin-top: 2rem;
}

.content-area {
    flex: 1;
    min-width: 0;
    /* Fix flex child overflow */
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

/* Header */
header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    max-height: 40px;
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--heading-color);
    letter-spacing: -0.5px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: none;
    /* Firefox */
}

nav ul::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

nav a {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

nav a:hover {
    color: var(--primary-color);
}

/* Blog Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.post-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
}

.post-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.post-details {
    padding: 1.25rem;
}

.post-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
    letter-spacing: 0.5px;
}

.post-title {
    font-size: 1.2rem;
    color: var(--heading-color);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    font-weight: 700;
}

.post-card p {
    font-size: 0.95rem;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar Widgets */
.widget {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1rem;
    margin-bottom: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--primary-color);
    opacity: 0.2;
}

.widget-content ul {
    list-style: none;
}

.widget-content li {
    margin-bottom: 0.75rem;
}

.widget-content a {
    font-weight: 500;
    display: block;
    color: var(--text-color);
}

.widget-content a:hover {
    color: var(--primary-color);
    padding-left: 4px;
}

/* Single Post */
.single-post-content {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.single-post-header h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--heading-color);
    line-height: 1.2;
    font-weight: 800;
}

.single-post-featured-image {
    width: 100%;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.single-post-meta {
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    gap: 1rem;
}

.entry-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.entry-content p {
    margin-bottom: 1.5rem;
}

/* Related Articles */
.related-articles {
    margin-top: 3rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Footer */
footer {
    background: var(--heading-color);
    color: #94a3b8;
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
}

.footer-widget h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.footer-widget ul {
    list-style: none;
}

.footer-widget li {
    margin-bottom: 0.75rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 3rem;
    margin-top: 3rem;
    border-top: 1px solid #1e293b;
    font-size: 0.9rem;
}

/* Mobile Optimizations */
@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
        gap: 2rem;
    }

    .sidebar {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 1rem;
        /* More space for content */
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    nav {
        width: 100%;
    }

    nav ul {
        width: 100%;
        padding-bottom: 0.25rem;
    }

    nav a {
        font-size: 0.9rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .post-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin: 0 -1rem;
        /* Bleed to edges */
    }

    .single-post-content {
        padding: 1rem;
        border-radius: 0;
        margin: 0 -1rem;
        /* Bleed to edges */
        box-shadow: none;
    }

    .single-post-header h1 {
        font-size: 1.75rem;
    }

    .entry-content {
        font-size: 1rem;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        gap: 2rem;
    }
}

/* Admin Dashboard Mobile Fix */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
        /* In a real app we'd add a toggle */
    }

    .admin-main {
        padding: 1rem;
    }
}