/* =============================================================================
   TEMPLATE BUILDER - INTERFACE MODERNA
============================================================================= */

.template-builder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #dee2e6;
}

/* Navegação por Abas */
.template-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: white;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.template-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    color: #6c757d;
}

.template-tab:hover {
    background: #f8f9fa;
    color: #495057;
}

.template-tab.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.template-tab i {
    font-size: 16px;
}

/* Painel de Variáveis Inteligente */
.smart-variables-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.variables-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.variables-header i {
    color: #7c4dff;
    font-size: 20px;
}

.variables-header span {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.variables-header small {
    color: #6c757d;
    font-size: 12px;
    margin-left: auto;
}

/* Container de Variáveis */
.variables-container {
    position: relative;
}

.variables-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* Botões de Variáveis Inteligentes */
.variable-smart-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.variable-smart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.variable-smart-btn:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,123,255,0.15);
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
}

.variable-smart-btn:hover::before {
    left: 100%;
}

.variable-smart-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
}

.variable-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.variable-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.variable-name {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.variable-code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #7c4dff;
    font-weight: 500;
    background: #f8f9ff;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

/* Campos de Edição */
.template-fields {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.template-field {
    display: none;
}

.template-field.active {
    display: block;
}

.template-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    font-size: 15px;
}

.template-field label i {
    color: #007bff;
    font-size: 16px;
}

.smart-input,
.smart-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fafafa;
    font-family: inherit;
}

.smart-input:focus,
.smart-textarea:focus {
    outline: none;
    border-color: #007bff;
    background: white;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
    transform: translateY(-1px);
}

.smart-textarea {
    resize: vertical;
    min-height: 200px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.field-preview {
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9ff 100%);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.field-preview small {
    color: #495057;
    font-weight: 500;
}

.field-preview span {
    color: #6c757d;
    font-style: italic;
}

/* Responsividade */
@media (max-width: 768px) {
    .template-builder {
        padding: 15px;
        margin: 15px 0;
    }
    
    .variables-group {
        grid-template-columns: 1fr;
    }
    
    .variable-smart-btn {
        padding: 12px;
    }
    
    .variable-icon {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .template-tabs {
        flex-direction: column;
    }
    
    .template-tab {
        padding: 10px 15px;
    }
}