/* Template Editor Styles - Separado para evitar conflictos */

.template-editor-container {
    display: grid !important;
    grid-template-columns: 420px 1fr !important;
    gap: 1.5rem;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.template-editor-form {
    display: flex !important;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 1rem 0 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
}

.template-editor-form::-webkit-scrollbar {
    width: 6px;
}

.template-editor-form::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.template-editor-form::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.template-editor-form::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.template-editor-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.625rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.template-editor-section:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.template-editor-section-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.template-editor-section-title i {
    width: 1rem;
    height: 1rem;
    color: var(--primary-color, #e61b2a);
}

.template-editor-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-editor-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.template-editor-field label i {
    width: 0.875rem;
    height: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

.template-editor-input,
.template-editor-textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    color: #FFFFFF;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.template-editor-input:hover,
.template-editor-textarea:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.template-editor-input:focus,
.template-editor-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #e61b2a);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(230, 27, 42, 0.15);
}

.template-editor-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.template-editor-field-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: -0.25rem;
    line-height: 1.4;
}

/* Slider para tamaños de fuente */
.template-editor-size-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.template-editor-size-input {
    width: 70px;
    flex-shrink: 0;
    text-align: center;
}

.template-editor-size-slider {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.template-editor-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color, #e61b2a);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(230, 27, 42, 0.4);
    transition: all 0.2s ease;
}

.template-editor-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(230, 27, 42, 0.6);
}

.template-editor-size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color, #e61b2a);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(230, 27, 42, 0.4);
    transition: all 0.2s ease;
}

.template-editor-size-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(230, 27, 42, 0.6);
}

.template-editor-size-value {
    min-width: 50px;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-color, #e61b2a);
    background: rgba(230, 27, 42, 0.1);
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    flex-shrink: 0;
}

.template-editor-preview {
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.625rem;
    padding: 1rem;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
}

.template-editor-preview-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.template-editor-preview-label i {
    width: 1rem;
    height: 1rem;
    color: var(--primary-color, #e61b2a);
}

.template-editor-preview-container {
    flex: 1;
    min-height: 0;
    background: #020417;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.template-editor-preview-container iframe {
    width: 1080px;
    height: 1350px;
    border: none;
    background: #020417;
    transform: scale(0.35);
    transform-origin: center center;
    flex-shrink: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
    transition: transform 0.2s ease;
}

.template-preview-loading,
.template-preview-error {
    padding: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

.template-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.template-preview-loading i {
    width: 2rem;
    height: 2rem;
    animation: spin 1s linear infinite;
    color: var(--primary-color, #e61b2a);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.template-preview-error {
    color: #ff6b6b;
}

/* Modal body adjustments for template editor */
.template-preview-modal-body.template-editor-mode {
    display: flex !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    max-height: calc(95vh - 200px) !important;
    padding: 1.5rem !important;
    overflow: hidden !important;
    min-height: 0 !important;
    flex-direction: column !important;
}

.template-preview-modal-body.template-editor-mode > .template-editor-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    display: grid !important;
    grid-template-columns: 420px 1fr !important;
    gap: 1.5rem !important;
    align-items: stretch !important;
}

.template-preview-modal-body.template-editor-mode .template-editor-form {
    grid-column: 1;
    width: 100%;
    max-width: 420px;
}

.template-preview-modal-body.template-editor-mode .template-editor-preview {
    grid-column: 2;
    width: 100%;
}

@media (max-width: 1200px) {
    .template-editor-container {
        grid-template-columns: 380px 1fr;
        gap: 1.25rem;
    }
}

@media (max-width: 1024px) {
    .template-editor-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 1.25rem;
    }
    
    .template-editor-form {
        max-height: 350px;
        gap: 1.25rem;
    }
    
    .template-editor-section {
        padding: 1rem;
    }
    
    .template-editor-preview-container {
        min-height: 400px;
        padding: 1rem;
    }
    
    .template-editor-preview-container iframe {
        transform: scale(0.3);
        transform-origin: center center;
    }
    
    .template-editor-size-control {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .template-editor-size-input {
        width: 100%;
    }
}
