/* WP Bakery Custom Widget Styles */

.custom-two-column-widget {
    position: relative;
    overflow: hidden;
    min-height: 300px;
    width: 100%;
    box-sizing: border-box;
    height: auto; /* Allow height to expand based on content */
}

.custom-widget-row {
    display: flex;
    height: 100%;
    min-height: inherit;
}

.custom-widget-left-column {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 40px;
    background-color: #f8f9fa;
    box-sizing: border-box;
}

.custom-widget-right-column {
    flex: 1;
    position: relative;
    background-color: #e9ecef;
    min-height: 300px;
}

/* Text column specific styling */
.custom-widget-text-column {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    box-sizing: border-box;
    /* Padding removed - moved to .custom-widget-content */
}

/* Image column specific styling */
.custom-widget-image-column {
    flex: 1;
    position: relative;
    background-color: #e9ecef;
    min-height: 300px;
}

.custom-widget-content {
    width: 100%;
    max-width: 500px;
    padding: 40px; /* Moved padding here */
}

/* Ensure content wrapper works in both text column positions */
.custom-widget-text-column .custom-widget-content {
    width: 100%;
    max-width: 500px;
    padding: 40px; /* Consistent padding for text content */
}

.custom-widget-header {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 20px 0;
    color: #333;
}

.custom-widget-description {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 0 30px 0;
    color: #666;
}

.custom-widget-button-wrapper {
    margin-top: 30px;
}

.custom-widget-button {
    display: inline-block;
    padding: 15px 30px;
    background-color: #007cba;
    color: #ffffff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.custom-widget-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
    text-decoration: none;
    color: #ffffff;
}

.custom-widget-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

.custom-widget-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: #e9ecef;
    color: #6c757d;
    font-size: 1.2rem;
    font-weight: 500;
}

.custom-widget-placeholder span {
    padding: 20px;
    border: 2px dashed #6c757d;
    border-radius: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-widget-row {
        flex-direction: column;
        min-height: auto; /* Allow row to expand on mobile */
    }
    
    /* Always show image first on mobile regardless of layout */
    .custom-two-column-widget[data-layout="text-left"] .custom-widget-text-column {
        order: 2;
    }
    
    .custom-two-column-widget[data-layout="text-left"] .custom-widget-image-column {
        order: 1;
    }
    
    .custom-two-column-widget[data-layout="image-left"] .custom-widget-image-column {
        order: 1;
    }
    
    .custom-two-column-widget[data-layout="image-left"] .custom-widget-text-column {
        order: 2;
    }
    
    .custom-widget-text-column {
        min-height: auto; /* Remove fixed height constraints on mobile */
        background-color: #f8f9fa;
        box-sizing: border-box;
        /* Remove flex properties on mobile to prevent layout issues */
        display: block;
        align-items: initial;
        /* Padding removed - moved to content wrapper */
    }
    
    .custom-widget-text-column .custom-widget-content {
        padding: 30px 20px; /* Mobile padding moved here */
    }
    
    .custom-widget-image-column {
        min-height: 250px;
        flex-shrink: 0; /* Prevent shrinking */
        display: block; /* Ensure proper display on mobile */
    }
    
    /* Legacy support */
    .custom-widget-left-column {
        order: 2;
        padding: 30px 20px;
        min-height: auto; /* Remove fixed height constraints on mobile */
    }
    
    .custom-widget-right-column {
        order: 1;
        min-height: 250px;
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    .custom-widget-header {
        font-size: 2rem;
    }
    
    .custom-widget-description {
        font-size: 1rem;
    }
    
    .custom-widget-button {
        padding: 12px 25px;
        font-size: 0.9rem;
    }
    
    /* Ensure the widget can expand to fit content on mobile */
    .custom-two-column-widget {
        height: auto !important;
        min-height: 500px; /* Increase minimum height on mobile */
    }
}

@media (max-width: 480px) {
    .custom-widget-text-column {
        min-height: auto; /* Remove height constraints */
        background-color: #f8f9fa;
        box-sizing: border-box;
        /* Remove flex properties on mobile to prevent layout issues */
        display: block;
        align-items: initial;
        /* Padding removed - moved to content wrapper */
    }
    
    .custom-widget-text-column .custom-widget-content {
        padding: 20px 15px; /* Small mobile padding moved here */
    }
    
    /* Legacy support */
    .custom-widget-left-column {
        padding: 20px 15px;
        min-height: auto; /* Remove height constraints */
    }
    
    .custom-widget-header {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .custom-widget-description {
        margin-bottom: 20px;
    }
    
    .custom-widget-button-wrapper {
        margin-top: 20px;
        margin-bottom: 20px; /* Add bottom margin for better spacing */
    }
    
    .custom-widget-button {
        width: 100%;
        text-align: center;
        padding: 15px 20px;
    }
    
    /* Ensure mobile widget has enough space */
    .custom-two-column-widget {
        height: auto !important;
        min-height: 450px;
    }
    
    .custom-widget-image-column {
        min-height: 200px; /* Smaller image section on very small screens */
        display: block; /* Ensure proper display on mobile */
    }
    
    /* Legacy support */
    .custom-widget-right-column {
        min-height: 200px; /* Smaller image section on very small screens */
    }
}

/* Content Alignment Variations */
.custom-widget-text-column[data-alignment="center"] {
    text-align: center;
}

.custom-widget-text-column[data-alignment="right"] {
    text-align: right;
}

.custom-widget-text-column[data-alignment="center"] .custom-widget-content {
    margin: 0 auto;
}

.custom-widget-text-column[data-alignment="right"] .custom-widget-content {
    margin-left: auto;
    margin-right: 0;
}

/* Legacy support for old class names */
.custom-widget-left-column[data-alignment="center"] {
    text-align: center;
}

.custom-widget-left-column[data-alignment="right"] {
    text-align: right;
}

.custom-widget-left-column[data-alignment="center"] .custom-widget-content {
    margin: 0 auto;
}

.custom-widget-left-column[data-alignment="right"] .custom-widget-content {
    margin-left: auto;
    margin-right: 0;
}

/* Animation for smooth loading */
.custom-two-column-widget {
    opacity: 0;
    animation: fadeInWidget 0.6s ease-out forwards;
}

@keyframes fadeInWidget {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects for the entire widget */
.custom-two-column-widget:hover .custom-widget-text-column {
    background-color: #f1f3f4;
    transition: background-color 0.3s ease;
}

/* Legacy support */
.custom-two-column-widget:hover .custom-widget-left-column {
    background-color: #f1f3f4;
    transition: background-color 0.3s ease;
}

/* Custom scrollbar for long descriptions */
.custom-widget-description {
    max-height: 150px;
    overflow-y: auto;
}

.custom-widget-description::-webkit-scrollbar {
    width: 4px;
}

.custom-widget-description::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.custom-widget-description::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.custom-widget-description::-webkit-scrollbar-thumb:hover {
    background: #555;
}
