/* --- VARIABLES --- */
:root {
    --afb-primary: #6366f1;
    --afb-bg: #f1f5f9;
    --afb-surface: #ffffff;
    --afb-border: #e2e8f0;
    --afb-text: #0f172a;
    --afb-text-muted: #64748b;
    --afb-radius: 10px;
}

/* --- LAYOUT GLOBAL --- */
.afb-builder-wrapper {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--afb-bg);
    margin-left: -20px; margin-top: 20px;
    height: calc(100vh - 32px);
    display: flex; flex-direction: column;
    color: var(--afb-text);
}

/* --- HEADER --- */
.afb-header {
    background: var(--afb-surface); border-bottom: 1px solid var(--afb-border);
    padding: 0 24px; height: 64px; display: flex; justify-content: space-between; align-items: center; z-index: 20;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.afb-header h1 { font-size: 18px; font-weight: 700; margin: 0; color: #1e293b; }

/* --- MAIN CONTAINER --- */
.afb-main { display: flex; flex: 1; overflow: hidden; }

/* --- SIDEBAR IZQUIERDA (TOOLS) --- */
.afb-sidebar-tools { width: 260px; background: var(--afb-surface); border-right: 1px solid var(--afb-border); display: flex; flex-direction: column; z-index: 10; }
.afb-tools-list { padding: 20px; overflow-y: auto; flex: 1; }
.afb-tool-category { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #94a3b8; margin: 24px 0 12px 0; letter-spacing: 0.05em; }
.afb-tool-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    background: #fff; border: 1px solid var(--afb-border); padding: 12px 16px;
    border-radius: 8px; cursor: pointer; transition: all 0.2s ease; margin-bottom: 8px;
    font-size: 13px; font-weight: 600; color: var(--afb-text);
}
.afb-tool-btn:hover { border-color: var(--afb-primary); transform: translateY(-1px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); color: var(--afb-primary); }

/* --- CANVAS CENTRAL --- */
.afb-canvas {
    flex: 1; background-color: #f8fafc;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px); background-size: 24px 24px;
    padding: 40px; overflow-y: auto; display: flex; flex-direction: column; align-items: center;
}
.afb-drop-zone { width: 100%; max-width: 600px; padding-bottom: 120px; }

/* --- TARJETA DE CAMPO (EL PROBLEMA ANTERIOR) --- */
.afb-field-card {
    background: #fff; border: 1px solid var(--afb-border); border-radius: var(--afb-radius);
    margin-bottom: 16px; overflow: hidden; transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); position: relative;
}
.afb-field-card:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-color: #cbd5e1; }
.afb-field-card::before { content:''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; transition: 0.2s; }
.afb-field-card:hover::before { background: var(--afb-primary); }

/* Cabecera de la Tarjeta */
.afb-card-header {
    background: #f8fafc; padding: 12px 16px; border-bottom: 1px solid var(--afb-border);
    display: flex; justify-content: space-between; align-items: center; cursor: move;
}
.afb-card-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; color: #334155; }
.afb-card-icon { color: #64748b; }

/* Cuerpo de la Tarjeta */
.afb-card-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.afb-input-row { display: flex; gap: 15px; align-items: flex-start; }
.afb-input-col { flex: 1; }
.afb-input-label { display: block; font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 6px; }

/* Tarjeta Especial: Salto de P¨¢gina */
.afb-field-card.step-break {
    background: linear-gradient(to right, #eff6ff, #fff, #eff6ff);
    border: 1px dashed #6366f1; text-align: center; padding: 0;
}
.afb-field-card.step-break .afb-card-header { background: transparent; border: none; justify-content: center; padding: 15px; }
.afb-step-label { color: #6366f1; font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }

/* --- SIDEBAR DERECHA (TABS) --- */
.afb-sidebar-settings { width: 350px; background: var(--afb-surface); border-left: 1px solid var(--afb-border); display: flex; flex-direction: column; z-index: 15; }
.afb-tabs-header { display: flex; border-bottom: 1px solid var(--afb-border); background: #fff; }
.afb-tab-btn {
    flex: 1; text-align: center; padding: 16px 0; font-size: 11px; font-weight: 700;
    color: var(--afb-text-muted); cursor: pointer; text-transform: uppercase;
    border-bottom: 2px solid transparent; transition: 0.2s;
}
.afb-tab-btn:hover { background: #f8fafc; color: var(--afb-primary); }
.afb-tab-btn.active { color: var(--afb-primary); border-bottom-color: var(--afb-primary); }
.afb-settings-content { padding: 24px; overflow-y: auto; flex: 1; }

/* --- MODAL VISTA PREVIA --- */
.afb-modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(4px);
    z-index: 99999; display: flex; align-items: center; justify-content: center;
}
.afb-modal-window {
    background: #f1f5f9; width: 95%; height: 90%; max-width: 1100px;
    border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.afb-modal-header {
    background: #1e293b; padding: 15px 25px; display: flex; justify-content: space-between; align-items: center; color: white;
}
.afb-preview-container { flex: 1; overflow: auto; padding: 40px; display: flex; justify-content: center; }
.afb-device-frame { background: white; transition: all 0.3s ease; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); overflow: hidden; display: flex; flex-direction: column; }
.device-desktop { width: 100%; max-width: 800px; height: auto; min-height: 500px; border-radius: 8px; }
.device-mobile { width: 375px; height: 750px; border-radius: 30px; border: 10px solid #1e293b; }

/* --- COMPONENTES UI --- */
.afb-btn-primary { background: var(--afb-primary); color: #fff; border: none; padding: 10px 20px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.afb-btn-icon { background: transparent; border: none; color: #94a3b8; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; }
.afb-btn-icon:hover { background: #fee2e2; color: #ef4444; } /* Rojo para borrar */

#poststuff #post-body.columns-2{margin-right:0px !important;}
/* --- ESTILO PARA BOTONES WP COMPONENTS (Secondary + Small) --- */

.components-button.is-secondary.is-small {
    /* Layout Flex para centrar iconos y texto */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px; 

    /* Dimensiones compactas pero clicables */
    height: 30px; 
    padding: 0 12px;
    
    /* Tipografía */
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    
    /* Apariencia "Ghost/Outline" Moderna */
    background-color: #ffffff;
    border: 1px solid #e2e8f0;     /* Gris muy suave */
    color: #64748b;                /* Gris texto medio */
    border-radius: 6px;
    
    /* Sombra sutil y transición */
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    outline: none;
}



/* Estado Hover (Al pasar el mouse) */
.components-button.is-secondary.is-small:hover {
    background-color: #f8fafc;     /* Gris pálido */
    border-color: #cbd5e1;         /* Borde un poco más oscuro */
    color: #334155;                /* Texto casi negro */
    transform: translateY(-1px);   /* Se eleva 1 pixel */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Estado Active/Focus (Al hacer clic) */
.components-button.is-secondary.is-small:active,
.components-button.is-secondary.is-small:focus {
    background-color: #f1f5f9;
    border-color: #6366f1;         /* Se pinta del color primario (Indigo) */
    color: #6366f1;
    transform: translateY(0);
    box-shadow: none;
}

/* Ajuste especial si tiene un icono dentro (Dashicon o Material) */
.components-button.is-secondary.is-small .dashicon,
.components-button.is-secondary.is-small svg {
    margin-right: 2px;
    width: 14px;
    height: 14px;
    fill: currentColor; /* El icono hereda el color del texto */
}
.afb-btn-secondary:active,
.afb-btn-secondary:focus {
    background-color: #f1f5f9;
    border-color: #6366f1;         /* Se pinta del color primario (Indigo) */
    color: #6366f1;
    transform: translateY(0);
    box-shadow: none;
}
.afb-btn-secondary{
    background-color: #f8fafc;     /* Gris pálido */
    border-color: #cbd5e1;         /* Borde un poco más oscuro */
    color: #334155;                /* Texto casi negro */
    transform: translateY(-1px);   /* Se eleva 1 pixel */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}


.components-button.is-secondary {
    /* Layout Flex para centrar iconos y texto */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px; 

    /* Dimensiones compactas pero clicables */
    height: 30px; 
    padding: 0 12px;
    
    /* Tipografía */
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    
    /* Apariencia "Ghost/Outline" Moderna */
    background-color: #ffffff;
    border: 1px solid #e2e8f0;     /* Gris muy suave */
    color: #64748b;                /* Gris texto medio */
    border-radius: 6px;
    
    /* Sombra sutil y transición */
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    outline: none;
}



/* Estado Hover (Al pasar el mouse) */
.components-button.is-secondary:hover {
    background-color: #f8fafc;     /* Gris pálido */
    border-color: #cbd5e1;         /* Borde un poco más oscuro */
    color: #334155;                /* Texto casi negro */
    transform: translateY(-1px);   /* Se eleva 1 pixel */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Estado Active/Focus (Al hacer clic) */
.components-button.is-secondary:active,
.components-button.is-secondary:focus {
    background-color: #f1f5f9;
    border-color: #6366f1;         /* Se pinta del color primario (Indigo) */
    color: #6366f1;
    transform: translateY(0);
    box-shadow: none;
}

/* Ajuste especial si tiene un icono dentro (Dashicon o Material) */
.components-button.is-secondary.dashicon,
.components-button.is-secondary svg {
    margin-right: 2px;
    width: 14px;
    height: 14px;
    fill: currentColor; /* El icono hereda el color del texto */
}
/* --- ESTILOS PARA AUTORESPUESTA --- */
.afb-variables-box {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}
.afb-variables-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 8px;
    display: block;
}
.afb-variable-tag {
    display: inline-block;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #6366f1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    margin-right: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.afb-variable-tag:hover {
    border-color: #6366f1;
    background: #eef2ff;
}
/* Reinicio básico para evitar herencia del Tema */
.afb-form-clean-wrapper .afb-frontend-form * {
    box-sizing: border-box !important;
    font-family: 'Inter', sans-serif; /* Asegura tu fuente */
}

.afb-form-clean-wrapper .afb-frontend-form input,
.afb-form-clean-wrapper .afb-frontend-form select,
.afb-form-clean-wrapper .afb-frontend-form textarea {
    all: unset; /* Borra estilos del tema (cuidado: borra TODO) */
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #ffffff;
    font-size: 16px; /* Evita zoom automático en iOS */
    transition: border-color 0.2s;
}
.afb-range-input {
    width: 100%;
    accent-color: #6366f1; /* O el color de tu tema */
    cursor: pointer;
}