/* ============================================================
   BLOG MODULE - CSS STYLING
   ============================================================ */

/* Blog uses the main design system variables from modern-frontend.css */
/* Fallback values for standalone use */
:root {
    --primary-color: var(--color-primary, #007BFF);
    --primary-dark: var(--color-primary-dark, #0056b3);
    --text-dark: var(--color-gray-900, #0f172a);
    --text-light: var(--color-gray-500, #64748b);
    --bg-light: var(--color-gray-50, #f8fafc);
    --border-color: var(--color-gray-200, #e2e8f0);
    --shadow-sm: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
    --shadow-md: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

/* Main Container — sits inside site .container on post pages */
.blog-main {
    min-height: 50vh;
    background: #ffffff;
    padding-bottom: 40px;
}

/* Blog layout grid (inside .container — do not re-center with a second max-width) */
.blog-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 0 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 40px;
    align-items: start;
}

@media (max-width: 992px) {
    .blog-container {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 16px 0 30px;
    }
}

/* Blog Header */
.blog-header {
    background: linear-gradient(135deg, #7C4A85 0%, #4A2E4D 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
}

.blog-header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.blog-header-content p {
    font-size: 1.1rem;
    margin: 0 0 40px 0;
    opacity: 0.9;
}

.blog-search {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.blog-search:hover {
    border-color: #7C4A85;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.1);
}

.blog-search-input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 0;
    font-size: 1rem;
}

.blog-search-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #7C4A85 0%, #4A2E4D 100%);
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.blog-search-btn:hover {
    background: linear-gradient(135deg, #4A2E4D 0%, #3A243D 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(124, 74, 133, 0.2);
}

/* Blog Container — legacy standalone (kept for pages that still use it without .container) */
.blog-container.blog-container--standalone {
    max-width: 1680px;
    margin: 0 auto;
    padding: 40px 20px;
}

@media (max-width: 768px) {
    .blog-container.blog-container--standalone {
        padding: 20px 15px;
    }
}

/* Blog Posts Grid / main column */
.blog-content {
    grid-column: 1;
    min-width: 0; /* prevent grid blowout from wide content */
}

.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .blog-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Blog Card */
.blog-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card:hover {
    border-color: #7C4A85;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.1);
}

.blog-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.02);
}

.blog-card-image.placeholder {
    font-size: 2rem;
    color: var(--border-color);
}

.blog-card-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-category-tag {
    display: inline-block;
    background: #7C4A85;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
    text-decoration: none;
    width: fit-content;
    transition: all 0.2s ease;
}

.blog-category-tag:hover {
    background: #4A2E4D;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.2);
}

.blog-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.4;
    color: var(--text-dark);
}

.blog-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.blog-card-title a:hover {
    color: #7C4A85;
}

.blog-card-excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 15px 0;
    flex: 1;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.blog-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-card-meta i {
    color: #7C4A85;
}

/* No Posts Message */
.blog-no-posts {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.blog-no-posts i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

.blog-no-posts p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-dark);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-number:hover {
    border-color: #7C4A85;
    color: #7C4A85;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.1);
}

.pagination-number.active {
    background: linear-gradient(135deg, #7C4A85 0%, #4A2E4D 100%);
    color: white;
    border-color: #7C4A85;
}

.pagination-dots {
    color: var(--text-light);
}

/* Blog Sidebar */
.blog-sidebar {
    grid-column: 2;
}

@media (max-width: 768px) {
    .blog-sidebar {
        grid-column: 1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
    }
}

/* Sidebar Widgets */
.sidebar-widget {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    transition: all 0.2s ease;
}

@media (max-width: 768px) {
    .sidebar-widget {
        margin-bottom: 0;
    }
}

.sidebar-widget:hover {
    border-color: #7C4A85;
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.05);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--text-dark);
    padding-bottom: 15px;
    border-bottom: 2px solid #7C4A85;
}

/* Category List */
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-list li {
    margin-bottom: 12px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dark);
    text-decoration: none;
    padding: 8px 0;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    padding-left: 12px;
}

.category-link:hover {
    color: #7C4A85;
    border-left-color: #7C4A85;
}

.post-count {
    background: #7C4A85;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Recent Posts List */
.recent-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recent-posts-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.recent-posts-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.recent-post-link {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

.recent-post-link:hover {
    color: #7C4A85;
}

.recent-date {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    font-weight: 400;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-cloud-item {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    color: #7C4A85;
    border: 1px solid #7C4A85;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tag-cloud-item:hover {
    background: linear-gradient(135deg, #7C4A85 0%, #4A2E4D 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.2);
}

/* ============================================================
   INDIVIDUAL POST PAGE
   ============================================================ */

/* Breadcrumb — inherit site container width; no separate 1200px box */
.breadcrumb {
    max-width: none;
    margin: 0;
    padding: 20px 0 0;
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.breadcrumb a {
    color: #7C4A85;
    text-decoration: none;
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    color: #4A2E4D;
}

.breadcrumb span {
    color: var(--border-color);
}

/* Blog Post — only place in column 1 when it is a direct grid child
   (index/list layouts). On post pages the article sits inside .blog-content. */
.blog-container > .blog-post {
    grid-column: 1;
}

/* Post Header */
.post-header {
    margin-bottom: 40px;
}

.post-category {
    display: inline-block;
    background: #7C4A85;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.post-category:hover {
    background: #4A2E4D;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 74, 133, 0.2);
}

.post-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .post-title {
        font-size: 1.8rem;
    }
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    font-size: 0.95rem;
    color: var(--text-light);
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-meta i {
    color: var(--primary-color);
    width: 16px;
}

/* Featured Image */
.post-featured-image {
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    border-radius: 8px;
    margin: 40px 0;
    box-shadow: var(--shadow-md);
}

.post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Post Content */
.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-dark);
    margin: 40px 0;
}

.post-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 30px 0 15px 0;
    color: var(--text-dark);
}

.post-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 25px 0 12px 0;
    color: var(--text-dark);
}

.post-content p {
    margin: 0 0 15px 0;
}

.post-content ul,
.post-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.post-content li {
    margin: 8px 0;
}

.post-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 25px 0;
    font-style: italic;
    color: var(--text-light);
}

.post-content strong {
    color: var(--text-dark);
    font-weight: 700;
}

/* Post Footer */
.post-footer {
    margin-top: 40px;
    padding: 25px;
    background: var(--bg-light);
    border-radius: 8px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.post-tag {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.post-tag:hover {
    background: var(--primary-color);
    color: white;
}

/* Related Posts */
.related-posts {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border-color);
}

.related-posts h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.related-post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.related-post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.15);
}

.related-post-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.related-post-content {
    padding: 20px;
}

.related-post-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.related-post-content h3 a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s;
}

.related-post-content h3 a:hover {
    color: var(--primary-color);
}

.related-post-content p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0 0 12px 0;
}

.related-post-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.related-post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Related Products (Wave 49 — blog ↔ product cross-links) */
.related-products {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border-color);
}

.related-products h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.related-product-card {
    display: block;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.related-product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.15);
    color: inherit;
}

.related-product-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-product-content {
    padding: 16px;
}

.related-product-brand {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.related-product-content h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text-dark);
}

.related-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 178, 144, 0.3);
}

.btn-primary-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-primary-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .blog-header {
        padding: 40px 15px;
    }

    .blog-header-content h1 {
        font-size: 2rem;
    }

    .blog-header-content p {
        font-size: 1rem;
    }

    .post-meta {
        gap: 15px;
    }

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