/**
 * Blog CSS - Consolidated styles for all blog pages
 * Include: <link rel="stylesheet" href="common/blog.css">
 */

/* ========== Blog Index (Grid) ========== */
.blog-grid-hero {
    padding: 120px 0 80px;
}
.blog-grid-card {
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}
.blog-grid-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}
[data-bs-theme="dark"] .blog-grid-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}
.blog-grid-card .badge-popular {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
}
.blog-grid-card .card-body {
    display: flex;
    flex-direction: column;
}
.blog-grid-card .card-text {
    flex-grow: 1;
}
.blog-grid-card .card-img-wrap {
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a237e 0%, #3949ab 100%);
}
.blog-grid-card .card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.blog-grid-card .card-img-wrap .date-badge,
.blog-grid-card .card-body .read-time,
.blog-grid-card .card-body .blog-meta {
    display: none;
}
[data-bs-theme="dark"] .blog-grid-card .card-img-wrap {
    background: linear-gradient(135deg, #0a0e2e 0%, #1a1f3a 100%);
}

/* ========== Blog Detail Page (Hero, Articles, TOC) ========== */
.blog-page-hero {
    padding: 120px 0 60px;
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
    color: #fff;
}
[data-bs-theme="dark"] .blog-page-hero {
    background: linear-gradient(135deg, #0a0e2e 0%, #121629 50%, #1a1f3a 100%);
}
.blog-article {
    padding: 2.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
[data-bs-theme="dark"] .blog-article {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
.blog-article:last-of-type {
    border-bottom: none;
}
.blog-article h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.blog-article h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
.blog-article h5 {
    font-size: 1.1rem;
}
.blog-article .video-wrap {
    max-width: 640px;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.blog-toc {
    position: sticky;
    top: 90px;
}
.blog-toc .list-group-item {
    border-radius: 8px;
    margin-bottom: 4px;
}

/* Comparison table - theme aware (light/dark mode) */
.blog-comparison-table thead th {
    background-color: #1a237e !important;
    color: #fff !important;
    border-color: #1a237e !important;
}
.blog-comparison-table tbody td {
    background-color: var(--bg-color);
    color: var(--text-color);
}
.blog-comparison-table tbody tr:nth-child(even) td {
    background-color: var(--card-bg);
}
[data-bs-theme="dark"] .blog-comparison-table thead th {
    background-color: #0a0e2e !important;
    color: #fff !important;
    border-color: #1a1f3a !important;
}
[data-bs-theme="dark"] .blog-comparison-table tbody td {
    background-color: var(--bg-color);
    color: var(--text-color);
}
[data-bs-theme="dark"] .blog-comparison-table tbody tr:nth-child(even) td {
    background-color: var(--card-bg);
}
[data-bs-theme="dark"] .blog-comparison-table {
    border-color: rgba(255, 255, 255, 0.15);
}
[data-bs-theme="dark"] .blog-comparison-table th,
[data-bs-theme="dark"] .blog-comparison-table td {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Code block with Copy button */
.code-block-wrapper {
    position: relative;
}
.code-block-wrapper .copy-btn {
    margin-top: 0.5rem;
}
[data-bs-theme="dark"] .code-block-wrapper pre {
    background-color: rgba(0, 0, 0, 0.2) !important;
    color: var(--text-color);
}

/* FAQ & Feature Box (khaiwal-software) */
.faq-item {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
[data-bs-theme="dark"] .faq-item {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
.feature-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    margin: 1rem 0;
    border-left: 4px solid #1a237e;
}
[data-bs-theme="dark"] .feature-box {
    border-left-color: #3949ab;
}

/* ========== Blog Detail Hero Image + Meta (Mobile) ========== */
.blog-detail-hero-img {
    position: relative;
    width: 100%;
    margin-top: 60px;
    overflow: hidden;
}
.blog-detail-hero-img img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}
.blog-detail-hero-img .bookmark-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.blog-detail-hero-img .bookmark-btn:hover {
    background: #f8f9fa;
    color: #1a237e;
}
.blog-detail-meta {
    padding: 1rem 0 0.5rem;
}
.blog-detail-meta .author {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.35rem;
}
.blog-detail-meta .blog-detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--text-color);
}

/* ========== Mobile: Blog Index ========== */
@media (max-width: 991px) {
    .blog-grid-hero {
        padding: 100px 0 40px;
    }
    .blog-grid-hero + .section {
        padding: 1rem 0 5rem 0;
        background-color: var(--bg-color);
        transition: background-color 0.3s ease;
    }
    .blog-mobile-header {
        display: block !important;
        margin-bottom: 1.5rem;
    }
    .blog-mobile-header h2 {
        font-size: 1.75rem;
        font-weight: 700;
        margin-bottom: 1rem;
        color: var(--text-color);
    }
    .blog-search-wrap {
        position: relative;
        margin-bottom: 1.5rem;
    }
    .blog-search-wrap input {
        width: 100%;
        padding: 12px 45px 12px 45px;
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.12);
        font-size: 0.95rem;
        background: var(--card-bg);
        color: var(--text-color);
    }
    [data-bs-theme="dark"] .blog-search-wrap input {
        border-color: rgba(255, 255, 255, 0.15);
        background: var(--card-bg);
    }
    .blog-search-wrap .search-icon {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #6c757d;
        font-size: 1.1rem;
    }
    .blog-search-wrap .filter-icon {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #6c757d;
        font-size: 1.1rem;
    }
    .blog-mobile-list {
        display: flex !important;
        flex-direction: column;
        gap: 1.25rem;
    }
    .blog-mobile-list .blog-grid-card {
        display: flex !important;
        flex-direction: row !important;
        height: auto !important;
        overflow: hidden;
    }
    .blog-mobile-list .blog-grid-card .card-img-wrap {
        width: 120px;
        min-width: 120px;
        height: 120px;
        position: relative;
    }
    .blog-mobile-list .blog-grid-card .card-img-wrap .date-badge {
        display: block !important;
        position: absolute;
        top: 8px;
        left: 8px;
        background: rgba(0, 0, 0, 0.6);
        color: #fff;
        padding: 4px 8px;
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 600;
    }
    .blog-mobile-list .blog-grid-card .card-body .read-time {
        display: block !important;
        font-size: 0.75rem;
        color: #6c757d;
        margin-bottom: 6px;
    }
    .blog-mobile-list .blog-grid-card .card-body .blog-meta {
        display: flex !important;
        gap: 12px;
        font-size: 0.8rem;
        color: #6c757d;
        margin-top: auto;
    }
    .blog-mobile-list .blog-grid-card .card-body .blog-meta span {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .blog-mobile-list .blog-grid-card .card-body {
        flex: 1;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        text-align: left;
    }
    .blog-mobile-list .blog-grid-card .card-body .card-title {
        font-size: 1rem;
        margin: 0 0 8px 0;
        line-height: 1.3;
        font-weight: 600;
    }
    .blog-mobile-list .blog-grid-card .card-body .card-text {
        display: none;
    }
    .blog-mobile-list .blog-grid-card .card-body .btn,
    .blog-mobile-list .blog-grid-card .card-body .badge {
        display: none;
    }
}
@media (min-width: 992px) {
    .blog-mobile-header {
        display: none !important;
    }
}

/* ========== Mobile: Blog Detail Page ========== */
@media (max-width: 991px) {
    .blog-detail-page .navbar-custom {
        background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%) !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    }
    [data-bs-theme="dark"] .blog-detail-page .navbar-custom {
        background: linear-gradient(135deg, #0a0e2e 0%, #121629 50%, #1a1f3a 100%) !important;
    }
    .blog-page-hero {
        display: none !important;
    }
    .blog-detail-hero-img {
        display: block !important;
        padding: 0 1rem;
    }
    .blog-detail-hero-img img {
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
        max-height: 280px;
    }
    .blog-detail-meta {
        display: block !important;
        padding: 1.25rem 1rem 1rem;
    }
    .blog-toc-col {
        display: none !important;
    }
    .blog-content-col {
        max-width: 100%;
        flex: 0 0 100%;
    }
    .blog-article {
        padding: 1.5rem 0;
    }
    .blog-article h2 {
        font-size: 1.35rem;
        margin-bottom: 0.75rem;
    }
    .blog-article h3 {
        font-size: 1.15rem;
        margin-top: 1.25rem;
        margin-bottom: 0.5rem;
    }
    .blog-article h5 {
        font-size: 1rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }
    .blog-article p {
        margin-bottom: 1rem;
        line-height: 1.65;
    }
    .blog-detail-section {
        padding: 1rem 0 5rem 0 !important;
        background-color: var(--bg-color);
    }
}
@media (min-width: 992px) {
    .blog-detail-hero-img,
    .blog-detail-meta {
        display: none !important;
    }
}
