/**
 * Template Block Elementor - Frontend Styles
 */

.tbe-template-block {
    position: relative;
    display: block;
    width: 100%;
}

.tbe-template-block.tbe-no-template,
.tbe-template-block.tbe-error {
    padding: 20px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.tbe-template-block.tbe-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Ensure proper spacing and layout */
.tbe-template-block > * {
    margin-top: 0;
    margin-bottom: 0;
}

.tbe-template-block > * + * {
    margin-top: 1em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tbe-template-block {
        font-size: 14px;
    }
}

/* Loading state */
.tbe-template-block.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tbe-template-block.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: tbe-spin 1s linear infinite;
}

@keyframes tbe-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure Elementor widgets inside template blocks work properly */
.tbe-template-block .elementor-widget {
    margin-bottom: 0;
}

.tbe-template-block .elementor-section {
    margin-bottom: 0;
}

/* Fix for nested Elementor content */
.tbe-template-block .elementor-container {
    width: 100%;
}

/* Ensure proper z-index for overlays */
.tbe-template-block .elementor-overlay {
    z-index: 1;
}
