/* ==================== BUILDER PREVIEW ==================== */
.dmp-builder-preview {
    transition: all 0.3s ease;
    cursor: pointer;
}

.dmp-builder-preview:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15) !important;
}

/* ==================== STILURI DE BAZĂ ==================== */
.dmp-masonry-pro-plus {
    width: 100%;
    margin: 0 auto;
    padding: 20px 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.dmp-masonry-pro-plus.dmp-loaded {
    opacity: 1;
}

.dmp-grid-container {
    width: 100%;
    margin: 0 auto;
}

.dmp-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(var(--dmp-columns, 3), 1fr);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dmp-grid.dmp-ready {
    opacity: 1;
}

.dmp-grid-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.dmp-item-inner {
    position: relative;
    height: 100%;
}

.dmp-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.5s ease;
}

.dmp-grid-item:hover {
    transform: translateY(-5px);
}

.dmp-grid-item:hover .dmp-image {
    transform: scale(1.03);
}

/* ==================== FILTRE ==================== */
.dmp-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.dmp-filters.dmp-filters-top {
    justify-content: center;
}

.dmp-filters.dmp-filters-left {
    flex-direction: column;
    align-items: flex-start;
    margin-right: 30px;
    margin-bottom: 0;
    max-width: 200px;
}

.dmp-filter-btn {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dmp-filter-btn:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.dmp-filter-btn.active:after {
    width: 100%;
}

.dmp-filter-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.dmp-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.dmp-filter-count {
    font-size: 12px;
    opacity: 0.7;
    margin-left: 5px;
}

/* ==================== LIGHTBOX ICON ==================== */
.dmp-lightbox-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 5;
}

.dmp-grid-item:hover .dmp-lightbox-icon {
    opacity: 1;
}

.dmp-lightbox-icon:hover {
    transform: scale(1.2);
    background: white !important;
    color: #764ba2 !important;
}

.dmp-lightbox-icon svg {
    width: 20px;
    height: 20px;
}

/* ==================== CAPTION ==================== */
.dmp-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 20px 15px 10px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translateY(10px);
}

.dmp-grid-item:hover .dmp-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== POST CONTENT ==================== */
.dmp-post-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

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

.dmp-post-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    color: #333;
}

.dmp-post-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.dmp-post-author {
    font-weight: 500;
}

.dmp-post-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

/* ==================== NO CONTENT MESSAGE ==================== */
.dmp-no-content {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    color: #495057;
}

.dmp-no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #666;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .dmp-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 992px) {
    .dmp-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .dmp-filters {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dmp-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .dmp-filter-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .dmp-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dmp-post-content {
        padding: 15px;
    }
    
    .dmp-filters {
        flex-direction: column;
        align-items: center;
    }
    
    .dmp-filter-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes dmpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.dmp-fade-in {
    animation: dmpFadeIn 0.5s ease;
}

.dmp-slide-up {
    animation: dmpSlideUp 0.5s ease;
}

/* ==================== LOADING STATES ==================== */
.dmp-loading {
    position: relative;
    min-height: 200px;
}

.dmp-loading:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: dmpSpin 1s linear infinite;
}

@keyframes dmpSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==================== DEBUG MODE ==================== */
.dmp-debug {
    border: 2px dashed #ff6b6b !important;
    position: relative;
}

.dmp-debug:before {
    content: 'DEBUG';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    z-index: 100;
}

/* ==================== UTILITY CLASSES ==================== */
.dmp-hidden {
    display: none !important;
}

.dmp-visible {
    display: block !important;
}
/* ==================== POST STYLES ==================== */
.dmp-post-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.dmp-post-link:hover .dmp-image {
    transform: scale(1.05);
}

.dmp-post-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.dmp-post-title a:hover {
    color: #667eea;
}

.dmp-meta-separator {
    color: #999;
    margin: 0 5px;
}

.dmp-read-more {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.dmp-read-more:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Post lightbox icon */
.dmp-post-lightbox {
    top: 15px;
    right: 15px;
    z-index: 3;
}

.dmp-lightbox-overlay-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
}

/* ==================== MASONRY GRID FIX ==================== */
.dmp-grid {
    display: grid;
    grid-auto-flow: dense;
    grid-auto-rows: 20px; /* Controls row height */
}

.dmp-grid-item {
    grid-row-end: span var(--dmp-item-height, 15);
}

.dmp-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Adjust heights for different content */
.dmp-post-item {
    --dmp-item-height: 25; /* Posts are taller */
}

/* ==================== LIGHTBOX IMPROVEMENTS ==================== */
#dmp-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: grab;
}

#dmp-lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

#dmp-lightbox-overlay.dragging {
    cursor: grabbing;
}

.dmp-lightbox-image-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dmp-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform-origin: center center;
    transition: transform 0.3s ease;
}

/* Lightbox navigation */
.dmp-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.dmp-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.dmp-lightbox-prev {
    left: 30px;
}

.dmp-lightbox-next {
    right: 30px;
}

/* Lightbox counter */
.dmp-lightbox-counter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    z-index: 10;
}

/* ==================== RESPONSIVE LIGHTBOX ==================== */
@media (max-width: 768px) {
    .dmp-lightbox-nav {
        width: 50px;
        height: 50px;
        bottom: 20px;
        top: auto;
        transform: none;
    }
    
    .dmp-lightbox-prev {
        left: 20px;
    }
    
    .dmp-lightbox-next {
        right: 20px;
    }
    
    .dmp-lightbox-counter {
        top: 20px;
        font-size: 14px;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.dmp-image-loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dmp-image-loaded {
    opacity: 1;
}
/* ==================== FIX BUTTON CONTAINER ==================== */
.dmp-read-more-container {
    margin-top: auto; /* Push button to bottom */
    padding-top: 20px;
}

.dmp-read-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    min-width: 140px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.dmp-read-more:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dmp-read-more:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}

.dmp-read-more:hover:before {
    opacity: 1;
}

.dmp-read-more:after {
    content: '→';
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.dmp-read-more:hover:after {
    transform: translateX(5px);
}

/* Ensure post content has proper spacing */
.dmp-post-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dmp-post-excerpt {
    flex-grow: 1;
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ==================== BUILDER FIXES ==================== */
.et_pb_module.dmp_masonry_module .dmp-builder-preview {
    min-height: 250px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ==================== LIGHTBOX CUSTOM STYLES ==================== */
.dmp-lightbox-close.custom-styled,
.dmp-lightbox-nav.custom-styled {
    border: 2px solid currentColor !important;
}

/* Override for dark backgrounds */
[data-close-color="#ffffff"] .dmp-lightbox-close,
[data-nav-color="#ffffff"] .dmp-lightbox-nav {
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* ==================== RESPONSIVE POST FIXES ==================== */
@media (max-width: 768px) {
    .dmp-post-excerpt {
        -webkit-line-clamp: 2;
        font-size: 13px;
    }
    
    .dmp-read-more {
        padding: 8px 20px;
        font-size: 13px;
        min-width: 120px;
    }
}

/* ==================== EXCERPT FALLBACK ==================== */
.dmp-post-excerpt:empty {
    display: none;
}

.dmp-read-more-container {
    min-height: 50px;
    display: flex;
    align-items: flex-end;
}
/* ==================== FIX FILTERS DISPLAY ==================== */
.dmp-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.dmp-filters.dmp-filters-top {
    justify-content: center;
}

.dmp-filters.dmp-filters-left {
    flex-direction: column;
    align-items: flex-start;
    margin-right: 30px;
    margin-bottom: 0;
    max-width: 200px;
}

.dmp-filter-btn {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
}

.dmp-filter-btn:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.dmp-filter-btn.active:after {
    width: 100%;
}

.dmp-filter-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.dmp-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.dmp-filter-count {
    font-size: 12px;
    opacity: 0.7;
    margin-left: 5px;
}

/* ==================== GRID FIXES ==================== */
.dmp-grid {
    display: grid;
    gap: 20px;
    opacity: 1 !important;
    visibility: visible !important;
}

.dmp-grid.dmp-ready {
    opacity: 1 !important;
}

.dmp-grid-item {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* ==================== POST ITEM FIXES ==================== */
.dmp-post-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.dmp-post-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    color: #333;
}

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

.dmp-post-title a:hover {
    color: #667eea;
}

.dmp-post-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.dmp-post-excerpt {
    flex-grow: 1;
    margin-bottom: 20px;
    line-height: 1.6;
    color: #555;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    min-height: 60px;
}

.dmp-read-more-container {
    margin-top: auto;
}

.dmp-read-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    min-width: 140px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.dmp-read-more:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dmp-read-more:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}

.dmp-read-more:hover:before {
    opacity: 1;
}

.dmp-read-more:after {
    content: '→';
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.dmp-read-more:hover:after {
    transform: translateX(5px);
}

/* ==================== DEBUG HELPERS ==================== */
.dmp-debug-border {
    border: 2px solid red !important;
}

.dmp-visible-test {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* ==================== RESPONSIVE FIXES ==================== */
@media (max-width: 768px) {
    .dmp-filters {
        justify-content: center;
        gap: 8px;
    }
    
    .dmp-filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .dmp-post-content {
        padding: 15px;
    }
    
    .dmp-post-excerpt {
        -webkit-line-clamp: 2;
        font-size: 13px;
        min-height: 52px;
    }
    
    .dmp-read-more {
        padding: 8px 20px;
        font-size: 13px;
        min-width: 120px;
    }
}

/* ==================== IMPORTANT FIXES ==================== */

/* Fix for Divi Builder container */
.et_pb_module.dmp_masonry_module {
    min-height: 50px;
}

/* Ensure filters are visible */
.dmp-filters {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix grid items display */
.dmp-grid-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure the module loads properly */
.dmp-masonry-pro-plus.dmp-loaded {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Fix for post items in Divi Builder */
.et-fb .dmp-post-item {
    pointer-events: auto !important;
}