/**
 * SBA Icon Box Block Styles
 * 
 * Styles for the Icon Box Gutenberg block
 */

/* Icon Box Container - Base structure only */
.sba-icon-box {
    transition: all 0.3s ease;
}

.sba-icon-box:hover {
    border-top-color: var(--border-color-hover, #CDA34F) !important;
    border-right-color: var(--border-color-hover, #CDA34F) !important;
    border-bottom-color: var(--border-color-hover, #CDA34F) !important;
    border-left-color: var(--border-color-hover, #CDA34F) !important;
}

/* Only apply hover transform when explicitly enabled */
.sba-icon-box[style*="--hover-transform"]:hover {
    transform: var(--hover-transform, translateY(-2px));
}

/* Only apply hover shadow when explicitly enabled */
.sba-icon-box[style*="--hover-shadow"]:hover {
    box-shadow: var(--hover-shadow);
}


.sba-icon-box-icon i {
    display: block;
    line-height: 1;
}

/* Icon Box Content */
.sba-icon-box-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    flex: 1;
}

.sba-icon-box.sba-icon-top .sba-icon-box-content {
    display: block;
}

.sba-icon-box.sba-icon-left .sba-icon-box-content {
    flex-direction: row;
}

.sba-icon-box.sba-icon-right .sba-icon-box-content {
    flex-direction: row-reverse;
}

/* Icon */
.sba-icon-box-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon with background shape positioning */
.sba-icon-box-icon[style*="background-color"] {
    position: relative;
}

.sba-icon-box-icon i {
    display: block;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* Ensure icon is perfectly centered within background */
.sba-icon-box-icon[style*="background-color"] i {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
}

.sba-icon-box.sba-icon-top .sba-icon-box-icon {
    text-align: center;
    margin-bottom: 15px;
}

.sba-icon-box.sba-icon-left .sba-icon-box-icon,
.sba-icon-box.sba-icon-right .sba-icon-box-icon {
    margin-bottom: 0;
    align-self: flex-start;
}

/* Ensure proper alignment for icons with backgrounds */
.sba-icon-box.sba-icon-top .sba-icon-box-icon[style*="background-color"] {
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sba-icon-box.sba-icon-left .sba-icon-box-icon[style*="background-color"],
.sba-icon-box.sba-icon-right .sba-icon-box-icon[style*="background-color"] {
    align-self: flex-start;
    margin-top: 0;
}

/* Icon background hover effect - only when enabled */
.sba-icon-box[style*="--icon-bg-color-hover"]:hover .sba-icon-box-icon[style*="background-color"] {
    background-color: var(--icon-bg-color-hover) !important;
    transition: background-color 0.3s ease;
}

/* Text Content */
.sba-icon-box-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sba-icon-box.sba-icon-top .sba-icon-box-text {
    width: 100%;
}

/* Headlines - Base structure only */
.sba-icon-box-headline {
    line-height: 1.2;
}

.sba-icon-box-subheadline {
    line-height: 1.3;
}

.sba-icon-box-description {
    line-height: 1.6;
}

/* Button - Base structure only */
.sba-icon-box-button {
    display: inline-block;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sba-icon-box-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.sba-icon-box-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Editor Styles */
.wp-block-sba-icon-box .sba-icon-box {
    margin: 0;
}

/* Editor Mobile Styles */
@media (max-width: 768px) {
    .wp-block-sba-icon-box .sba-icon-box {
        margin: 0;
    }
    
    .wp-block-sba-icon-box .sba-icon-box-content {
        flex-direction: column !important;
        text-align: center;
    }
    
    .wp-block-sba-icon-box .sba-icon-box-text {
        text-align: center;
    }
    
    .wp-block-sba-icon-box .sba-icon-box-button {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        display: block;
    }
}

/* Equal height support for various layouts - only when equal height is enabled */
.wp-block-columns .sba-icon-box[style*="height: 100%"],
.wp-block-column .sba-icon-box[style*="height: 100%"],
.wp-block-group .sba-icon-box[style*="height: 100%"] {
    /* Equal height styles are now handled by the block option */
}

/* Ensure proper height distribution when equal height is enabled */
.wp-block-columns .sba-icon-box[style*="height: 100%"] .sba-icon-box-content,
.wp-block-column .sba-icon-box[style*="height: 100%"] .sba-icon-box-content,
.wp-block-group .sba-icon-box[style*="height: 100%"] .sba-icon-box-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wp-block-columns .sba-icon-box[style*="height: 100%"] .sba-icon-box-text,
.wp-block-column .sba-icon-box[style*="height: 100%"] .sba-icon-box-text,
.wp-block-group .sba-icon-box[style*="height: 100%"] .sba-icon-box-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Button positioning for equal height */
.wp-block-columns .sba-icon-box[style*="height: 100%"] .sba-icon-box-button,
.wp-block-column .sba-icon-box[style*="height: 100%"] .sba-icon-box-button,
.wp-block-group .sba-icon-box[style*="height: 100%"] .sba-icon-box-button {
    margin-top: auto;
}

/* Responsive Design */

/* Tablet Styles */
@media (max-width: 1024px) {
    .sba-icon-box-content {
        gap: 12px;
    }
    
    .sba-icon-box.sba-icon-left .sba-icon-box-content,
    .sba-icon-box.sba-icon-right .sba-icon-box-content {
        gap: 15px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sba-icon-box-content {
        flex-direction: column !important;
        text-align: center;
        gap: 15px;
    }
    
    .sba-icon-box.sba-icon-left .sba-icon-box-content,
    .sba-icon-box.sba-icon-right .sba-icon-box-content {
        flex-direction: column !important;
        text-align: center;
    }
    
    .sba-icon-box.sba-icon-left .sba-icon-box-icon,
    .sba-icon-box.sba-icon-right .sba-icon-box-icon {
        margin-bottom: 15px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .sba-icon-box-text {
        text-align: center;
        width: 100%;
    }
    
    .sba-icon-box-button {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        display: block;
        text-align: center;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .sba-icon-box-content {
        gap: 12px;
    }
    
    .sba-icon-box-button {
        max-width: 100%;
    }
}

/* Large Mobile / Small Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .sba-icon-box-button {
        max-width: 320px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .sba-icon-box-button {
        min-height: 44px;
    }
    
    .sba-icon-box {
        transition: none;
    }
    
    .sba-icon-box:hover {
        transform: none;
    }
}

/* High DPI displays - removed hardcoded shadows as they're now handled by block options */

/* Accessibility */
.sba-icon-box:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .sba-icon-box {
        box-shadow: none;
    }
    
    .sba-icon-box-button {
        background: #000 !important;
        color: #fff !important;
    }
}

