/**
 * Sistema de Gestión de Formularios Dinámicos EPCIS - RASTRAR
 * Archivo: css/forms.css
 * Estilos específicos para el módulo de formularios
 */

/* ============================================
   BARRA SUPERIOR
   ============================================ */
.epcis-top-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-3xl);
}

.epcis-icon-container {
    flex-shrink: 0;
}

.icon-preview {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--white);
    box-shadow: var(--shadow-sm) var(--primary-light);
}

.epcis-filters-row {
    display: flex;
    gap: var(--spacing-lg);
    flex: 1;
}

.epcis-filter-select,
.epcis-search-input {
    flex: 1;
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--white);
    font-size: var(--font-md);
    transition: all var(--transition-normal) ease;
}

.epcis-filter-select:focus,
.epcis-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.epcis-filter-select option {
    background: var(--dark);
    color: var(--white);
}

.epcis-action-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--spacing-sm);
}

.epcis-action-container .btn-primary {
    color: var(--white);
    padding: var(--spacing-md) var(--spacing-2xl);
    border-radius: var(--border-radius-md);
    font-weight: var(--font-semibold);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: all var(--transition-normal) ease;
    box-shadow: var(--shadow-sm) var(--primary-light);
    white-space: nowrap;
}

.epcis-action-container .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg) var(--primary-shadow);
}

.epcis-results-text {
    font-size: var(--font-xs);
    color: var(--gray);
}

/* ============================================
   BARRA DE MODOS DE VISTA
   ============================================ */
.epcis-view-mode-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    background: var(--white-transparent-05);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-2xl);
    border: 1px solid var(--white-transparent-10);
}

.epcis-view-mode-label {
    font-size: var(--font-md);
    /*font-weight: var(--font-semibold);*/
    color: var(--gray);
    margin-right: var(--spacing-sm);
}

.epcis-view-mode-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-sm);
    color: var(--gray);
    font-size: var(--font-md);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
}

.epcis-view-mode-btn:hover {
    background: var(--white-transparent-10);
    border-color: var(--primary-light);
    color: var(--primary);
}

.epcis-view-mode-btn.active {
    background: var(--gray);
    border-color: var(--primary);
    color: var(--primary);
}

.epcis-view-mode-btn i {
    font-size: var(--spacing-lg);
}

/* ============================================
   GRID DE FORMULARIOS - BASE
   ============================================ */
.epcis-forms-grid {
    width: 100%;
}

/* ============================================
   VISTA TARJETAS (CARD) - DEFAULT
   ============================================ */
.epcis-forms-grid.epcis-view-mode-card {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: var(--spacing-2xl);
}

/* ============================================
   CARD DE FORMULARIO
   ============================================ */
.epcis-form-card {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-2xl);
    transition: all var(--transition-normal) ease;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.epcis-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform var(--transition-normal) ease;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.epcis-form-card:hover {
    background: var(--white-transparent-08);
    border-color: var(--primary-shadow);
    transform: translateY(-4px);
    box-shadow: var(--shadow-2xl) var(--black-transparent-30);
}

.epcis-form-card:hover::before {
    transform: scaleX(1);
}

/* ============================================
   INFORMACIÓN DEL CARD - CORRECCIÓN
   ============================================ */

/* Badge superior del card */
.epcis-chain-badge {
    position: absolute;
    top: -0.5rem;
    right: var(--spacing-lg);
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: var(--white);
    padding: 0.375rem 0.875rem;
    border-radius: var(--border-radius-full);
    font-size: 0.7rem;
    font-weight: var(--font-semibold);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
    z-index: 5;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* Nombre del formulario */
.epcis-form-name {
    font-size: 1.1rem;
    font-weight: var(--font-bold);
    margin-bottom: 0.25rem;
    color: var(--white);
    line-height: 1.3;
    word-break: break-word;
}

/* ID del formulario */
.epcis-form-id {
    font-size: var(--font-xs);
    color: white;
    font-family: 'Courier New', monospace;
    opacity: 0.8;
    background: #6a6cf0;
    width: 100px;
    text-align: center;
    padding: 5px 0px 1px 0px;
    border-radius: 10px;
}

/* Descripción del formulario */
.epcis-form-description {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.8rem;
    word-break: break-word;
}

/* Header del card - mejor disposición */
.epcis-form-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-md);
}

.epcis-form-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
    flex: 1;
    min-width: 0; /* Permite que el texto se ajuste */
}

.epcis-form-info {
    flex: 1;
    min-width: 0; /* Permite que el texto se ajuste */
}

/* Menú en el card */
.epcis-form-menuForms {
    position: relative;
    flex-shrink: 0;
}
.epcis-form-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--info) 0%, #8B5CF6 100%);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-2xl);
    flex-shrink: 0;
    color: var(--white);
}


.epcis-form-name {
    font-size: 1.1rem;
    font-weight: var(--font-bold);
    margin-bottom: 0.25rem;
    color: var(--white);
    line-height: 1.3;
}



/* Estadísticas */
.epcis-form-stats {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.epcis-stat-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    color: var(--info);
    font-weight: var(--font-semibold);
}

.epcis-stat-badge i {
    font-size: var(--font-xs);
}

.epcis-stat-badge.epcis-status-active {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.epcis-stat-badge.epcis-status-inactive {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.epcis-stat-badge.epcis-stat-date {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

/* Tipos de campos */
.epcis-field-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: var(--spacing-lg);
    min-height: 2.5rem;
    align-items: center;
}

.epcis-add-field-mini-btn {
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-md);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 10px;
}

.epcis-add-field-mini-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) rgba(16, 185, 129, 0.4);
}

/* ============================================
   LISTA MINI DE CAMPOS EN EL CARD CON DRAG & DROP
   ============================================ */
.epcis-fields-mini-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    max-height: 200px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: var(--black-transparent-30);
    border-radius: var(--border-radius-sm);
    min-height: 40px;
}

.epcis-field-mini-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0.7rem;
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    cursor: default;
}

.epcis-field-mini-item[draggable="true"] {
    cursor: move;
    user-select: none;
}

.epcis-field-mini-item:hover {
    background: var(--white-transparent-10);
    border-color: var(--primary-light);
}

.epcis-field-mini-item.dragging {
    opacity: var(--opacity-50);
    background: var(--primary-lighter);
    border-color: var(--primary);
}

.epcis-field-mini-item.drag-over {
    border-top: 2px solid var(--primary);
    margin-top: 2px;
}

/* Handle de arrastre */
.epcis-field-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--spacing-sm);
    /*color: var(--gray-light);*/
    cursor: grab;
    /*opacity: var(--opacity-50);*/
    transition: all var(--transition-fast) ease;
}

.epcis-field-drag-handle:hover {
    opacity: 1;
    color: var(--primary);
}

.epcis-field-mini-item[draggable="true"]:active .epcis-field-drag-handle {
    cursor: grabbing;
}

/* Contenido del campo */
.epcis-field-mini-content {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    cursor: pointer;
}

.epcis-field-mini-content i {
    font-size: var(--spacing-lg);
}

.epcis-field-mini-name {
    font-size: 0.85rem;
    font-weight: var(--font-semibold);
    /*color: #e2e8f0;*/
}

.epcis-field-mini-type {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    /*color: #a78bfa;*/
    border-radius: var(--border-radius-sm);
    font-family: 'Courier New', monospace;
}

.epcis-field-mini-delete {
    padding: 0.3rem 0.5rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.epcis-field-mini-delete:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

.epcis-fields-mini-list::-webkit-scrollbar {
    width: 6px;
}

.epcis-fields-mini-list::-webkit-scrollbar-track {
    background: var(--black-transparent-30);
    border-radius: var(--spacing-lg);
}

.epcis-fields-mini-list::-webkit-scrollbar-thumb {
    background: var(--primary-shadow);
    border-radius: var(--spacing-lg);
}

.epcis-fields-mini-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}

/* ============================================
   MENÚ DESPLEGABLE - CORRECCIÓN
   ============================================ */

.epcis-form-menu,
.epcis-form-menuForms {
    position: relative;
}

.epcis-menu-btn {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-sm);
    color: var(--gray);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    position: relative;
    z-index: 1;
}

.epcis-menu-btn:hover {
    background: var(--white-transparent-10);
    color: var(--white);
    border-color: var(--primary);
}

/* Menú desplegable - posicionamiento correcto */
.epcis-dropdown-menu,
.epcis-dropdown-menuForms {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid var(--white-transparent-20);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm);
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 107, 53, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all var(--transition-normal) ease;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.epcis-dropdown-menu.active,
.epcis-dropdown-menuForms.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Items del menú */
.epcis-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--gray-light);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    width: 100%;
    text-align: left;
    font-size: var(--font-md);
    white-space: nowrap;
}

.epcis-menu-item:hover {
    background: var(--white-transparent-10);
    color: var(--white);
    transform: translateX(4px);
}

.epcis-menu-item i {
    font-size: var(--font-lg);
    width: 1.25rem;
    flex-shrink: 0;
}

.epcis-menu-item-danger {
    color: var(--danger);
}

.epcis-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #F87171;
}

.epcis-menu-divider {
    height: 1px;
    background: var(--white-transparent-10);
    margin: var(--spacing-sm) 0;
}

/* ============================================
   OVERLAYS PARA MENÚS - IMPORTANTE
   ============================================ */

/* Overlay cuando el menú está abierto */
.epcis-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 9998;
    display: none;
}

.epcis-menu-overlay.active {
    display: block;
}

/* Asegurar que el menú esté por encima del overlay */
.epcis-dropdown-menu.active,
.epcis-dropdown-menuForms.active {
    z-index: 9999;
}
/* ============================================
   VISTA EN LISTA
   ============================================ */
.epcis-forms-grid.epcis-view-mode-list {
    display: block !important;
    width: 100% !important;
}

.epcis-list-container {
    width: 100%;
    background: var(--white-transparent-05);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--white-transparent-10);
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.epcis-list-header {
    display: flex;
    align-items: center;
    padding: 1.25rem 2rem;
    background: var(--white-transparent-05);
    border-bottom: 1px solid var(--white-transparent-10);
    font-size: var(--font-md);
    font-weight: var(--font-semibold);
    color: var(--gray);
}

.epcis-list-row {
    display: flex;
    align-items: center;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--white-transparent-05);
    transition: all var(--transition-fast) ease;
    min-height: 80px;
}

.epcis-list-row:hover {
    background: var(--primary-lightest);
}

.epcis-list-row:last-child {
    border-bottom: none;
}

.epcis-list-col-icon,
.epcis-list-col-name,
.epcis-list-col-chain,
.epcis-list-col-fields,
.epcis-list-col-status,
.epcis-list-col-date,
.epcis-list-col-actions {
    display: flex;
    align-items: center;
}

.epcis-list-col-icon {
    min-width: 70px;
    width: 70px;
}

.epcis-list-col-name {
    min-width: 200px;
    flex: 2.5;
    justify-content: flex-start;
}

.epcis-list-col-chain {
    min-width: 150px;
    flex: 1.5;
}

.epcis-list-col-fields {
    min-width: 120px;
    width: 120px;
    justify-content: center;
}

.epcis-list-col-status {
    min-width: 140px;
    width: 140px;
}

.epcis-list-col-date {
    min-width: 220px;
    width: 220px;
}

.epcis-list-col-actions {
    min-width: 220px;
    width: 220px;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

.epcis-list-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-lighter);
    border-radius: var(--spacing-lg);
    color: var(--primary);
    font-size: 1.4rem;
}

.epcis-list-name {
    font-weight: var(--font-semibold);
    color: var(--white);
    font-size: var(--spacing-lg);
    margin-bottom: 0.25rem;
}

.epcis-list-id {
    font-size: 0.8rem;
    color: var(--gray-dark);
    font-family: 'Courier New', monospace;
}

.epcis-list-chain-badge {
    padding: 0.35rem 0.85rem;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--border-radius-sm);
    color: #A78BFA;
    font-size: 0.8rem;
    font-weight: var(--font-semibold);
}

.epcis-list-badge {
    padding: 0.35rem 0.85rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--border-radius-sm);
    color: var(--info);
    font-size: var(--font-md);
    font-weight: var(--font-semibold);
}

.epcis-list-status {
    padding: 0.35rem 0.85rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: var(--font-semibold);
}

.epcis-list-status.epcis-status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.epcis-list-status.epcis-status-inactive {
    background: rgba(107, 114, 128, 0.1);
    color: var(--gray);
}

.epcis-list-col-date {
    color: var(--gray);
    font-size: 0.9rem;
}

.epcis-list-action-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border-radius: var(--border-radius-sm);
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    color: var(--gray);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    flex-shrink: 0;
    overflow: visible;
}

.epcis-list-action-btn:hover {
    background: var(--primary-lighter);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) var(--primary-lighter);
}

.epcis-list-action-btn::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 0.25rem var(--spacing-sm);
    background: rgba(26, 26, 46, var(--opacity-98));
    color: var(--white);
    font-size: var(--font-xs);
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast) ease;
    border: 1px solid var(--primary-light);
}

.epcis-list-action-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

.epcis-list-action-btn i {
    font-size: var(--font-md);
    line-height: 1;
}

.epcis-list-action-danger:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--danger);
}

.epcis-list-container::-webkit-scrollbar {
    width: var(--spacing-sm);
}

.epcis-list-container::-webkit-scrollbar-track {
    background: var(--white-transparent-05);
    border-radius: var(--spacing-xs);
}

.epcis-list-container::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: var(--spacing-xs);
}

.epcis-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-shadow);
}

/* ============================================
   VISTA EN ICONOS
   ============================================ */
.epcis-forms-grid.epcis-view-mode-icons {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 1.25rem !important;
    width: 100%;
}

.epcis-icon-card {
    position: relative;
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-2xl) var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    transition: all var(--transition-normal) ease;
    cursor: pointer;
    min-height: 180px;
}

.epcis-icon-card:hover {
    background: var(--primary-lightest);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.epcis-icon-card-menu {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    z-index: 10;
}

.epcis-icon-card .epcis-menu-btn {
    background: var(--black-transparent-30);
    border: 1px solid var(--white-transparent-20);
}

.epcis-icon-card:hover .epcis-menu-btn {
    background: var(--primary-lighter);
    border-color: var(--primary-shadow);
}

.epcis-icon-card-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-lighter);
    border-radius: var(--border-radius-md);
    color: var(--primary);
    font-size: 1.8rem;
}

.epcis-icon-card-title {
    font-weight: var(--font-semibold);
    color: var(--white);
    font-size: var(--font-md);
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.epcis-icon-card-stats {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    width: 100%;
    justify-content: center;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--white-transparent-10);
}

.epcis-icon-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--gray);
    font-size: var(--font-md);
}

.epcis-icon-stat i {
    font-size: var(--font-md);
}

.epcis-icon-stat.epcis-status-active {
    color: var(--success);
}

.epcis-icon-stat.epcis-status-active i {
    font-size: var(--font-sm);
}

.epcis-icon-stat.epcis-status-inactive {
    color: var(--gray-dark);
}

.epcis-icon-stat.epcis-status-inactive i {
    font-size: var(--font-sm);
}

/* ============================================
   ESTADO VACÍO
   ============================================ */
.epcis-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.epcis-empty-state i {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    opacity: var(--opacity-50);
}

.epcis-empty-state h3 {
    font-size: 1.25rem;
    font-weight: var(--font-semibold);
    margin-bottom: var(--spacing-sm);
    color: #94a3b8;
}

.epcis-empty-state p {
    font-size: var(--font-md);
}

/* ============================================
   MODAL - CONTENEDOR
   ============================================ */
.epcis-modal-container {
    text-align: left;
    display: grid;
    gap: var(--spacing-lg);
}

.epcis-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.epcis-modal-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
    font-weight: var(--font-semibold);
    /*color: #e2e8f0;*/
    margin-top: 10px !important;
}

/* ============================================
   VISTA DETALLADA
   ============================================ */
.epcis-view-container {
    text-align: left;
    max-height: 70vh;
    overflow-y: auto;
}

.epcis-view-header {
    background: var(--white-transparent-05);
    padding: var(--spacing-2xl);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--white-transparent-10);
    margin-bottom: var(--spacing-2xl);
}

.epcis-view-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--info) 0%, #8B5CF6 100%);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-2xl);
    color: var(--white);
}

.epcis-view-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: var(--font-semibold);
}

.epcis-badge-active {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.epcis-badge-inactive {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.epcis-badge-fields {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

.epcis-badge-events {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ============================================
   CAMPOS EN VISTA DETALLADA
   ============================================ */
.epcis-view-fields {
    display: grid;
    gap: var(--spacing-lg);
}

.epcis-field-detail {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.epcis-field-detail-header {
    background: var(--white-transparent-05);
    padding: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--white-transparent-10);
}

.epcis-required-badge {
    display: inline-block;
    padding: 0.2rem var(--spacing-sm);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: var(--font-semibold);
}

.epcis-visibility-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
}

.epcis-visibility-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.epcis-visibility-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.epcis-visibility-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

.epcis-field-detail-body {
    padding: var(--spacing-lg);
    display: grid;
    gap: var(--spacing-sm);
}

.epcis-field-row {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.epcis-field-label {
    color: #94a3b8;
    font-size: 0.85rem;
    min-width: 100px;
    font-weight: var(--font-semibold);
}

.epcis-field-value {
    /*color: #e2e8f0;*/
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    flex: 1;
}

/* ============================================
   VISOR JSON
   ============================================ */
.epcis-json-container {
    text-align: left;
}

.epcis-json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--white-transparent-10);
}

.epcis-json-info {
    color: #94a3b8;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.epcis-json-action-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: 1px solid;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: var(--font-semibold);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.epcis-json-copy {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--info);
}

.epcis-json-copy:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.epcis-json-download {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.epcis-json-download:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.epcis-json-viewer {
    background: #1e293b;
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-2xl);
    max-height: 600px;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #cbd5e1;
}

/* ============================================
   GESTOR DE CAMPOS
   ============================================ */
.epcis-fields-manager {
    text-align: left;
}

.epcis-fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--white-transparent-05);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--white-transparent-10);
    margin-bottom: var(--spacing-2xl);
}

.epcis-form-icon-small {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--info) 0%, #8B5CF6 100%);
    border-radius: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-2xl);
    color: var(--white);
}

.epcis-add-field-btn {
    padding: 0.7rem var(--spacing-2xl);
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--spacing-lg);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
}

.epcis-add-field-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) rgba(16, 185, 129, 0.4);
}

.epcis-fields-list {
    display: grid;
    gap: 0.8rem;
    max-height: 500px;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.epcis-empty-fields {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.epcis-empty-fields i {
    font-size: 3rem;
    margin-bottom: var(--spacing-lg);
    opacity: var(--opacity-50);
}

.epcis-empty-fields p {
    font-size: var(--spacing-lg);
    color: #64748b;
}

/* ============================================
   ITEM DE CAMPO
   ============================================ */
.epcis-field-item {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.epcis-field-item:hover {
    background: var(--white-transparent-05);
    border-color: var(--primary-light);
}

.epcis-field-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--white-transparent-05);
    border-bottom: 1px solid var(--white-transparent-10);
}

.epcis-field-item-type {
    padding: 0.2rem var(--spacing-sm);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    font-size: 0.7rem;
    color: #a78bfa;
    font-family: 'Courier New', monospace;
    font-weight: var(--font-semibold);
}

.epcis-field-item-btn {
    padding: 0.4rem 0.6rem;
    background: transparent;
    border: 1px solid var(--white-transparent-20);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: #cbd5e1;
}

.epcis-btn-edit-field:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.epcis-btn-delete-field:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.epcis-field-item-details {
    display: flex;
    gap: var(--spacing-lg);
    padding: 0.8rem var(--spacing-lg);
    font-size: 0.8rem;
    color: #94a3b8;
}

.epcis-field-item-details span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ============================================
   SELECTOR DE TIPO
   ============================================ */
.epcis-type-selector {
    display: grid;
    /*grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));*/
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

.epcis-type-option {
    position: relative;
    cursor: pointer;
}

.epcis-type-card {
    background: var(--white-transparent-05);
    border: 2px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    text-align: center;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    height: 100%;
}

.epcis-type-card i {
    font-size: 2.5rem;
    color: var(--info);
    /*margin-bottom: var(--spacing-sm);*/
}

.epcis-type-name {
    font-weight: var(--font-semibold);
    /*color: #e2e8f0;*/
    font-size: 0.85rem;
}

.epcis-type-code {
    font-size: 0.65rem;
    /*color: #94a3b8;*/
    font-family: 'Courier New', monospace;
}

.epcis-type-desc {
    font-size: 0.7125rem;
    /*color: var(--gray-light);*/
    line-height: 1.4;
    display: block;
}

.epcis-type-option:hover .epcis-type-card {
    background: var(--primary-light);
    border-color: var(--primary-shadow);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md) var(--primary-light);
}

.epcis-type-option:hover .epcis-type-card i {
    color: var(--primary);
    transform: scale(1.1);
}

.epcis-type-option:active .epcis-type-card {
    transform: translateY(-2px);
}

/* ============================================
   GRUPOS DE CHECKBOX
   ============================================ */
.epcis-checkbox-group {
    display: grid;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--black-transparent-30);
    border-radius: var(--border-radius-sm);
    max-height: 300px;
    overflow-y: auto;
}

.epcis-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem;
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.epcis-checkbox-item:hover {
    background: var(--white-transparent-08);
    border-color: var(--primary-light);
}

.epcis-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.epcis-checkbox-item span {
    /*color: #e2e8f0;*/
    font-size: 0.9rem;
}

.epcis-checkbox-item .text-xs {
    color: #94a3b8;
    font-size: var(--font-xs);
    margin-left: auto;
}

/* ============================================
   ETIQUETAS DE CANTIDAD (AMOUNT)
   ============================================ */
.epcis-amount-labels {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
}

.epcis-amount-labels .epcis-modal-label {
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   ALERTA DE ELIMINACIÓN
   ============================================ */
.epcis-delete-warning {
    text-align: left;
    padding: var(--spacing-lg);
}

.epcis-delete-icon {
    width: 60px;
    height: 60px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
    font-size: var(--font-2xl);
    color: #f87171;
}

.epcis-delete-warning p {
    /*color: #e2e8f0;*/
    font-size: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.epcis-delete-warning strong {
    color: #f87171;
}

/* ============================================
   TABS PARA CARDS DE FORMULARIOS
   ============================================ */

.epcis-card-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0 var(--spacing-md) 0;
    border-bottom: 2px solid var(--white-transparent-10);
}

.epcis-card-tab {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: var(--font-md);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.epcis-card-tab:hover {
    color: var(--white);
    background: var(--white-transparent-05);
}

.epcis-card-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-lighter);
}

.epcis-card-content {
    min-height: 150px;
    padding: var(--spacing-sm) 0;
}

/* ============================================
   LISTA DE EVENTOS EN CARDS
   ============================================ */

.epcis-events-mini-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.epcis-event-mini-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-normal) ease;
}

.epcis-event-mini-item:hover {
    background: var(--white-transparent-08);
    border-color: var(--primary-light);
    transform: translateX(2px);
}

.epcis-event-mini-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    cursor: pointer;
}

.epcis-event-mini-content i {
    font-size: 1.25rem;
}

.epcis-event-mini-name {
    font-weight: var(--font-semibold);
    color: var(--white);
    font-size: var(--font-md);
}

.epcis-event-mini-type {
    font-size: var(--font-xs);
    color: var(--gray-light);
    background: var(--white-transparent-12);
    padding: 0.25rem var(--spacing-sm);
    border-radius: 0.25rem;
}

.epcis-event-mini-actions {
    display: flex;
    gap: 0.25rem;
}

.epcis-event-mini-spec {
    background: transparent;
    opacity: 0.7;
    padding: 0.3rem var(--spacing-sm);
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.epcis-event-mini-spec:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.1);
}

.epcis-event-mini-delete {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast) ease;
    opacity: var(--opacity-60);
}

.epcis-event-mini-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   TABS EN MODAL DE VISTA
   ============================================ */

.epcis-view-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin: var(--spacing-2xl) 0 var(--spacing-lg) 0;
    border-bottom: 2px solid var(--white-transparent-10);
}

.epcis-view-tab {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-2xl);
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: 0.9375rem;
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.epcis-view-tab:hover {
    color: var(--white);
    background: var(--white-transparent-05);
}

.epcis-view-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-lighter);
}

.epcis-tab-content {
    display: none;
    animation: fadeIn var(--transition-normal) ease;
}

.epcis-tab-content.active {
    display: block;
}

/* ============================================
   DETALLES DE EVENTOS EN MODAL
   ============================================ */

.epcis-view-events {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.epcis-event-detail {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
    transition: all var(--transition-normal) ease;
}

.epcis-event-detail:hover {
    background: var(--white-transparent-05);
    border-color: var(--primary-light);
}

.epcis-event-detail-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--white-transparent-10);
}

.epcis-event-detail-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.epcis-event-type-badge {
    display: inline-block;
    padding: 0.25rem var(--spacing-md);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
    color: var(--white);
}

.epcis-event-properties {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.epcis-event-prop {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem var(--spacing-md);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
    color: var(--info);
}

.epcis-event-mappings {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md);
}

.epcis-mapping-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    margin-top: var(--spacing-sm);
}

.epcis-mapping-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--white-transparent-05);
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
    justify-content: flex-start;
}

.epcis-mapping-from {
    font-weight: var(--font-semibold);
    color: var(--success);
}

.epcis-mapping-to {
    color: var(--info);
}

/* ============================================
   CONFIGURACIÓN DE EVENTOS - MODAL
   ============================================ */

.epcis-event-type-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.epcis-field-mapping-section {
    margin-top: var(--spacing-2xl);
    padding: 1.25rem;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius-md);
}

.epcis-mapping-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0 var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--info);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-md);
    /*color: #93C5FD;*/
}

.epcis-mapping-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.epcis-mapping-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--spacing-md);
    align-items: center;
}

.epcis-mapping-label {
    font-weight: var(--font-semibold);
    font-size: var(--font-md);
    color: var(--success);
    font-family: 'Courier New', monospace;
}

.epcis-mapping-select {
    padding: 0.625rem 0.875rem;
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-20);
border-radius: var(--border-radius-sm);
    color: var(--white);
    font-size: var(--font-md);
    transition: all var(--transition-normal) ease;
}

.epcis-mapping-select:focus {
    outline: none;
    border-color: var(--success);
    background: rgba(0, 0, 0, 0.9) !important;
}

/* ============================================
   ESPECIFICACIÓN DE EVENTOS
   ============================================ */

.epcis-spec-container {
    text-align: left;
}

.epcis-spec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--white-transparent-10);
}

.epcis-spec-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.epcis-spec-title i {
    font-size: var(--font-2xl);
}

.epcis-spec-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.epcis-spec-action-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    font-size: var(--font-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.epcis-spec-action-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

.epcis-spec-info {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--info);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-lg);
}

.epcis-spec-info p {
    margin: 0;
    color: #93C5FD;
    font-size: var(--font-md);
    line-height: 1.5;
}

.epcis-spec-info code {
    background: var(--white-transparent-10);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
}

.epcis-spec-viewer {
    background: var(--dark);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-2xl);
    overflow-x: auto;
    max-height: 500px;
}

.epcis-spec-viewer code {
    color: #93C5FD;
    font-family: 'Courier New', monospace;
    font-size: var(--font-md);
    line-height: 1.6;
}

.epcis-spec-preview {
    background: var(--white);
    color: var(--dark);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    overflow-y: auto;
    max-height: 600px;
    text-align: left;
}

.epcis-spec-preview h1 {
    color: var(--dark);
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
    border-bottom: 3px solid var(--primary);
    padding-bottom: var(--spacing-sm);
}

.epcis-spec-preview h2 {
    color: var(--info);
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: var(--spacing-lg);
}

.epcis-spec-preview h3 {
    color: var(--success);
    font-size: 1.25rem;
    margin-top: var(--spacing-2xl);
    margin-bottom: var(--spacing-md);
}

.epcis-spec-preview code {
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    color: var(--danger);
    font-size: var(--font-md);
}

.epcis-spec-preview pre {
    background: var(--dark);
    padding: var(--spacing-2xl);
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: var(--spacing-lg) 0;
}

.epcis-spec-preview pre code {
    background: transparent;
    color: #93C5FD;
    padding: 0;
}

.epcis-spec-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-lg) 0;
    font-size: var(--font-md);
}

.epcis-spec-preview table tr {
    border-bottom: 1px solid #e5e7eb;
}

.epcis-spec-preview table td {
    padding: var(--spacing-md);
    text-align: left;
}

.epcis-spec-preview table tr:first-child td {
    background: #f3f4f6;
    font-weight: var(--font-semibold);
}

.epcis-spec-preview ul {
    list-style: disc;
    margin-left: var(--spacing-2xl);
    margin-bottom: var(--spacing-lg);
}

.epcis-spec-preview li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.6;
}

.epcis-spec-preview hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 2rem 0;
}

.epcis-spec-preview a {
    color: var(--info);
    text-decoration: underline;
}

.epcis-spec-preview .epcis-markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-2xl) 0;
    font-size: var(--font-md);
    box-shadow: var(--shadow-sm) var(--black-transparent-10);
}

.epcis-spec-preview .epcis-markdown-table thead {
    background: var(--info);
    color: var(--white);
}

.epcis-spec-preview .epcis-markdown-table th {
    padding: 0.875rem;
    text-align: left;
    font-weight: var(--font-semibold);
    border: 1px solid #e5e7eb;
}

.epcis-spec-preview .epcis-markdown-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

.epcis-spec-preview .epcis-markdown-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.epcis-spec-preview .epcis-markdown-table tbody tr:hover {
    background: #eff6ff;
}

.epcis-spec-preview .epcis-markdown-table td {
    padding: 0.875rem;
    text-align: left;
    border: 1px solid #e5e7eb;
}

.epcis-spec-preview .epcis-markdown-table td code {
    background: #fef3c7;
    color: #92400e;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
}

/* ============================================
   ANIMACIONES Y TRANSICIONES
   ============================================ */
.epcis-forms-grid,
.epcis-list-container,
.epcis-icon-card {
    animation: fadeIn var(--transition-normal) ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */
.epcis-json-viewer::-webkit-scrollbar,
.epcis-view-container::-webkit-scrollbar,
.epcis-fields-list::-webkit-scrollbar,
.epcis-checkbox-group::-webkit-scrollbar {
    width: var(--spacing-sm);
    height: var(--spacing-sm);
}

.epcis-json-viewer::-webkit-scrollbar-track,
.epcis-view-container::-webkit-scrollbar-track,
.epcis-fields-list::-webkit-scrollbar-track,
.epcis-checkbox-group::-webkit-scrollbar-track {
    background: var(--black-transparent-30);
    border-radius: var(--spacing-lg);
}

.epcis-json-viewer::-webkit-scrollbar-thumb,
.epcis-view-container::-webkit-scrollbar-thumb,
.epcis-fields-list::-webkit-scrollbar-thumb,
.epcis-checkbox-group::-webkit-scrollbar-thumb {
    background: var(--primary-shadow);
    border-radius: var(--spacing-lg);
}

.epcis-json-viewer::-webkit-scrollbar-thumb:hover,
.epcis-view-container::-webkit-scrollbar-thumb:hover,
.epcis-fields-list::-webkit-scrollbar-thumb:hover,
.epcis-checkbox-group::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}

/* ============================================
   RESPONSIVE - MENÚ
   ============================================ */

@media (max-width: 768px) {
    .epcis-dropdown-menu,
    .epcis-dropdown-menuForms {
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(-10px) scale(0.95);
        min-width: 180px;
    }
    
    .epcis-dropdown-menu.active,
    .epcis-dropdown-menuForms.active {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    
    .epcis-form-name {
        font-size: 1rem;
    }
    
    .epcis-form-description {
        font-size: 0.8rem;
        min-height: 3rem;
    }
}

@media (max-width: 480px) {
    .epcis-chain-badge {
        top: -0.5rem;
        right: var(--spacing-sm);
        font-size: 0.65rem;
        padding: 0.25rem 0.65rem;
    }
    
    .epcis-form-card-header {
        gap: var(--spacing-sm);
    }
    
    .epcis-form-header {
        gap: var(--spacing-md);
    }
}

/* ============================================
   MEJORAS VISUALES ADICIONALES
   ============================================ */

/* Animación del menú */
@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.epcis-dropdown-menu.active,
.epcis-dropdown-menuForms.active {
    animation: menuSlideIn 0.2s ease-out;
}

/* Hover del botón cuando el menú está abierto */
.epcis-menu-btn.active {
    background: var(--primary-lighter);
    color: var(--primary);
    border-color: var(--primary);
}

/* Mejora visual del texto en el card */
.epcis-form-card {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Estado de carga para el menú */
.epcis-menu-item.loading {
    pointer-events: none;
    opacity: 0.5;
}

.epcis-menu-item.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--white-transparent-20);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: auto;
}


/*css PARA CLASES DE EVENTOS*/
.epcis-event-class-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    white-space: nowrap;
}

.epcis-event-class-badge i {
    font-size: 0.7em;
}
/*fin css PARA CLASES DE EVENTOS*/


/* ============================================
   KPI CONFIGURATOR - LAYOUT PRINCIPAL
   ============================================ */
.epcis-kpi-configurator {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: var(--spacing-2xl);
    min-height: 650px;
    max-height: 650px;
}

.epcis-kpi-left-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 650px;
    padding-right: var(--spacing-sm);
}

.epcis-kpi-right-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: sticky;
    top: 0;
    height: fit-content;
}

/* Scrollbar personalizado para panel izquierdo */
.epcis-kpi-left-panel::-webkit-scrollbar {
    width: 8px;
}

.epcis-kpi-left-panel::-webkit-scrollbar-track {
    background: var(--black-transparent-30);
    border-radius: var(--spacing-lg);
    margin: var(--spacing-sm) 0;
}

.epcis-kpi-left-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-shadow) 100%);
    border-radius: var(--spacing-lg);
    border: 2px solid var(--black-transparent-30);
}

.epcis-kpi-left-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
}

/* ============================================
   SELECTOR DE CANTIDAD DE KPIs
   ============================================ */
.epcis-kpi-count-selector {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

/* ============================================
   GRID DE KPIs (CARDS)
   ============================================ */
.epcis-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.epcis-kpi-card {
    position: relative;
    background: var(--white-transparent-05);
    border: 2px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.epcis-kpi-card:hover {
    border-color: var(--primary);
    background: var(--primary-lightest);
    transform: translateY(-2px);
}

.epcis-kpi-card.configured {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.epcis-kpi-card.unconfigured {
    border-color: var(--danger-light);
    border-style: dashed;
}

.epcis-kpi-card-number {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    font-size: var(--font-xs);
    font-weight: var(--font-bold);
    color: var(--gray);
    background: var(--black-transparent-30);
    padding: 0.25rem var(--spacing-sm);
    border-radius: var(--border-radius-sm);
}

.epcis-kpi-card-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.epcis-kpi-card-preview i {
    font-size: 1.75rem;
}

.epcis-kpi-card-title {
    font-size: 0.8rem;
    font-weight: var(--font-semibold);
    color: var(--white);
}

.epcis-kpi-card-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger);
    opacity: var(--opacity-60);
}

.epcis-kpi-card-empty i {
    font-size: 1.5rem;
}

.epcis-kpi-card-empty span {
    font-size: 0.75rem;
}

.epcis-kpi-configured-badge {
    position: absolute;
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: var(--font-xs);
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================
   PANEL DE CONFIGURACIÓN
   ============================================ */
.epcis-kpi-config {
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    flex-shrink: 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.epcis-kpi-config-header {
    background: var(--primary-lighter);
    padding: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--primary);
}

.epcis-kpi-config-header h4 {
    margin: 0;
    color: var(--primary);
    font-size: var(--font-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.epcis-config-close-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: var(--spacing-sm);
    transition: all var(--transition-fast);
}

.epcis-config-close-btn:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.epcis-kpi-config-body {
    padding: var(--spacing-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    max-height: 350px;
    overflow-y: auto;
}

.epcis-kpi-config-body::-webkit-scrollbar {
    width: 6px;
}

.epcis-kpi-config-body::-webkit-scrollbar-track {
    background: var(--black-transparent-30);
    border-radius: var(--spacing-lg);
}

.epcis-kpi-config-body::-webkit-scrollbar-thumb {
    background: var(--primary-shadow);
    border-radius: var(--spacing-lg);
}

.epcis-config-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.epcis-function-desc {
    margin-top: var(--spacing-sm);
}

.epcis-function-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--info);
    border-radius: var(--border-radius-sm);
    color: #93C5FD;
    font-size: var(--font-sm);
}

.epcis-params-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius-sm);
}

.epcis-kpi-styles {
    padding: var(--spacing-lg);
    background: var(--white-transparent-05);
    border-radius: var(--border-radius-sm);
}

.epcis-style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.epcis-style-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.epcis-style-field label {
    font-size: var(--font-sm);
    color: var(--gray);
    font-weight: var(--font-semibold);
}

.epcis-color-picker {
    width: 100%;
    height: 40px;
    border: 1px solid var(--white-transparent-20);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    background: transparent;
}

.epcis-kpi-save-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.epcis-kpi-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) rgba(16, 185, 129, 0.4);
}

/* ============================================
   ESTADO VACÍO
   ============================================ */
.epcis-kpi-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    background: var(--white-transparent-05);
    border: 1px dashed var(--white-transparent-20);
    border-radius: var(--border-radius-md);
    color: var(--gray);
    text-align: center;
    min-height: 80px;
}

.epcis-kpi-empty-state i {
    font-size: 2rem;
    opacity: var(--opacity-50);
}

.epcis-kpi-empty-state p {
    font-size: var(--font-sm);
    margin: 0;
}

/* ============================================
   PREVIEW DEL MÓVIL
   ============================================ */
.epcis-mobile-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    background: var(--white-transparent-05);
    border: 1px solid var(--white-transparent-10);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-2xl);
    width: 100%;
    max-width: 380px;
}

.epcis-mobile-frame {
    width: 320px;
    height: 600px;
    background: #000;
    border-radius: 2rem;
    padding: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

.epcis-mobile-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 1.5rem;
    background: #000;
    border-radius: 0 0 1rem 1rem;
    z-index: 10;
}

.epcis-mobile-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-radius: 1.5rem;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.epcis-mobile-kpis-container {
    display: grid;
    gap: var(--spacing-md);
}

.epcis-mobile-kpis-container.cols-1 {
    grid-template-columns: 1fr;
}

.epcis-mobile-kpis-container.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.epcis-mobile-kpis-container.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.epcis-mobile-kpis-container.cols-4 {
    grid-template-columns: repeat(2, 1fr);
}

.epcis-mobile-kpi {
    padding: var(--spacing-lg);
    border-radius: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-height: 100px;
    box-shadow: var(--shadow-sm) var(--black-transparent-20);
}

.epcis-mobile-kpi.unconfigured {
    background: var(--white-transparent-05);
    border: 1px dashed var(--white-transparent-20);
    display: flex;
    align-items: center;
    justify-content: center;
}

.epcis-mobile-kpi-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--gray);
    font-size: var(--font-xs);
}

.epcis-mobile-kpi-placeholder i {
    font-size: var(--font-lg);
}

.epcis-mobile-kpi-icon {
    font-size: var(--font-2xl);
}

.epcis-mobile-kpi-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.epcis-mobile-kpi-value {
    font-size: 1.5rem;
    font-weight: var(--font-bold);
    line-height: 1;
}

.epcis-mobile-kpi-title {
    font-size: var(--font-xs);
    opacity: var(--opacity-80);
    font-weight: var(--font-medium);
}

.epcis-preview-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--gray);
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .epcis-kpi-configurator {
        grid-template-columns: 1fr;
    }
    
    .epcis-mobile-preview {
        order: -1;
    }
}


const addKPIStyles = () => {
    if (!document.getElementById('kpi-dynamic-styles')) {
        const styleEl = document.createElement('style');
        styleEl.id = 'kpi-dynamic-styles';
        styleEl.textContent = `
            @keyframes slideDown {
                from {
                    opacity: 0;
                    transform: translateY(-10px);
                }
                to {
                    opacity: 1;
                    transform: translateY(0);
                }
            }
        `;
        document.head.appendChild(styleEl);
    }
};
