/**
 * Custom Blog Grid Widget Styles
 * Version: 1.0.0
 */

/* Container Styles */
.custom-blog-grid {
    padding: 60px 0;
    background: transparent;
}

.blog-grid-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.blog-grid-row {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

/* Column Layouts */
.blog-grid-row.columns-1 {
    grid-template-columns: 1fr;
}

.blog-grid-row.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.blog-grid-row.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.blog-grid-row.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Blog Card Container */
.blog-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.blog-card:hover {
    transform: translateY(-5px);
}

/* Staggered Animation */
.blog-card:nth-child(1) {
    animation-delay: 0.1s;
}

.blog-card:nth-child(2) {
    animation-delay: 0.2s;
}

.blog-card:nth-child(3) {
    animation-delay: 0.3s;
}

.blog-card:nth-child(4) {
    animation-delay: 0.4s;
}

.blog-card:nth-child(5) {
    animation-delay: 0.5s;
}

.blog-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* Image Container with Zoom Effect */
.blog-card-image-wrapper {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    height: 250px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    background: #000;
}

.blog-card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.5s ease;
}

/* Zoom in on hover */
.blog-card:hover .blog-card-image {
    transform: scale(1.1);
}

/* Dark Overlay for better text visibility */
.blog-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: 1;
}

/* Yellow Title Box Overlaid on Image */
.blog-title-box {
    position: absolute;
    background: #C8E01E;
    padding: 15px 20px;
    border-radius: 12px;
    z-index: 2;
    max-width: 85%;
    transition: all 0.3s ease;
    bottom: 20px;
    left: 20px;
}

/* Different positions for variety */
.blog-card:nth-child(3n+2) .blog-title-box {
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.blog-card:nth-child(3n) .blog-title-box {
    left: auto;
    right: 20px;
}

.blog-card:hover .blog-title-box {
    background: #D4F028;
}

.blog-title-box h3 {
    margin: 0;
    color: #000000;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    font-family: 'Poppins', 'Arial', sans-serif;
}

/* White text overlay (optional) */
.blog-white-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 400;
    z-index: 2;
    text-align: center;
    width: 80%;
    font-family: 'Poppins', 'Arial', sans-serif;
}

/* Content Area Below Image */
.blog-card-content {
    padding: 20px 0;
}

.blog-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 12px 0;
    line-height: 1.3;
    font-family: 'Poppins', sans-serif;
}

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

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

.blog-excerpt {
    color: #666666;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 15px 0;
    font-family: 'Open Sans', 'Arial', sans-serif;
}

/* Read More Link */
.read-more-link {
    display: inline-flex;
    align-items: center;
    color: #8BC34A;
    font-weight: 700;
    text-decoration: none;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.read-more-link:hover {
    color: #689F38;
}

.read-more-link .arrow-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #8BC34A;
    border-radius: 50%;
    margin-right: 8px;
    transition: background 0.3s ease;
    position: relative;
}

.read-more-link:hover .arrow-icon {
    background: #689F38;
}

.read-more-link .arrow-icon::before {
    content: '→';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
    .blog-grid-row.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .blog-grid-row.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .blog-card-image-wrapper {
        height: 220px;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    .custom-blog-grid {
        padding: 40px 0;
    }
    
    .blog-grid-row {
        gap: 20px;
    }
    
    .blog-grid-row.columns-2,
    .blog-grid-row.columns-3,
    .blog-grid-row.columns-4 {
        grid-template-columns: 1fr;
    }
    
    .blog-card-image-wrapper {
        height: 200px;
    }
    
    .blog-title-box {
        padding: 12px 16px;
        max-width: 90%;
    }
    
    .blog-title-box h3 {
        font-size: 16px;
    }
    
    /* Reset positions on mobile for better readability */
    .blog-card:nth-child(3n+2) .blog-title-box,
    .blog-card:nth-child(3n) .blog-title-box {
        left: 20px;
        right: auto;
        transform: none;
        text-align: left;
    }
    
    .blog-card-title {
        font-size: 18px;
    }
    
    .blog-excerpt {
        font-size: 14px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .blog-card-image-wrapper {
        height: 180px;
    }
    
    .blog-title-box {
        padding: 10px 15px;
        bottom: 15px;
        left: 15px;
    }
    
    .blog-title-box h3 {
        font-size: 14px;
    }
    
    .blog-card-title {
        font-size: 16px;
    }
    
    .read-more-link {
        font-size: 12px;
    }
}

/* Elementor Editor Styles */
.elementor-editor-active .custom-blog-grid {
    min-height: 300px;
}

.elementor-widget-empty-icon {
    text-align: center;
    padding: 40px;
    color: #999;
}

.elementor-widget-empty-icon i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

/* Fix for RTL layouts */
.rtl .blog-card:nth-child(3n) .blog-title-box {
    right: auto;
    left: 20px;
}

.rtl .read-more-link .arrow-icon {
    margin-right: 0;
    margin-left: 8px;
}

.rtl .read-more-link .arrow-icon::before {
    content: '←';
}