/* BLOG GRID FIX - Complete Solution */
/* This file fixes the collapsed grid structure using CSS Grid */
/* Load this file LAST to override all other styles */

/* Override ALL conflicting styles - highest priority */
/* Use more specific selector to increase specificity */
.blog-grid-section .blog-grid-container .blog-listing.row,
section .blog-listing.row,
.blog-listing.row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    row-gap: 30px !important;
    column-gap: 30px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    width: 100% !important;
    clear: both !important;
    align-items: start !important; /* Align items to start to prevent spacing */
    grid-auto-rows: auto !important; /* Use auto instead of 1fr to prevent spacing */
    grid-row-gap: 30px !important;
    grid-column-gap: 30px !important;
}

/* Remove float from columns when using grid - override everything */
.blog-listing.row > [class*="col-"] {
    float: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    position: relative !important;
    box-sizing: border-box !important;
    display: block !important;
    flex: none !important;
    align-self: start !important; /* Align to start to prevent extra space */
}

/* Ensure cards fill their container */
.blog-listing.row > [class*="col-"] .blog-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Desktop: 3 columns */
@media (min-width: 992px) {
    .blog-listing.row {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 991px) {
    .blog-listing.row {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Mobile: 1 column */
@media (max-width: 767px) {
    .blog-listing.row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Modern Blog Card Styling - Dark Theme */
.blog-card {
    background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    flex-direction: column !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0 !important;
    backdrop-filter: blur(10px);
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #01c057 0%, #00d4aa 50%, #01c057 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.blog-card:hover::before {
    opacity: 1;
}

.blog-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 60px rgba(1, 192, 87, 0.3), 0 0 0 1px rgba(1, 192, 87, 0.2);
    border-color: rgba(1, 192, 87, 0.4);
    background: linear-gradient(145deg, #1f1f1f 0%, #333333 100%);
}

/* Card Image - Dark Theme */
.blog-card-image {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    flex-shrink: 0;
}

.blog-card-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(1, 192, 87, 0.1) 0%, rgba(0, 0, 0, 0.6) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.blog-card:hover .blog-card-image::after {
    opacity: 1;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(0.9) contrast(1.1);
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.15);
    filter: brightness(1) contrast(1.2);
}

/* Card Category Badge - Dark Theme */
.blog-card-category {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 2;
}

.blog-card-category span {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #01c057 0%, #00d4aa 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(1, 192, 87, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.blog-card:hover .blog-card-category span {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(1, 192, 87, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Card Overlay - Dark Theme - Fixed for clickability */
.blog-card-image {
    position: relative;
}

.blog-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(1, 192, 87, 0.95) 0%, rgba(0, 212, 170, 0.95) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 10 !important;
    backdrop-filter: blur(5px);
    pointer-events: none;
    text-decoration: none !important;
    cursor: pointer;
}

.blog-card:hover .blog-card-overlay {
    opacity: 1;
    pointer-events: auto !important;
}

.read-more-btn {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
    z-index: 11 !important;
    text-decoration: none !important;
    position: relative;
}

.read-more-btn:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Card Content - Dark Theme */
.blog-card-content {
    padding: 28px 24px;
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0;
    background: transparent;
}

/* Card Meta - Dark Theme */
.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #b0b0b0;
    flex-wrap: wrap;
}

.blog-card-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.blog-card-meta span:hover {
    color: #01c057;
}

.blog-card-meta i {
    font-size: 15px;
    color: #01c057;
    opacity: 1;
}

/* Card Title - Dark Theme */
.blog-card-title {
    margin: 0 0 16px 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
    color: #ffffff;
}

.blog-card-title a {
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.blog-card-title a:hover {
    color: #01c057;
    transform: translateX(4px);
    text-shadow: 0 2px 15px rgba(1, 192, 87, 0.4);
}

/* Card Excerpt - Dark Theme */
.blog-card-excerpt {
    font-size: 15px;
    line-height: 1.8;
    color: #cccccc;
    margin: 0 0 24px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Link - Dark Theme */
.blog-card-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #01c057;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: auto;
    padding-top: 16px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.blog-card-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #01c057 0%, #00d4aa 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(1, 192, 87, 0.5);
}

.blog-card-link:hover {
    color: #00d4aa;
    gap: 14px;
}

.blog-card-link:hover::after {
    width: 100%;
}

.blog-card-link i {
    font-size: 18px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 5px rgba(1, 192, 87, 0.5));
}

.blog-card-link:hover i {
    transform: translateX(6px);
}

/* Dark Theme - Hero and Intro Sections */
.blog-hero-section {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%) !important;
    color: #ffffff !important;
}

.blog-hero-section h1 {
    color: #ffffff !important;
    text-shadow: 0 2px 20px rgba(1, 192, 87, 0.3);
}

.blog-hero-section p {
    color: #cccccc !important;
}

/* Remove any vacant space - Direct approach */
.blog-hero-section {
    padding: 80px 0 0 0 !important;
    margin: 0 !important;
}

.blog-hero-section * {
    margin-bottom: 0 !important;
}

.blog-hero-content h1 {
    margin-bottom: 15px !important;
    margin-top: 0 !important;
}

.blog-hero-content p {
    margin-bottom: 15px !important;
    margin-top: 0 !important;
}

.blog-breadcrumb {
    margin: 0 !important;
    padding: 0 !important;
}

.blog-grid-section {
    padding: 40px 0 0 0 !important;
    margin: 0 !important;
}

/* Ensure no gap between sections */
section.blog-hero-section + section.blog-grid-section {
    margin-top: 0 !important;
    padding-top: 40px !important;
}

.blog-grid-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.blog-listing.row {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove all spacing from first row items */
.blog-listing.row > [class*="col-"]:first-child,
.blog-listing.row > [class*="col-"]:nth-child(2),
.blog-listing.row > [class*="col-"]:nth-child(3) {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove top margin from first card in first column - Most specific */
.blog-listing.row > [class*="col-"]:first-child .blog-card,
.blog-listing.row > [class*="col-"]:nth-child(2) .blog-card,
.blog-listing.row > [class*="col-"]:nth-child(3) .blog-card {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Ensure first card has no top spacing - Force grid position */
.blog-listing.row > [class*="col-"]:first-child {
    grid-row-start: 1 !important;
    align-self: start !important;
}

/* Remove ALL spacing that might create gap before grid */
.blog-intro-section {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    background: transparent !important;
}

.blog-intro-section .container {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.blog-intro-content {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .blog-card-image {
        height: 220px;
    }
    
    .blog-card-content {
        padding: 20px 16px;
    }
    
    .blog-card-title {
        font-size: 18px;
    }
}

@media (max-width: 767px) {
    .blog-card-image {
        height: 200px;
    }
    
    .blog-card-content {
        padding: 18px 14px;
    }
    
    .blog-card-title {
        font-size: 17px;
    }
    
    .blog-card-excerpt {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }
}
