/* Estilos para componentes de ajuda da UI */

/* Template Selector */
.template-selector {
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.template-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-header i {
    font-size: 16px;
}

.template-categories {
    max-height: 300px;
    overflow-y: auto;
}

.template-category {
    border-bottom: 1px solid #f0f0f0;
}

.template-category:last-child {
    border-bottom: none;
}

.category-name {
    background: #f8f9fa;
    padding: 8px 15px;
    font-weight: 600;
    font-size: 12px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-list {
    padding: 5px;
}

.template-item {
    padding: 10px 15px;
    margin: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.template-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateX(5px);
}

.template-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.template-description {
    font-size: 12px;
    color: #6c757d;
}

/* SQL Builder */
.sql-builder {
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.sql-builder-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sql-builder-operations {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.sql-op-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sql-op-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.sql-op-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.sql-builder-form {
    padding: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: #6c757d;
}

.form-text.text-danger {
    color: #dc3545;
}

.sql-builder-actions {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
}

.btn-generate-sql {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.btn-generate-sql:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Contextual Help */
.contextual-help {
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.help-header {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #2d3436;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-description {
    padding: 15px;
    color: #495057;
    line-height: 1.6;
    background: #fffbf0;
    border-bottom: 1px solid #e0e0e0;
}

.help-section {
    padding: 15px;
}

.help-section + .help-section {
    border-top: 1px solid #f0f0f0;
}

.help-section-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.help-list {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.help-list li {
    margin-bottom: 8px;
    color: #495057;
    line-height: 1.5;
    position: relative;
    padding-left: 20px;
}

.help-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Code Validator */
.validation-issues {
    margin: 10px 0;
    padding: 10px;
    border-radius: 6px;
    background: #fff;
}

.validation-issue {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.validation-issue:last-child {
    margin-bottom: 0;
}

.validation-error {
    background: #ffe5e5;
    border-left: 3px solid #dc3545;
    color: #721c24;
}

.validation-warning {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    color: #856404;
}

.validation-info {
    background: #d1ecf1;
    border-left: 3px solid #17a2b8;
    color: #0c5460;
}

.validation-success {
    padding: 10px 15px;
    background: #d4edda;
    border-left: 3px solid #28a745;
    color: #155724;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin: 10px 0;
}

/* Data Preview */
.data-preview {
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.data-preview-header {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-type {
    margin-left: auto;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 12px;
}

.data-preview-content {
    padding: 15px;
    max-height: 400px;
    overflow: auto;
}

.data-preview-empty {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table th {
    background: #f8f9fa;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
}

.preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.preview-table tr:hover {
    background: #f8f9fa;
}

.preview-table .index {
    color: #6c757d;
    font-weight: 600;
    width: 40px;
}

.preview-table .key {
    font-weight: 600;
    color: #495057;
    width: 30%;
}

.preview-table .value {
    font-family: 'Courier New', monospace;
}

.preview-more {
    padding: 10px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 12px;
    background: #f8f9fa;
    margin-top: 10px;
    border-radius: 4px;
}

/* Formatação de valores */
.null, .undefined {
    color: #dc3545;
    font-style: italic;
}

.boolean {
    color: #007bff;
    font-weight: 600;
}

.number {
    color: #28a745;
}

.string {
    color: #6f42c1;
}

.array, .object {
    color: #fd7e14;
    font-style: italic;
}

/* Ajustes responsivos */
@media (max-width: 768px) {
    .sql-builder-operations {
        flex-wrap: wrap;
    }

    .sql-op-btn {
        flex: 1 1 45%;
    }

    .preview-table {
        font-size: 11px;
    }

    .preview-table th,
    .preview-table td {
        padding: 6px 8px;
    }
}

/* Animações */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.template-selector,
.sql-builder,
.contextual-help,
.data-preview {
    animation: slideIn 0.3s ease-out;
}

/* Toggle para mostrar/ocultar assistentes */
.helper-toggle {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.helper-toggle:hover {
    background: #e9ecef;
}

.helper-toggle i {
    transition: transform 0.3s;
}

.helper-toggle.collapsed i {
    transform: rotate(-90deg);
}

.helper-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.helper-content.hidden {
    max-height: 0;
}
