/* ============================================
   Blog System Stylesheet
   Modern, responsive design with premium feel
   ============================================ */

/* === CSS Variables === */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    --bg-dark-2: #1e293b;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 10px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --max-w: 1200px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 16px;
}

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

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

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

/* === Header === */
.blog-header {
    background: var(--bg-dark);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a {
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.search-form input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 40px 8px 16px;
    border-radius: 100px;
    font-size: 0.875rem;
    width: 220px;
    outline: none;
    transition: all var(--transition);
    font-family: var(--font);
}

.search-form input::placeholder {
    color: #64748b;
}

.search-form input:focus {
    border-color: var(--primary-light);
    background: rgba(255,255,255,0.12);
    width: 280px;
}

.search-form button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
}

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

.mobile-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all var(--transition);
}

/* === Blog Hero === */
.blog-hero {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a4e 50%, var(--primary-dark) 100%);
    padding: 72px 0 64px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.blog-hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
}

.blog-hero::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(245,158,11,0.1) 0%, transparent 70%);
    bottom: -150px;
    left: -50px;
    pointer-events: none;
}

.blog-hero h1 {
    color: #fff;
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.blog-hero p {
    color: #94a3b8;
    font-size: 1.15rem;
    max-width: 500px;
    margin: 0 auto;
}

.hero-count {
    display: inline-block;
    margin-top: 16px;
    padding: 6px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 100px;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 500;
}

/* === Hero Search Form === */
.hero-search-form {
    display: flex;
    max-width: 560px;
    margin: 28px auto 0;
    gap: 0;
}

.hero-search-form input {
    flex: 1;
    padding: 14px 24px;
    border: 2px solid rgba(255,255,255,0.15);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1rem;
    outline: none;
    font-family: var(--font);
    transition: all var(--transition);
}

.hero-search-form input::placeholder { color: #64748b; }
.hero-search-form input:focus { border-color: var(--primary-light); background: rgba(255,255,255,0.12); }

.hero-search-form button {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.hero-search-form button:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

/* === Blog Layout (Content + Sidebar) === */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 48px;
    padding: 48px 0 80px;
}

.blog-content { min-width: 0; }

/* === Posts Grid === */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.posts-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* === Post Card === */
.post-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}

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

.post-card-image {
    display: block;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--border-light);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #94a3b8;
}

.post-card-body {
    padding: 20px 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.post-card-category:hover {
    color: var(--primary-dark);
}

.post-card-body h2 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.post-card-body h2 a:hover {
    color: var(--primary);
}

.post-card-body h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
}

.post-card-body h3 a:hover {
    color: var(--primary);
}

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

.post-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-lighter);
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

/* === Sidebar === */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.sidebar-widget {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
    letter-spacing: -0.01em;
}

.category-list {
    list-style: none;
}

.category-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
    transition: all var(--transition);
}

.category-list li a:hover,
.category-list li.active a {
    background: var(--primary);
    color: #fff;
}

.category-list .count {
    font-size: 0.75rem;
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 600;
}

.category-list li a:hover .count,
.category-list li.active a .count {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.recent-posts {
    list-style: none;
}

.recent-posts li a {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition);
}

.recent-posts li:last-child a { border-bottom: none; }

.recent-posts li a:hover { opacity: 0.8; }

.recent-posts li a img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.rp-title {
    font-size: 0.88rem;
    font-weight: 600;
    display: block;
    line-height: 1.4;
    color: var(--text);
}

.recent-posts li a time {
    font-size: 0.75rem;
    color: var(--text-lighter);
}

/* === Pagination === */
.pagination {
    margin-top: 48px;
    display: flex;
    justify-content: center;
}

.pagination ul {
    list-style: none;
    display: flex;
    gap: 6px;
    align-items: center;
}

.pagination li a,
.pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    color: var(--text);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.pagination li a:hover {
    background: var(--primary);
    color: #fff;
}

.pagination li.active a {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.pagination li.dots span {
    background: none;
    box-shadow: none;
    color: var(--text-lighter);
}

/* === Single Post === */
.breadcrumb {
    background: var(--border-light);
    padding: 14px 0;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    gap: 4px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-lighter);
}

.breadcrumb li a {
    color: var(--text-light);
}

.breadcrumb li a:hover {
    color: var(--primary);
}

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin-left: 4px;
    color: var(--text-lighter);
}

.post-hero {
    background: var(--bg-dark);
    padding: 0;
}

.post-hero .container {
    max-width: 960px;
}

.post-hero img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.post-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    padding: 48px 0 80px;
}

.post-content-wrapper {
    min-width: 0;
}

.post-header {
    margin-bottom: 36px;
}

.post-category-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

.post-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.post-meta > * {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* === Post Body (Article Content) === */
.post-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #334155;
}

.post-body h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 40px 0 16px;
    letter-spacing: -0.02em;
}

.post-body h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 32px 0 12px;
}

.post-body p {
    margin-bottom: 20px;
}

.post-body ul, .post-body ol {
    margin: 16px 0 20px 24px;
}

.post-body li {
    margin-bottom: 8px;
}

.post-body blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 24px;
    margin: 24px 0;
    background: rgba(99,102,241,0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-light);
}

.post-body img {
    border-radius: var(--radius);
    margin: 24px 0;
    box-shadow: var(--shadow);
}

.post-body pre {
    background: var(--bg-dark);
    color: #e2e8f0;
    padding: 20px 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-body code {
    background: rgba(99,102,241,0.08);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.post-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

/* === Share Section === */
.post-share {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.post-share h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    transition: all var(--transition);
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.share-btn.twitter { background: #1da1f2; }
.share-btn.facebook { background: #1877f2; }
.share-btn.linkedin { background: #0a66c2; }

/* === Related Posts === */
.related-posts {
    padding: 48px 0 80px;
    border-top: 1px solid var(--border);
    margin-top: 0;
}

.related-posts h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 28px;
}

/* === No Results === */
.no-results {
    text-align: center;
    padding: 80px 0;
}

.no-results h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.no-results p {
    color: var(--text-light);
    margin-bottom: 24px;
}

.search-summary {
    margin-bottom: 28px;
    font-size: 1rem;
    color: var(--text-light);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    font-family: var(--font);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99,102,241,0.35);
    transform: translateY(-2px);
}

/* === Footer === */
.blog-footer {
    background: var(--bg-dark);
    padding: 64px 0 0;
    color: #94a3b8;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 48px;
}

.footer-col h3 {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-col h4 {
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-col p {
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li a {
    display: block;
    padding: 6px 0;
    font-size: 0.88rem;
    color: #94a3b8;
    transition: color var(--transition);
}

.footer-col ul li a:hover {
    color: #fff;
}

.footer-bottom {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
    font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .post-layout {
        grid-template-columns: 1fr;
    }
    .blog-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header-inner { height: 64px; }

    .main-nav {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-dark);
        flex-direction: column;
        padding: 16px;
        border-top: 1px solid rgba(255,255,255,0.06);
        gap: 4px;
        z-index: 99;
    }

    .main-nav.open { display: flex; }
    .main-nav a { width: 100%; }

    .mobile-toggle {
        display: flex;
    }

    .search-form { display: none; }

    .blog-hero h1 { font-size: 2rem; }
    .blog-hero { padding: 48px 0 40px; }

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

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

    .post-header h1 { font-size: 1.6rem; }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .hero-search-form {
        flex-direction: column;
        gap: 12px;
    }

    .hero-search-form input {
        border-radius: var(--radius);
        border-right: 2px solid rgba(255,255,255,0.15);
    }

    .hero-search-form button {
        border-radius: var(--radius);
    }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .blog-hero h1 { font-size: 1.6rem; }
    .post-header h1 { font-size: 1.35rem; }
    .post-body { font-size: 1rem; }
}
