/* ===== Grid Layout Styles ===== */
.hex-grid {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.hex-grid .hex-row {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0;
}

.hex-grid .hex-item {
    position: relative;
    width: 100%;
    height: 100%;
    -webkit-clip-path: polygon(
        50% 0%,
        100% 25%,
        100% 75%,
        50% 100%,
        0% 75%,
        0% 25%
      );
      clip-path: polygon(
        50% 0%,
        100% 25%,
        100% 75%,
        50% 100%,
        0% 75%,
        0% 25%
      );

}

.hex-grid .hex-item .hex-item-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.hex-grid .hex-item .hex-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.hex-grid .hex-item .hex-item-text {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90%;
    transform: translate(-50%, -50%);
    z-index: 3;
    transform-origin: center center;
    text-align: center;
    opacity: 1 !important;
    color: #fff;
    transition: all 0.3s ease;
}

.hex-grid .hex-item .hex-item-icon {
    width: 40px;
    height: 40px;
    display: inline-block;
    overflow: hidden;
}
.hex-grid .hex-item .hex-item-icon > svg {
    transform: scale(0.5);
    transform-origin: top center;
    width: auto !important;
    height: auto !important;
    display: block;
}

.hex-grid .hex-item .hex-item-heading {
    margin: 5px 0 0;
    font-size: 1.2em;
}

.hex-grid .hex-item .hex-item-subheading {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.2; /* or any default value you prefer */
}

.hex-grid .hex-item::before {
    content: "";
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    -webkit-clip-path: polygon(
        50% 0%,
        100% 25%,
        100% 75%,
        50% 100%,
        0% 75%,
        0% 25%
      );
      clip-path: polygon(
        50% 0%,
        100% 25%,
        100% 75%,
        50% 100%,
        0% 75%,
        0% 25%
      );
    /*border: 2px solid #fff;
    box-sizing: border-box;*/
    pointer-events: none;
    z-index: 5;
}

.hex-error-message {
    background-color: #ffdddd;
    border: 2px solid #ff5c5c;
    color: #a94442;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 4px;
}

/* ===== Responsive Styles ===== */
@media (min-width: 1200px) {
    .hex-grid {
        max-width: 1200px;
    }
}

@media (max-width: 1024px) {
    /* 2-3-2 Pattern Responsive */
    .hex-grid.pattern-2-3-2 .hex-row {
        flex-wrap: wrap !important;
        margin-left: 0 !important;
        margin-bottom: 20px !important;
        margin-top: 0 !important;
    }
    
    .hex-grid.pattern-2-3-2 .hex-item {
        margin: 0 auto;
    }

    /* Honeycomb Pattern Responsive */
    .hex-grid:not(.pattern-2-3-2) {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .hex-grid:not(.pattern-2-3-2) .hex-item:nth-child(3n+2) {
        grid-column: 2 / span 2 !important;
    }
}

@media (max-width: 550px) {
    .hex-grid {
        max-width: 300px;
        padding: 10px !important;
    }

    .hex-grid.pattern-2-3-2 .hex-row {
        margin-left: 0 !important;
        margin-bottom: 20px !important;
    }

    .hex-grid .hex-item {
        width: 200px !important;
        height: 230px !important;
    }
}

/* Hover Effects 
Overlay base styles */
.hex-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(33, 109, 181, 0.75);
    transition: background-color 0.3s ease, opacity 0.3s ease;
    z-index: 1; /* Ensure overlay is above the background image */
}

/* Standard hover effect when no custom color is applied */
.hex-item:hover .hex-item-overlay:not([style*="background-color"]) {
    background-color: #F48220;
}

/* Keep other hover effects as they were */
.hex-item {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hex-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

/* Text styles - always visible with smooth scaling transition 
.hex-item-text {
    position: relative;
    z-index: 2;
    opacity: 1 !important; 
    transition: transform 0.3s ease;
    transform-origin: center center;
} 
*/

.hex-item:hover .hex-item-text {
    /* Scale effect handled by JS for better control */
    transform: translate(-50%, -50%) scale(1.1);
}

/* Container for better grid alignment */
.hex-grid-wrapper {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    display: block !important;
    position: relative !important;
    box-sizing: border-box !important;
    flex: none !important;
    float: none !important;
    clear: both !important;
    column-count: initial !important;
    column-gap: initial !important;
}

/* Additional overrides for specific patterns */
.hex-grid.pattern-2-3-2 {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: center !important;
}

.hex-grid.pattern-2-3-2 .hex-row {
    display: flex !important;
    gap: 20px !important;
    justify-content: center !important;
    width: 100% !important;
}

.hex-grid.pattern-2-3-2 .hex-row.hex-bottom {
    margin-left: 250px !important;
}


/* Removed as JS is managing the positioning. 
/* Force override Elementor positioning 
body .elementor-widget-container .hex-grid.pattern-honeycomb {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 50px 0 !important;
    position: relative !important;
}

body .elementor-widget-container .hex-grid.pattern-honeycomb .hex-item {
    position: relative !important;
    display: inline-block !important;
    width: 250px !important;
    height: 280px !important;
    margin: -30px -15px !important;
}

*/

/* Removed as JS is managing the display
body .elementor-widget-container .hex-grid.pattern-honeycomb .hex-item:nth-child(3n+2) {
    margin-top: 125px !important;
}

body .elementor-widget-container .hex-grid.pattern-honeycomb .hex-item:nth-child(3n+3) {
    margin-top: -155px !important;
    margin-left: 135px !important;
}

@media (max-width: 768px) {
    body .elementor-widget-container .hex-grid.pattern-honeycomb {
        padding: 20px !important;
    }
    
    body .elementor-widget-container .hex-grid.pattern-honeycomb .hex-item,
    body .elementor-widget-container .hex-grid.pattern-honeycomb .hex-item:nth-child(3n+2),
    body .elementor-widget-container .hex-grid.pattern-honeycomb .hex-item:nth-child(3n+3) {
        margin: 10px auto !important;
    }
}
*/

/* Remove any Elementor inline styles */
.hex-grid.pattern-honeycomb[style] {
    height: auto !important;
}

.hex-grid.pattern-honeycomb .hex-item[style] {
    position: relative !important;
    left: auto !important;
    top: auto !important;
}

/* Elementor-specific overrides */
.elementor-widget-container .hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (max-width: 768px) {
    .hex-grid .hex-row {
        flex-direction: column;
        transform: none;
    }
    
    .hex-grid .hex-item {
        margin: 10px auto;
    }
}
