/* ========================================
   QUEUE DASHBOARD - ESTILOS MEJORADOS
   ======================================== */

/* Modal Overlay */
.queue-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.queue-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Container */
.queue-modal-container {
    position: relative;
    width: 95%;
    max-width: 1600px;
    height: 90vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.queue-modal-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.queue-modal-title {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.queue-modal-title i {
    font-size: 28px;
    color: #667eea;
}

.queue-modal-close {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.queue-modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* Modal Body */
.queue-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.queue-modal-body::-webkit-scrollbar {
    width: 8px;
}

.queue-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.queue-modal-body::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

.queue-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* KPIs Section */
.kpis-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.kpi-success { border-left: 4px solid #32CD32; }
.kpi-success .kpi-icon { background: rgba(50, 205, 50, 0.15); color: #32CD32; }

.kpi-info { border-left: 4px solid #1E90FF; }
.kpi-info .kpi-icon { background: rgba(30, 144, 255, 0.15); color: #1E90FF; }

.kpi-danger { border-left: 4px solid #DC143C; }
.kpi-danger .kpi-icon { background: rgba(220, 20, 60, 0.15); color: #DC143C; }

.kpi-warning { border-left: 4px solid #FFA500; }
.kpi-warning .kpi-icon { background: rgba(255, 165, 0, 0.15); color: #FFA500; }

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}

.kpi-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    margin-bottom: 5px;
}

.kpi-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.kpi-subtitle i {
    margin-right: 5px;
}

/* Filters Section */
.filters-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 250px;
}

.filter-group label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.filter-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 15px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover,
.filter-select:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(102, 126, 234, 0.5);
    outline: none;
}

.btn-filter,
.btn-refresh {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-filter:hover,
.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-refresh {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Cron Info Section */
.cron-info-section {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 30px;
}

.cron-info-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.cron-info-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.cron-info-content i {
    color: #667eea;
    font-size: 18px;
}

.cron-info-content strong {
    color: #fff;
    font-weight: 600;
}

.cron-countdown {
    color: #FFA500;
}

/* Tasks Section */
.tasks-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
}

.tasks-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tasks-header h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.tasks-count {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.tasks-list {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

/* Task Item */
.task-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.task-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.task-info {
    flex: 1;
}

.task-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.task-id {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.task-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.task-details {
    display: flex;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    justify-content: space-between;
}

.task-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.task-detail-row i {
    color: rgba(255, 255, 255, 0.5);
    width: 16px;
}

.task-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.task-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.task-btn:hover {
    transform: translateY(-2px);
}

.task-btn-detail:hover {
    background: rgba(30, 144, 255, 0.2);
    border-color: #1E90FF;
    color: #1E90FF;
}

.task-btn-process:hover {
    background: rgba(50, 205, 50, 0.2);
    border-color: #32CD32;
    color: #32CD32;
}

.task-btn-json:hover {
    background: rgba(255, 165, 0, 0.2);
    border-color: #FFA500;
    color: #FFA500;
}

.task-btn-alert:hover {
    background: rgba(220, 20, 60, 0.2);
    border-color: #DC143C;
    color: #DC143C;
}

/* Loading, Empty & Error States */
.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.loading-state i,
.empty-state i,
.error-state i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    opacity: 0.5;
}

.loading-state i {
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.error-state {
    color: #DC143C;
}

.error-details {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    color: rgba(220, 20, 60, 0.7);
}

/* ========================================
   SIDE PANEL - Para detalles
   ======================================== */

.side-panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.side-panel-overlay.active {
    display: block;
}

.side-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    max-width: 90%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-panel.active {
    right: 0;
}

.side-panel-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.side-panel-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-panel-title i {
    color: #667eea;
}

.side-panel-close {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.side-panel-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.side-panel-body::-webkit-scrollbar {
    width: 6px;
}

.side-panel-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.side-panel-body::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

/* Detail Section */
.detail-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.detail-section h4 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-section h4 i {
    color: #667eea;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-table tr:last-child {
    border-bottom: none;
}

.detail-table td {
    padding: 12px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.detail-table td:first-child {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    width: 140px;
}

/* JSON Viewer */
.json-viewer {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

/* Responsive */
@media (max-width: 768px) {
    .queue-modal-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .kpis-section {
        grid-template-columns: 1fr;
    }
    
    .filters-section {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .task-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .task-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .task-btn {
        flex: 1;
    }
    
    .side-panel {
        width: 100%;
        right: -100%;
    }
}

.filter-select option {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
}
.task-actions-dropdown {
    position: relative;
    display: inline-block;
    z-index: 100; /* ✅ AGREGAR */
}

.execution-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000; /* ✅ Aumentar si es necesario */
    min-width: 150px;
    margin-top: 5px;
    pointer-events: auto; /* ✅ AGREGAR */
}

.execution-menu-item {
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    pointer-events: auto; /* ✅ AGREGAR */
}

.execution-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.execution-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.execution-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.execution-menu-reject:hover {
    background: rgba(220, 20, 60, 0.2);
    color: #DC143C;
}

/* Asegurar que el contenedor de acciones no bloquee */
.task-actions {
    position: relative;
    z-index: 10;
}

.task-item {
    position: relative;
    z-index: 1;
}

.task-item:hover {
    z-index: 10; /* ✅ AGREGAR: Elevar al hacer hover */
}

/* Botón copiar en detalles */
.copy-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #667eea;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

.copy-btn-json {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #667eea;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 10;
}

.copy-btn-json:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}