/* ╔══════════════════════════════════════════════════════════════════════════════╗
   ║                    WHATSAPP WEB CLONE - CSS                                  ║
   ║                                                                              ║
   ║  Módulo: 27-conversation-flows-editor.css                                    ║
   ║  Descripción: Estilos para el editor visual de conversation flows           ║
   ╚══════════════════════════════════════════════════════════════════════════════╝ */

/* ========================================
   MODAL DEL EDITOR
   ======================================== */

#conversationFlowsEditorModal .modal-content {
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#conversationFlowsEditorModal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* ========================================
   EDITOR CONTAINER
   ======================================== */

.cf-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
}

/* ========================================
   TABS DEL EDITOR
   ======================================== */

.cf-editor-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #1f2c33;
    border-bottom: 1px solid #2a3942;
}

.cf-tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #8696a0;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.cf-tab-btn:hover {
    background: rgba(0, 168, 132, 0.1);
    color: #e9edef;
}

.cf-tab-btn.active {
    background: #00a884;
    color: white;
}

/* ========================================
   CONTENIDO DEL EDITOR
   ======================================== */

.cf-editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* ========================================
   SECCIONES
   ======================================== */

.cf-sections {
    padding: 8px;
}

.cf-section {
    background: #1f2c33;
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid #2a3942;
}

.cf-section-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cf-section-header:hover {
    background: rgba(0, 168, 132, 0.05);
}

.cf-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e9edef;
    font-size: 15px;
    font-weight: 500;
}

.cf-section-title i {
    color: #00a884;
    width: 20px;
    text-align: center;
}

.cf-section-count {
    background: #00a884;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.cf-section-chevron {
    color: #8696a0;
    transition: transform 0.3s ease;
}

.cf-section-chevron.rotated {
    transform: rotate(180deg);
}

.cf-section-content {
    padding: 16px;
    border-top: 1px solid #2a3942;
    background: #111b21;
}

/* ========================================
   CAMPOS DEL FORMULARIO
   ======================================== */

.cf-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cf-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cf-form-group label {
    color: #8696a0;
    font-size: 13px;
    font-weight: 500;
}

.cf-form-group input[type="text"],
.cf-form-group input[type="number"],
.cf-form-group textarea,
.cf-form-group select {
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 8px;
    padding: 10px 12px;
    color: #e9edef;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cf-form-group input:focus,
.cf-form-group textarea:focus,
.cf-form-group select:focus {
    outline: none;
    border-color: #00a884;
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
}

.cf-form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.cf-form-checkbox {
    flex-direction: row;
    align-items: center;
}

.cf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #e9edef;
}

.cf-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00a884;
    cursor: pointer;
}

.cf-help {
    color: #667781;
    font-size: 12px;
    margin: 4px 0 0 0;
}

/* ========================================
   TAGS INPUT
   ======================================== */

.cf-tags-input-wrapper {
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.cf-tags-input-wrapper:focus-within {
    border-color: #00a884;
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
}

.cf-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cf-tag {
    background: #00a884;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cf-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    opacity: 0.8;
}

.cf-tag button:hover {
    opacity: 1;
}

.cf-tags-input-wrapper input {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    color: #e9edef;
    font-size: 14px;
    padding: 4px;
}

.cf-tags-input-wrapper input:focus {
    outline: none;
}

/* ========================================
   JSON EDITOR
   ======================================== */

.cf-json-editor-wrapper {
    position: relative;
}

.cf-json-textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
}

.cf-btn-format {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #2a3942;
    border: none;
    color: #8696a0;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cf-btn-format:hover {
    background: #00a884;
    color: white;
}

/* JSON Editor Full */
.cf-json-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
}

.cf-json-toolbar {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: #1f2c33;
    align-items: center;
}

.cf-json-status {
    margin-left: auto;
    font-size: 13px;
}

.cf-status-ok {
    color: #00a884;
}

.cf-status-error {
    color: #f15c6d;
}

.cf-json-full-editor {
    flex: 1;
    background: #111b21;
    border: none;
    color: #e9edef;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    resize: none;
    min-height: 400px;
}

.cf-json-full-editor:focus {
    outline: none;
}

/* ========================================
   ARRAY SECTIONS
   ======================================== */

.cf-array-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cf-array-toolbar {
    display: flex;
    justify-content: flex-start;
}

.cf-array-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cf-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #667781;
}

.cf-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.cf-empty-state p {
    margin: 0;
}

/* ========================================
   ARRAY ITEMS
   ======================================== */

.cf-array-item {
    background: #1f2c33;
    border-radius: 8px;
    border: 1px solid #2a3942;
    overflow: hidden;
}

.cf-array-item-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cf-array-item-header:hover {
    background: rgba(0, 168, 132, 0.05);
}

.cf-array-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cf-array-item-index {
    background: #2a3942;
    color: #8696a0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.cf-array-item-name {
    color: #e9edef;
    font-weight: 500;
}

.cf-array-item-type {
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.cf-field-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.cf-badge-options {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.cf-badge-text {
    background: rgba(33, 150, 243, 0.15);
    color: #2196f3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.cf-field-type-badge i {
    font-size: 10px;
}

.cf-array-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cf-btn-icon {
    background: none;
    border: none;
    color: #8696a0;
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cf-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e9edef;
}

.cf-btn-icon.cf-btn-danger:hover {
    background: rgba(241, 92, 109, 0.2);
    color: #f15c6d;
}

.cf-array-chevron {
    color: #8696a0;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.cf-array-chevron.rotated {
    transform: rotate(90deg);
}

.cf-array-item-content {
    padding: 16px;
    border-top: 1px solid #2a3942;
    background: #111b21;
}

/* ========================================
   BOTONES
   ======================================== */

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* ========================================
   EDITOR VISUAL DE CAMPOS A RECOLECTAR
   ======================================== */

.cf-field-collector {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Editor compacto dentro de Actions */
.cf-fields-collector-section {
    background: rgba(0, 168, 132, 0.03);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 168, 132, 0.2);
}

.cf-collected-fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.cf-empty-state-small {
    text-align: center;
    padding: 24px;
    color: #667781;
    font-size: 13px;
}

.cf-empty-state-small i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
    display: block;
}

.cf-collected-field-item {
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 6px;
    overflow: hidden;
}

.cf-collected-field-header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.cf-collected-field-header:hover {
    background: rgba(0, 168, 132, 0.05);
}

.cf-field-number {
    background: #2a3942;
    color: #8696a0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.cf-field-id-preview {
    flex: 1;
    color: #e9edef;
    font-size: 13px;
    font-weight: 500;
}

.cf-field-type-mini {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cf-type-options {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.cf-type-text {
    background: rgba(33, 150, 243, 0.15);
    color: #2196f3;
}

.cf-field-item-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.cf-btn-icon-mini {
    background: none;
    border: none;
    color: #8696a0;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 12px;
}

.cf-btn-icon-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e9edef;
}

.cf-btn-icon-mini.cf-btn-danger:hover {
    background: rgba(241, 92, 109, 0.2);
    color: #f15c6d;
}

.cf-collected-field-content {
    padding: 12px;
    border-top: 1px solid #2a3942;
    background: #111b21;
}

.cf-field-collector-mini {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cf-form-group-mini {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cf-form-group-mini label {
    color: #8696a0;
    font-size: 12px;
    font-weight: 500;
}

.cf-form-group-mini input[type="text"],
.cf-form-group-mini textarea {
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 6px;
    padding: 8px 10px;
    color: #e9edef;
    font-size: 13px;
}

.cf-form-group-mini input:focus,
.cf-form-group-mini textarea:focus {
    outline: none;
    border-color: #00a884;
}

.cf-response-type-mini {
    display: flex;
    gap: 6px;
}

.cf-response-mini-option {
    flex: 1;
    padding: 8px 12px;
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #8696a0;
}

.cf-response-mini-option:hover {
    background: rgba(0, 168, 132, 0.1);
    border-color: rgba(0, 168, 132, 0.3);
}

.cf-response-mini-option.active {
    background: rgba(0, 168, 132, 0.15);
    border-color: #00a884;
    color: #00a884;
}

.cf-options-mini-group {
    background: rgba(0, 168, 132, 0.05);
    padding: 10px;
    border-radius: 6px;
    border: 1px dashed rgba(0, 168, 132, 0.3);
}

.cf-options-mini-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.cf-mini-option-item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.cf-mini-option-item input {
    flex: 1;
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 4px;
    padding: 6px 8px;
    color: #e9edef;
    font-size: 12px;
}

.cf-mini-option-item input:focus {
    outline: none;
    border-color: #00a884;
}

.cf-mini-option-item button {
    background: rgba(241, 92, 109, 0.15);
    border: none;
    color: #f15c6d;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.cf-mini-option-item button:hover {
    background: rgba(241, 92, 109, 0.25);
}

.btn-mini-add {
    background: rgba(0, 168, 132, 0.15);
    border: 1px solid rgba(0, 168, 132, 0.3);
    color: #00a884;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-mini-add:hover {
    background: rgba(0, 168, 132, 0.25);
    border-color: #00a884;
}

.cf-response-type {
    display: flex;
    gap: 8px;
}

.cf-response-type-option {
    flex: 1;
    padding: 12px 16px;
    background: #1f2c33;
    border: 2px solid #2a3942;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #8696a0;
    font-size: 13px;
}

.cf-response-type-option i {
    font-size: 20px;
    color: #8696a0;
}

.cf-response-type-option:hover {
    background: rgba(0, 168, 132, 0.1);
    border-color: rgba(0, 168, 132, 0.3);
}

.cf-response-type-option.active {
    background: rgba(0, 168, 132, 0.15);
    border-color: #00a884;
    color: #00a884;
}

.cf-response-type-option.active i {
    color: #00a884;
}

.cf-options-group {
    background: rgba(0, 168, 132, 0.05);
    padding: 16px;
    border-radius: 8px;
    border: 1px dashed #00a884;
}

.cf-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.cf-option-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cf-option-item input {
    flex: 1;
    background: #1f2c33;
    border: 1px solid #2a3942;
    border-radius: 6px;
    padding: 10px 12px;
    color: #e9edef;
    font-size: 14px;
}

.cf-option-item input:focus {
    outline: none;
    border-color: #00a884;
    box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.1);
}

.cf-btn-remove-option {
    background: rgba(241, 92, 109, 0.1);
    border: 1px solid rgba(241, 92, 109, 0.3);
    color: #f15c6d;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
}

.cf-btn-remove-option:hover {
    background: rgba(241, 92, 109, 0.2);
    border-color: #f15c6d;
}

.cf-btn-remove-option i {
    font-size: 12px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    #conversationFlowsEditorModal .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .cf-editor-tabs {
        overflow-x: auto;
    }
    
    .cf-section-content {
        padding: 12px;
    }
    
    .cf-array-item-actions button:not(.cf-btn-danger):not(:last-child) {
        display: none;
    }
}

