/* ==============================================
   ICON HEADING WIDGET STYLES
   ============================================== */

/*
 * MAIN WRAPPER 
 * Controls the relationship between icon-container and text-container
 */
.icon-heading-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
}

/*
 * ICON POSITION LAYOUTS
 * Controls how icon-container and text-container are arranged
 */

/* Left position (default) */
.icon-position-left .icon-heading-wrapper {
    flex-direction: row;
    align-items: center;
}

/* Right position */
.icon-position-right .icon-heading-wrapper {
    flex-direction: row-reverse;
    align-items: center;
}

/* Top position */
.icon-position-top .icon-heading-wrapper {
    flex-direction: column;
    align-items: center;
}

/* Bottom position */
.icon-position-bottom .icon-heading-wrapper {
    flex-direction: column-reverse;
    align-items: center;
}

/*
 * ICON CONTAINER
 * Contains the icon/counter - completely separate
 */
.icon-container {
    flex-shrink: 0;
}

/* Icon spacing based on position - using padding for better control */
.icon-position-left .icon-container {
    padding-right: 15px;
}

.icon-position-right .icon-container {
    padding-left: 15px;
}

.icon-position-top .icon-container {
    padding-bottom: 15px;
}

.icon-position-bottom .icon-container {
    padding-top: 15px;
}

/*
 * ACTUAL ICON ELEMENT
 */
.icon-heading-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Ensure icons stay visible */
.icon-heading-icon i,
.icon-heading-icon svg {
    display: block !important;
    transition: all 0.3s ease;
}

/*
 * TEXT CONTAINER
 * Contains main heading + sub heading - handles their vertical stacking
 */
.text-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/*
 * GLOBAL ALIGNMENT CONTROLS
 * Single control that aligns both heading and sub heading
 */

/* Left alignment */
.global-align-left .text-container {
    align-items: flex-start;
    text-align: left;
}

.global-align-left.icon-position-left .icon-heading-wrapper,
.global-align-left.icon-position-right .icon-heading-wrapper {
    justify-content: flex-start;
}

.global-align-left.icon-position-top .icon-heading-wrapper,
.global-align-left.icon-position-bottom .icon-heading-wrapper {
    align-items: flex-start;
}

/* Center alignment */
.global-align-center .text-container {
    align-items: center;
    text-align: center;
}

.global-align-center.icon-position-left .icon-heading-wrapper,
.global-align-center.icon-position-right .icon-heading-wrapper {
    justify-content: center;
}

.global-align-center.icon-position-top .icon-heading-wrapper,
.global-align-center.icon-position-bottom .icon-heading-wrapper {
    align-items: center;
}

/* Right alignment */
.global-align-right .text-container {
    align-items: flex-end;
    text-align: right;
}

.global-align-right.icon-position-left .icon-heading-wrapper,
.global-align-right.icon-position-right .icon-heading-wrapper {
    justify-content: flex-end;
}

.global-align-right.icon-position-top .icon-heading-wrapper,
.global-align-right.icon-position-bottom .icon-heading-wrapper {
    align-items: flex-end;
}

/*
 * MAIN HEADING TEXT
 */
.icon-heading-text {
    margin: 0;
    line-height: 1.3;
    transition: all 0.3s ease;
}

/*
 * SUB HEADING STYLES  
 */
.icon-sub-heading-text {
    display: block;
    margin: 0;
    line-height: 1.4;
    width: 100%;
}

/* Spacing for before/after positions */
.sub-heading-position-before .icon-sub-heading-text {
    margin-bottom: 5px;
}

.sub-heading-position-after .icon-sub-heading-text {
    margin-top: 5px;
}

/*
 * COUNTER TEXT STYLES
 */
.counter-text {
    font-weight: bold;
    font-size: inherit;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    text-align: center;
    font-family: monospace;
}

/*
 * HOVER EFFECTS & SMOOTH TRANSITIONS
 */
.icon-heading-wrapper {
    transition: all 0.3s ease;
}

.icon-heading-icon {
    transition: all 0.3s ease;
}

.hs-icon-heading__icon-bg {
    transition: all 0.3s ease;
}

.icon-sub-heading-text {
    transition: all 0.3s ease;
}

/* Scale Animation */
.hover-animation-scale:hover .icon-heading-icon {
    transform: scale(1.1);
}

/* Rotate Animation */
.hover-animation-rotate:hover .icon-heading-icon {
    transform: rotate(15deg);
}

/* Pulse Animation */
.hover-animation-pulse:hover .icon-heading-icon {
    animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* Bounce Animation */
.hover-animation-bounce:hover .icon-heading-icon {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Sub heading hover animations */
.sub-heading-hover-fade:hover .icon-sub-heading-text {
    opacity: 0.7;
}

.sub-heading-hover-slide-up:hover .icon-sub-heading-text {
    transform: translateY(-5px);
}

.sub-heading-hover-slide-down:hover .icon-sub-heading-text {
    transform: translateY(5px);
}

.sub-heading-hover-zoom-in:hover .icon-sub-heading-text {
    transform: scale(1.05);
}

.sub-heading-hover-zoom-out:hover .icon-sub-heading-text {
    transform: scale(0.95);
}

/*
 * BACKGROUND SHAPES
 */
.bg-shape-circle .hs-icon-heading__icon-bg {
    border-radius: 50% !important;
}

.bg-shape-rounded .hs-icon-heading__icon-bg {
    border-radius: 10px !important;
}

.bg-shape-diamond .hs-icon-heading__icon-bg {
    transform: rotate(45deg);
    border-radius: 0 !important;
}

.bg-shape-diamond .icon-heading-icon i,
.bg-shape-diamond .counter-text,
.bg-shape-diamond .icon-heading-icon svg {
    transform: rotate(-45deg);
}

.bg-shape-hexagon .hs-icon-heading__icon-bg {
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
    border-radius: 0 !important;
}

/*
 * LINK STYLES
 */
a.icon-heading-wrapper {
    text-decoration: none;
    color: inherit;
}

a.icon-heading-wrapper:hover {
    text-decoration: none;
}


/*
 * RESPONSIVE DESIGN - Desktop layout maintained on all devices
 */
@media (max-width: 768px) {
    /* Keep desktop layout on mobile - no forced stacking */
    .icon-heading-wrapper {
        /* Inherits desktop flex-direction based on icon position */
    }
    
    /* Ensure proper spacing on smaller screens */
    .icon-container {
        flex-shrink: 0;
    }
    
    .text-container {
        width: 100%;
        min-width: 0; /* Prevents text overflow */
    }
    
    /* Allow text to wrap properly on small screens */
    .icon-heading-text,
    .icon-sub-heading-text {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/*
 * ELEMENTOR EDITOR FIXES
 */
.elementor-widget-icon_heading .icon-heading-wrapper {
    display: flex !important;
}

.elementor-widget-icon_heading .icon-container {
    display: block !important;
}

.elementor-widget-icon_heading .text-container {
    display: flex !important;
}

.elementor-widget-icon_heading .icon-heading-icon {
    display: flex !important;
}