/* =============================================
   Blog Layout CSS - Premium Dark Theme
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #e63946;
    --primary-dark: #c0313d;
    --primary-glow: rgba(230, 57, 70, 0.15);
    --primary-soft: rgba(230, 57, 70, 0.08);
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-surface: #1c2333;
    --bg-elevated: #21262d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-faint: #6e7681;
    --border: #30363d;
    --border-light: rgba(255, 255, 255, 0.06);
    --accent-glow: rgba(230, 57, 70, 0.15);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark) !important;
    color: var(--text) !important;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

::selection {
    background: var(--primary);
    color: #fff;
}

/* ==========================================
   BOOTSTRAP DARK OVERRIDES
   ========================================== */
.container,
.container-fluid {
    color: var(--text);
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-white {
    color: #fff !important;
}

.bg-white,
.bg-light {
    background-color: var(--bg-card) !important;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border: none !important;
    color: #fff !important;
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(230, 57, 70, 0.3);
    color: #fff !important;
}

.btn-outline-primary {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background: var(--primary) !important;
    color: #fff !important;
}

/* Tables (if used on frontend) */
.table,
.table> :not(caption)>*>* {
    background-color: transparent !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* ==========================================
   HEADER / NAVIGATION
   ========================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(13, 17, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.navbar {
    padding: 0.75rem 0;
}

.site-logo {
    max-height: 40px;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-toggler {
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    padding: 0.4rem 0.75rem;
    background: transparent !important;
}

.navbar-toggler:focus {
    box-shadow: none !important;
}

.navbar-collapse {
    background: rgba(13, 17, 23, 0.95);
}

@media (min-width: 992px) {
    .navbar-collapse {
        background: transparent;
    }
}

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
    position: relative;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-link:hover::after {
    width: 60%;
}

/* ==========================================
   SECTION TITLES
   ========================================== */
.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
    color: #fff;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    border-radius: 3px;
}

/* ==========================================
   POST CARDS
   ========================================== */
.posts-grid {
    display: grid;
    gap: 1.5rem;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    animation: fadeInUp 0.5s ease forwards;
}

.post-card:hover {
    transform: translateY(-6px);
    border-color: rgba(230, 57, 70, 0.3);
    box-shadow: var(--shadow-hover);
}

.post-card-image {
    display: block;
    height: 220px;
    overflow: hidden;
    position: relative;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.08);
}

.placeholder-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-surface);
    color: var(--text-faint);
    font-size: 2.5rem;
}

.post-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.post-card-body {
    padding: 1.25rem;
}

.post-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.post-title a {
    color: var(--text);
    transition: color var(--transition);
}

.post-title a:hover {
    color: var(--primary);
}

.post-excerpt {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

.post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-faint);
}

.post-meta i {
    color: var(--primary);
    opacity: 0.7;
}

/* ==========================================
   SINGLE POST
   ========================================== */
.single-post {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.post-title-single {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: #fff;
}

.post-meta-single {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.post-meta-single i {
    color: var(--primary);
    opacity: 0.7;
}

.post-meta-single a {
    color: var(--primary);
}

.featured-image {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.featured-image img {
    width: 100%;
    display: block;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #c9d1d9;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #fff;
    font-weight: 700;
}

.post-content p {
    margin-bottom: 1.25rem;
}

.post-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

.post-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-content a:hover {
    color: #ff6b6b;
}

.post-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    background: var(--bg-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.post-content code {
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #ff6b6b;
    border: 1px solid var(--border);
}

.post-content pre {
    background: var(--bg-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.post-content pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text);
}

.post-content ul,
.post-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-tags {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.post-tags i {
    color: var(--primary);
}

.tag-badge {
    display: inline-block;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin: 4px 4px 4px 0;
    transition: var(--transition);
}

.tag-badge:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

/* ==========================================
   RELATED POSTS
   ========================================== */
.related-posts {
    margin-top: 2.5rem;
}

.related-posts h3 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.related-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    border-color: rgba(230, 57, 70, 0.2);
}

.related-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.related-card h4 {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.blog-sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    color: #fff;
}

.category-list {
    list-style: none;
    padding: 0;
}

.category-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.category-list li:last-child {
    border: none;
    padding-bottom: 0;
}

.category-list a {
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    transition: var(--transition);
    padding: 2px 4px;
    border-radius: 4px;
}

.category-list a:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.category-list span {
    font-size: 0.8rem;
    color: var(--text-faint);
}

.popular-post-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.popular-post-item:last-child {
    border: none;
    padding-bottom: 0;
}

.popular-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.popular-post-item a {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    transition: var(--transition);
}

.popular-post-item a:hover {
    color: var(--primary);
}

/* ==========================================
   FOOTER
   ========================================== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding-top: 2.5rem;
    margin-top: 3rem;
}

.site-footer h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.site-footer p {
    color: var(--text-muted);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    padding: 0.3rem 0;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 4px;
}

.site-footer hr {
    border-color: var(--border);
    opacity: 0.5;
}

/* ==========================================
   BREADCRUMBS
   ========================================== */
.breadcrumb-nav {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.breadcrumb-nav a {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: var(--transition);
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-nav span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.breadcrumb-nav .separator {
    margin: 0 0.5rem;
    color: var(--text-faint);
}

/* ==========================================
   PAGINATION
   ========================================== */
.pagination {
    gap: 0.35rem;
    margin-top: 2rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover,
.page-link:focus {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: none;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.page-item.disabled .page-link {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-muted);
    opacity: 0.5;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    color: var(--primary);
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for post cards */
.post-card:nth-child(1) {
    animation-delay: 0s;
}

.post-card:nth-child(2) {
    animation-delay: 0.1s;
}

.post-card:nth-child(3) {
    animation-delay: 0.15s;
}

.post-card:nth-child(4) {
    animation-delay: 0.2s;
}

.post-card:nth-child(5) {
    animation-delay: 0.25s;
}

.post-card:nth-child(6) {
    animation-delay: 0.3s;
}

/* ==========================================
   AD CONTAINERS
   ========================================== */
.ad-container {
    margin: 1.5rem 0;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    .blog-sidebar {
        position: relative;
        top: 0;
        margin-top: 2rem;
    }

    .post-title-single {
        font-size: 1.75rem;
    }

    .single-post {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }

    .post-card-image {
        height: 180px;
    }

    .post-title-single {
        font-size: 1.4rem;
    }

    .post-meta-single {
        gap: 0.5rem;
    }

    .single-post {
        padding: 1rem;
        border-radius: var(--radius);
    }

    .site-footer {
        padding-top: 1.5rem;
    }
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}