/**
 * Elementor Blog Grid Widget - Frontend Styles
 * Version: 2.0.0
 * Description: Comprehensive styling for the blog grid widget
 */

/* ==========================================================================
   Container & Grid Layout
   ========================================================================== */

.ebgw-container {
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
}

.ebgw-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 0;
    margin: 0;
}

/* ==========================================================================
   Post Card Styles
   ========================================================================== */

.ebgw-post-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 6px 25px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    transform-origin: center center;
    will-change: transform, box-shadow;
}

.ebgw-post-card:hover {
    box-shadow: 0 15px 45px rgba(0,0,0,0.15);
}

/* Hover Animation Classes */
.ebgw-hover-translateY:hover {
    transform: translateY(-10px);
}

.ebgw-hover-scale:hover {
    transform: scale(1.05);
}

.ebgw-hover-rotate:hover {
    transform: rotate(1deg);
}

.ebgw-hover-skew:hover {
    transform: skewY(-0.5deg);
}

/* ==========================================================================
   Thumbnail Styles
   ========================================================================== */

.ebgw-thumbnail-container {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    flex-shrink: 0;
}

.ebgw-thumbnail-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.ebgw-thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ebgw-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
    transform: scale(1);
    will-change: transform;
}

.ebgw-default-thumbnail {
    width: 100%;
    height: 100%;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
}

.ebgw-default-thumbnail i {
    font-size: 48px;
    color: #ccc;
}

/* ==========================================================================
   Category Tag Styles
   ========================================================================== */

.ebgw-category-tag {
    position: absolute;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    z-index: 3;
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, #1C69D4, #1552A3);
    color: #fff;
    box-shadow: 0 4px 15px rgba(28,105,212,0.4);
    white-space: nowrap;
}

/* Category Tag Positions */
.ebgw-tag-top-left {
    top: 18px;
    left: 18px;
}

.ebgw-tag-top-right {
    top: 18px;
    right: 18px;
}

.ebgw-tag-bottom-left {
    bottom: 18px;
    left: 18px;
}

.ebgw-tag-bottom-right {
    bottom: 18px;
    right: 18px;
}

/* ==========================================================================
   Hover Overlay Styles
   ========================================================================== */

.ebgw-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    z-index: 2;
    pointer-events: none;
}

.ebgw-thumbnail-container:hover .ebgw-hover-overlay {
    opacity: 1;
}

.ebgw-hover-content {
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}

.ebgw-thumbnail-container:hover .ebgw-hover-content {
    transform: scale(1);
}

.ebgw-hover-content i {
    color: #fff;
    font-size: 36px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

/* ==========================================================================
   Post Content Styles
   ========================================================================== */

.ebgw-post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
}

.ebgw-content-wrapper {
    padding: 30px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    justify-content: space-between;
}

/* Post Title */
.ebgw-post-title {
    margin: 0 0 2px 0;
    padding: 0;
    font-size: 22px;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -0.2px;
}

.ebgw-title-link {
    color: #1a1a1a;
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
}

.ebgw-title-link:hover {
    color: #1C69D4;
    transform: translateX(2px);
}

/* Post Excerpt */
.ebgw-post-excerpt {
    color: #555;
    font-size: 15.5px;
    line-height: 1.65;
    margin: 0;
    padding: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Post Meta Styles
   ========================================================================== */

.ebgw-post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.ebgw-meta-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ebgw-meta-info span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.ebgw-meta-info i {
    font-size: 14px;
}

/* Read More Button */
.ebgw-read-more {
    color: #1C69D4;
    text-decoration: none;
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    position: relative;
    padding: 8px 0;
    display: inline-block;
}

.ebgw-read-more:hover {
    color: #1552A3;
    transform: translateX(5px);
}

.ebgw-read-more::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 0;
    width: 0;
    height: 2px;
    background: #1C69D4;
    transition: width 0.3s ease;
}

.ebgw-read-more:hover::after {
    width: 100%;
}

/* ==========================================================================
   Pagination Styles
   ========================================================================== */

.ebgw-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 10px;
}

.ebgw-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.ebgw-pagination .page-numbers:hover {
    background: #1C69D4;
    color: #fff;
    border-color: #1C69D4;
}

.ebgw-pagination .page-numbers.current {
    background: #1C69D4;
    color: #fff;
    border-color: #1C69D4;
}

.ebgw-pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* ==========================================================================
   Animation Effects
   ========================================================================== */

@keyframes ebgwFadeInUp {
    from {
        opacity: 0;
        transform: translateY(35px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ebgw-post-card {
    animation: ebgwFadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.ebgw-post-card:nth-child(1) { animation-delay: 0s; }
.ebgw-post-card:nth-child(2) { animation-delay: 0.1s; }
.ebgw-post-card:nth-child(3) { animation-delay: 0.2s; }
.ebgw-post-card:nth-child(4) { animation-delay: 0.3s; }
.ebgw-post-card:nth-child(5) { animation-delay: 0.4s; }
.ebgw-post-card:nth-child(6) { animation-delay: 0.5s; }
.ebgw-post-card:nth-child(7) { animation-delay: 0.6s; }
.ebgw-post-card:nth-child(8) { animation-delay: 0.7s; }
.ebgw-post-card:nth-child(9) { animation-delay: 0.8s; }

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Large screens */
@media (max-width: 1200px) {
    .ebgw-content-wrapper {
        padding: 25px 24px 28px;
        gap: 16px;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .ebgw-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px;
    }
    
    .ebgw-thumbnail-container {
        height: 240px;
    }
    
    .ebgw-content-wrapper {
        padding: 22px 20px 24px;
        gap: 14px;
    }
    
    .ebgw-post-title {
        font-size: 20px;
    }
    
    .ebgw-post-excerpt {
        font-size: 14.5px;
    }
}

/* Small tablets */
@media (max-width: 768px) {
    .ebgw-grid {
        gap: 20px;
    }
    
    .ebgw-thumbnail-container {
        height: 220px;
    }
    
    .ebgw-content-wrapper {
        padding: 20px 18px 22px;
        gap: 12px;
    }
    
    .ebgw-post-title {
        font-size: 18px;
    }
    
    .ebgw-post-excerpt {
        font-size: 14px;
        line-height: 1.6;
    }

    .ebgw-meta-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .ebgw-grid {
        grid-template-columns: 1fr !important;
        gap: 18px;
    }
    
    .ebgw-thumbnail-container {
        height: 200px;
    }
    
    .ebgw-content-wrapper {
        padding: 18px 16px 20px;
        gap: 10px;
    }
    
    .ebgw-post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ebgw-category-tag {
        top: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 10px;
    }

    .ebgw-pagination .page-numbers {
        min-width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Accessibility & Focus States
   ========================================================================== */

.ebgw-post-card:focus-within {
    outline: 2px solid #1C69D4;
    outline-offset: 2px;
}

.ebgw-title-link:focus,
.ebgw-read-more:focus,
.ebgw-thumbnail-link:focus {
    outline: 2px solid #1C69D4;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ebgw-post-card {
        border-width: 2px;
    }
    
    .ebgw-category-tag {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .ebgw-post-card {
        background: #1a1a1a;
        border-color: rgba(255,255,255,0.1);
    }
    
    .ebgw-title-link {
        color: #fff;
    }
    
    .ebgw-title-link:hover {
        color: #4a9eff;
    }
    
    .ebgw-post-excerpt {
        color: #ccc;
    }
    
    .ebgw-meta-info span {
        color: #999;
    }
    
    .ebgw-post-meta {
        border-top-color: rgba(255,255,255,0.1);
    }
    
    .ebgw-default-thumbnail {
        background: #2a2a2a;
    }
    
    .ebgw-default-thumbnail i {
        color: #666;
    }

    .ebgw-pagination .page-numbers {
        background: #2a2a2a;
        color: #fff;
        border-color: #444;
    }
    
    .ebgw-pagination .page-numbers:hover,
    .ebgw-pagination .page-numbers.current {
        background: #4a9eff;
        border-color: #4a9eff;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .ebgw-hover-overlay,
    .ebgw-category-tag,
    .ebgw-read-more::after {
        display: none !important;
    }
    
    .ebgw-post-card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .ebgw-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

.ebgw-thumbnail-image,
.ebgw-default-thumbnail {
    backface-visibility: hidden;
    perspective: 1000px;
}

.ebgw-post-card {
    contain: layout style;
}

/* Loading state for lazy loaded images */
.ebgw-thumbnail-image[loading="lazy"] {
    background: #f0f0f0;
}