/* Enhanced blog styling for iBoost theme */
html, body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

.blog-listing {
    padding: 2rem 0;
    background: #181e29;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.blog-listing .container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
    position: relative;
}

/* Desktop styles */
@media (min-width: 992px) {
    .blog-listing .container {
        padding: 0 3rem;
        max-width: 1400px;
    }
    
    .blog-listing .row {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
        gap: 1.5rem !important;
        padding: 0 !important;
        margin: 0 !important;
        flex-direction: unset !important;
    }
    
    .blog-post-card {
        margin: 0 0 2rem 0 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 0 !important;
    }
    
    .blog-post-card .card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .blog-post-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 35px rgba(0,0,0,0.25);
    }
}

/* Force all elements to stay within container */
.blog-listing *,
.blog-listing *:before,
.blog-listing *:after {
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Tablet and mobile styles */
@media (max-width: 991px) {
    .blog-listing {
        padding: 1rem 0;
    }
    
    .blog-listing .container {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    .blog-listing .row {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem;
        padding: 0;
    }
    
    .blog-post-card {
        width: 100% !important;
        margin: 0 0 1.5rem 0 !important;
        padding: 0 !important;
        height: auto !important;
    }
}

/* Grid layout - base styles */
.blog-listing .row {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
    position: relative;
    /* Default mobile layout */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Ensure proper spacing between cards */
.blog-post-card {
    width: 100%;
    height: auto;
    margin: 0 0 1.5rem 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #222a38;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-bottom: 3px solid #2d3a5a;
    box-sizing: border-box;
    border: none;
}

/* Ensure all card content stays within bounds */
.blog-post-card * {
    max-width: 100%;
    height: auto;
}

/* Card body styling */
.blog-post-card .card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

/* Card image styling */
.blog-post-card .card-img-top {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #2d3a5a;
}


.blog-post-card .card-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

@media (min-width: 1200px) {
    .blog-post-card .card-title {
        font-size: 1.1rem;
    }
}

.blog-post-card .card-title a {
    color: #ffb347;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-post-card .card-title a:hover {
    color: #fff;
    text-decoration: none;
}

.blog-post-card .card-text {
    color: #e0e6ed;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.blog-post-card .btn-primary {
    background: #ffb347;
    border: none;
    border-radius: 30px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    transition: background 0.2s;
    align-self: flex-start;
}

.blog-post-card .btn-primary:hover {
    background: #fff;
    color: #222a38;
}

/* Blog sidebar styling */
.blog-sidebar {
    margin-top: 2rem;
}

.blog-sidebar .card {
    border: none;
    border-radius: 16px;
    background: #222a38;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    overflow: hidden;
}

.blog-sidebar .card-header {
    background: #2d3a5a;
    color: #ffb347;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border: none;
}

.blog-sidebar .card-body {
    padding: 1.5rem;
}

.blog-sidebar .card-body a {
    color: #e0e6ed;
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.blog-sidebar .card-body a:hover {
    color: #ffb347;
}

.blog-sidebar .card-body a:last-child {
    border-bottom: none;
}

/* Image placeholder styling */
.post-image-placeholder {
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d3a5a;
    border-bottom: 1px solid #384766;
}

.placeholder-icon {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.3);
}

.post-meta {
    color: #a0a7b9;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.post-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-date i {
    color: #ffb347;
}

/* Pagination styling */
.pagination {
    margin-top: 3rem;
}

.pagination .page-link {
    background: #222a38;
    border-color: #2d3a5a;
    color: #e0e6ed;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin: 0 0.25rem;
}

.pagination .page-item.active .page-link {
    background: #ffb347;
    border-color: #ffb347;
    color: #222a38;
}

.pagination .page-link:hover {
    background: #2d3a5a;
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    background: #1b222f;
    color: #6c757d;
    border-color: #2d3a5a;
}

/* Blog header and category dropdown styling */
.blog-header {
    margin-bottom: 3rem;
}

/* Category navigation styling */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    background: #222a38;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 1rem 0 2rem;
    width: 100%;
    box-sizing: border-box;
}

.category-label {
    font-weight: bold;
    margin: 0 1rem 0.5rem 0;
    padding: 0.5rem 0;
    color: #ffb347;
    width: 100%;
}

.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.cat-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #2d3a5a;
    color: #e0e6ed;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.2s;
}

.cat-link:hover {
    background: #384766;
    color: #fff;
}

.cat-link.active {
    background: #ffb347;
    color: #222;
    font-weight: 500;
}

.blog-header h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: #ffb347;
    padding-bottom: 0.5rem;
    margin-right: 1rem;
}

.category-dropdown .btn {
    background-color: #ffb347;
    color: #222;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 30px;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.category-dropdown .btn:hover {
    background-color: #384766;
    border-color: #ffb347;
}

.category-dropdown .dropdown-menu {
    background-color: #222a38;
    border: 1px solid #384766;
    border-radius: 6px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.category-dropdown .dropdown-item {
    color: #e0e6ed;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.category-dropdown .dropdown-item:hover {
    background-color: #2d3a5a;
    color: #ffb347;
}

.category-dropdown .dropdown-item.active {
    background-color: #384766;
    color: #ffb347;
    font-weight: 500;
}

/* Card text sizing */
.blog-post-card .card-text {
    font-size: 0.95rem;
    color: #e0e6ed;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Large desktop improvements */
@media (min-width: 1200px) {
    .blog-listing .container {
        padding: 0 4rem;
        max-width: 1600px;
    }
    
    .blog-listing .row {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
        gap: 2rem !important;
    }
    
    .blog-post-card .card-img-top {
        height: 180px;
    }
    
    .blog-post-card .card-title {
        font-size: 1.1rem;
    }
    
    .blog-post-card .card-text {
        font-size: 0.9rem;
    }
}

/* Extra large desktop */
@media (min-width: 1600px) {
    .blog-listing .container {
        max-width: 1800px;
    }
    
    .blog-listing .row {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
        gap: 2.5rem !important;
    }
}

@media (max-width: 991px) {
    .blog-sidebar {
        margin-top: 3rem;
    }
}

@media (max-width: 767px) {
    .blog-listing .container {
        padding: 0 1rem;
    }
    
    .blog-listing .row {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        padding: 0;
    }
    
    /* Ensure proper spacing for mobile */
    .blog-post-card {
        margin-bottom: 1.5rem !important;
    }
    
    .blog-post-card .card-img-top,
    .post-image-placeholder {
        height: 200px;
    }
    
    .blog-post-grid .col-md-6 {
        margin-bottom: 2rem;
        padding: 0 0.5rem;
    }
    
    .blog-listing h1 {
        font-size: 1.5rem;
        margin: 1rem 0;
        padding: 0 0.5rem;
    }
    
    .blog-post-card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }
    
    .blog-post-card .card-body {
        padding: 1rem;
    }
    
    .blog-post-card .card-title {
        font-size: 1.1rem;
    }
    
    .blog-post-card .card-text {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .category-dropdown .btn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        margin: 1rem 0;
    }
    
    .pagination .page-item {
        margin: 0.25rem;
    }
}

/* Styles for single blog post view to ensure responsive design on mobile */
.single-post-container {
    padding: 0 0.5rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.single-post-container .featured-image {
    width: 100%;
    margin: 0 0 1.5rem;
    overflow: hidden;
    border-radius: 12px;
}

.single-post-container .featured-image img {
    max-width: 100%;
    height: auto;
    width: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
}

.single-post-container .post-body {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    box-sizing: border-box;
}

.single-post-container .post-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 8px;
}

.single-post-container .post-body iframe,
.single-post-container .post-body video {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
}

.single-post-container h1,
.single-post-container h2,
.single-post-container h3,
.single-post-container h4,
.single-post-container h5,
.single-post-container h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 767px) {
    .single-post-container {
        padding: 0 15px;
    }
    
    .single-post-container .featured-image img,
    .single-post-container .post-body img {
        width: 100%;
        height: auto;
    }
    
    .single-post-container .post-body {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .single-post-container h1 {
        font-size: 1.75rem;
    }
    
    .single-post-container h2 {
        font-size: 1.5rem;
    }
    
    .single-post-container h3 {
        font-size: 1.25rem;
    }
}
