.ecg-grid {
    display: grid;
    width: 100%;
}

.ecg-item {
    display: block;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

/* Inner wrapper */
.ecg-item-inner {
    position: relative;
    width: 100%;
}

/* Square aspect ratio mode */
.ecg-square .ecg-item-inner {
    height: 0;
    padding-bottom: 100%; /* 1:1 Aspect Ratio */
}

/* Custom height mode */
.ecg-custom .ecg-item {
    height: 150px; /* Default height, will be overridden by Elementor control */
}

.ecg-custom .ecg-item-inner {
    height: 100%;
    padding-bottom: 0;
}

.ecg-item-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Position absolute only for square mode */
.ecg-square .ecg-item-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Full height for custom mode */
.ecg-custom .ecg-item-content {
    height: 100%;
}

.ecg-item-title {
    margin: 0;
    word-wrap: break-word;
    word-break: break-word;
    width: 100%;
}

/* Background image styles */
.ecg-item-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 0;
}

/* Hover overlay styles */
.ecg-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
}

/* Pattern overlay styles */
.ecg-pattern-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show pattern on hover */
.ecg-item:hover .ecg-pattern-overlay {
    opacity: 1;
}

/* Ensure content is above overlay */
.ecg-item-content {
    position: relative;
    z-index: 3;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .ecg-item-title {
        font-size: 0.9em;
    }
}

@media (max-width: 767px) {
    .ecg-item-title {
        font-size: 0.85em;
    }
}
