/* SBA Hero Block Styles */

.sba-hero-block {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    padding: 60px 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Align hero content with grid-container and position to the right */
.sba-hero-block .sba-hero-content-box {
    max-width: 600px;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    margin-bottom: -25px !important;
    padding-bottom: 50px !important;
    margin-left: auto;
    margin-right: 0;
}

/* Ensure the hero block respects the grid-container alignment */
.wp-block-sba-hero-block {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* Align with grid-container on larger screens */
@media (min-width: 769px) {
    .sba-hero-block {
        padding-left: max(20px, calc((100vw - 1200px) / 2 + 20px));
        padding-right: max(20px, calc((100vw - 1200px) / 2 + 20px));
    }
    
    .sba-hero-block .sba-hero-content-box {
        margin-left: auto;
        margin-right: 0;
        max-width: 600px;
    }
}

.sba-hero-block.sba-hero-left {
    justify-content: flex-start;
}

.sba-hero-block.sba-hero-right {
    justify-content: flex-end;
}

.sba-hero-block.sba-hero-center {
    justify-content: center;
}


.sba-hero-content-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: var(--box-padding-top, 40px);
    width: 8px;
    background-color: var(--border-color, #0073aa);
    z-index: 1;
    height: var(--border-height, calc(100% - var(--box-padding-top, 40px) - var(--box-padding-bottom, 40px)));
}

.sba-hero-title {
    font-size: 2.5em;
    font-weight: bold;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.sba-hero-subtitle {
    font-size: 1.2em;
    font-weight: 400;
    margin: 0 0 15px 0;
    line-height: 1.3;
    opacity: 0.9;
}

.sba-hero-content {
    font-size: 1em;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.sba-hero-button {
    display: inline-block !important;
    padding: 12px 30px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
    position: relative !important;
    z-index: 3 !important;
    margin-top: 25px !important;
}

/* More specific selector to ensure button positioning */
.sba-hero-content-box .sba-hero-button {
    position: absolute !important;
    bottom: -25px !important;
    left: var(--box-padding-left, 40px) !important; /* Use CSS custom property for dynamic alignment */
    z-index: 3 !important;
    display: inline-block !important;
}

/* Ensure the content box has the right spacing */
.sba-hero-content-box {
    margin-bottom: -25px !important;
    padding-bottom: 50px !important;
}

.sba-hero-button:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

.sba-hero-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Editor Styles */
.sba-hero-block-editor {
    border: 2px dashed #ccc;
    border-radius: 8px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.sba-hero-block-editor .sba-hero-block {
    border: none;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.sba-hero-block-editor .sba-hero-content-box {
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
}

.sba-hero-block-editor .sba-hero-content-box input,
.sba-hero-block-editor .sba-hero-content-box textarea {
    width: 100%;
    border: 1px dashed #0073aa;
    background: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    box-sizing: border-box;
}

.sba-hero-block-editor .sba-hero-content-box input:focus,
.sba-hero-block-editor .sba-hero-content-box textarea:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Block Editor Container Fix - Updated to align with grid-container */
.wp-block-sba-hero-block {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
}

/* Editor-specific full width override */
.editor-styles-wrapper .wp-block-sba-hero-block {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Prevent horizontal scroll in editor */
.block-editor-writing-flow {
    overflow-x: hidden;
}

.block-editor-writing-flow .wp-block-sba-hero-block {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Color Controls in Inspector */
.color-controls {
    margin-bottom: 15px;
}

.color-controls label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

/* Responsive Design */

/* Tablet Styles */
@media (max-width: 1024px) {
    .sba-hero-block {
        padding: 50px 20px;
    }
    
    .sba-hero-content-box {
        max-width: 80%;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sba-hero-block {
        min-height: 300px;
        padding: 40px 15px;
    }
    
    .sba-hero-title {
        font-size: 2em;
        line-height: 1.1;
    }
    
    .sba-hero-subtitle {
        font-size: 1.1em;
        line-height: 1.2;
    }
    
    .sba-hero-content {
        font-size: 0.95em;
        line-height: 1.5;
    }
    
    .sba-hero-content-box {
        max-width: 100%;
        width: calc(100% - 20px) !important;
        margin: 0 10px -25px 10px;
        padding: 20px 20px 50px 20px !important;
    }
    
    /* Reset absolute positioning on mobile and center the button */
    .sba-hero-content-box .sba-hero-button {
        position: relative !important;
        left: auto !important;
        bottom: auto !important;
        width: calc(100% - 20px);
        max-width: 280px;
        margin: 25px auto 0 auto;
        display: block;
        text-align: center;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .sba-hero-block {
        min-height: 250px;
        padding: 30px 10px;
    }
    
    .sba-hero-title {
        font-size: 1.8em;
        line-height: 1.1;
        margin-bottom: 8px;
    }
    
    .sba-hero-subtitle {
        font-size: 1em;
        line-height: 1.2;
        margin-bottom: 12px;
    }
    
    .sba-hero-content {
        font-size: 0.9em;
        line-height: 1.4;
        margin-bottom: 15px;
    }
    
    .sba-hero-content-box {
        max-width: 100%;
        width: calc(100% - 10px) !important;
        margin: 0 5px -25px 5px;
        padding: 15px 15px 50px 15px !important;
    }
    
    /* Ensure button is properly centered on small mobile */
    .sba-hero-content-box .sba-hero-button {
        position: relative !important;
        left: auto !important;
        bottom: auto !important;
        padding: 10px 20px;
        font-size: 14px;
        width: calc(100% - 10px);
        max-width: 100%;
        margin: 25px auto 0 auto;
        display: block;
        text-align: center;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Large Mobile / Small Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .sba-hero-content-box {
        margin: 0 15px -25px 15px;
        padding-bottom: 50px !important;
    }
    
    /* Ensure button is properly centered on large mobile */
    .sba-hero-content-box .sba-hero-button {
        position: relative !important;
        left: auto !important;
        bottom: auto !important;
        width: calc(100% - 30px);
        max-width: 320px;
        margin: 25px auto 0 auto;
        display: block;
        text-align: center;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Override inline styles for responsive behavior */
@media (max-width: 768px) {
    .sba-hero-content-box[style*="max-width"],
    .sba-hero-content-box[style*="width"] {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Prevent horizontal scroll from button positioning */
    .sba-hero-content-box .sba-hero-button[style*="left"],
    .sba-hero-content-box .sba-hero-button[style*="position"] {
        position: relative !important;
        left: auto !important;
        bottom: auto !important;
        transform: translateX(-50%) !important;
    }
}

@media (max-width: 480px) {
    .sba-hero-content-box[style*="max-width"],
    .sba-hero-content-box[style*="width"] {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Full Width Support - Only apply when explicitly set to full width */
.wp-block-sba-hero-block.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Alignment Support */
.alignwide .sba-hero-block {
    max-width: 1200px;
    margin: 0 auto;
}

.alignfull .sba-hero-block {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Grid Container Alignment - Align hero content with main content area */
.sba-hero-block:not(.alignfull) {
    position: relative;
}

.sba-hero-block:not(.alignfull) .sba-hero-content-box {
    margin-left: auto;
    margin-right: 0;
    max-width: 600px;
}

/* Ensure proper alignment with GeneratePress grid-container */
@media (min-width: 769px) {
    .sba-hero-block:not(.alignfull) {
        padding-left: max(20px, calc((100vw - 1200px) / 2 + 20px));
        padding-right: max(20px, calc((100vw - 1200px) / 2 + 20px));
    }
}

/* Override for right alignment when hero block has right class */
.sba-hero-block.sba-hero-right .sba-hero-content-box {
    margin-left: auto;
    margin-right: 0;
}

/* Overlay for better text readability */
.sba-hero-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.sba-hero-content-box {
    position: relative;
    z-index: 2;
}

/* Animation for smooth appearance */
.sba-hero-content-box {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
