/* ================== CONTENEDORES PRINCIPALES ================== */
.vpm-procesos-wrapper, 
.vpm-carga-masiva-wrapper, 
.vpm-dashboard-wrapper, 
.vpm-mi-proceso-wrapper {
    max-width: 1200px; 
    margin: 20px auto; 
    padding: 20px; 
    background: #fff; 
    border: 1px solid #ddd; 
    border-radius: 8px;
}

/* ================== TABLAS BASE ================== */
.vpm-procesos-table, 
.vpm-proceso-table, 
.vpm-vehiculos-table {
    width: 100%; 
    border-collapse: collapse; 
    margin: 20px 0;
}

.vpm-procesos-table th, 
.vpm-procesos-table td,
.vpm-proceso-table th, 
.vpm-proceso-table td,
.vpm-vehiculos-table th, 
.vpm-vehiculos-table td {
    border: 1px solid #ddd; 
    padding: 10px; 
    text-align: left;
}

.vpm-procesos-table th, 
.vpm-proceso-table th, 
.vpm-vehiculos-table th { 
    background: #f5f5f5; 
}

/* ================== MODAL DE PROCESOS ================== */
#vpm-proceso-modal {
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 1000;
}

#vpm-proceso-form {
    background: #fff; 
    padding: 30px; 
    border-radius: 8px; 
    max-width: 500px; 
    width: 90%;
}

#vpm-proceso-form label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
}

#vpm-proceso-form input, 
#vpm-proceso-form select {
    width: 100%; 
    padding: 8px; 
    margin-bottom: 15px; 
    border: 1px solid #ddd; 
    border-radius: 4px;
}

/* ================== MÉTRICAS DEL DASHBOARD ================== */
.vpm-metricas { 
    display: flex; 
    gap: 20px; 
    margin-bottom: 30px; 
}

.vpm-metrica {
    flex: 1 1 150px !important; 
    background: #f9f9f9; 
    padding: 20px; 
    border-radius: 8px; 
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.vpm-metrica-valor { 
    font-size: 36px; 
    font-weight: bold; 
    display: block; 
    color: #333; 
}

.vpm-metrica-etiqueta { 
    font-size: 14px; 
    color: #666; 
}

/* ================== FILTROS ================== */
.vpm-filtros { 
    display: flex; 
    gap: 15px; 
    margin: 20px 0; 
}

.vpm-filtros select { 
    padding: 8px 12px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    min-width: 200px; 
}

.vpm-exportar { 
    margin: 20px 0; 
    text-align: right; 
}

/* ================== TABS DE MI PROCESO ================== */
.vpm-tabs { 
    display: flex; 
    gap: 10px; 
    margin: 20px 0; 
    border-bottom: 2px solid #ddd; 
    padding-bottom: 10px; 
}

.vpm-tab-button { 
    padding: 10px 20px; 
    background: none; 
    border: none; 
    border-radius: 4px 4px 0 0; 
    cursor: pointer; 
    font-size: 16px; 
    color: #666; 
}

.vpm-tab-button.active { 
    background: #007cba; 
    color: #fff; 
}

.vpm-tab-content { 
    display: none; 
    padding: 20px 0; 
}

.vpm-tab-content.active { 
    display: block; 
}

.vpm-selector-proceso { 
    margin: 20px 0; 
    padding: 15px; 
    background: #f9f9f9; 
    border-radius: 4px; 
}

/* ================== ARCHIVOS ADJUNTOS ================== */
.vpm-archivos-cell {
    min-width: 200px;
}

.vpm-archivo-item {
    margin: 5px 0;
    padding: 5px;
    background: #f9f9f9;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vpm-archivo-item a {
    text-decoration: none;
    color: #0073aa;
}

.vpm-archivo-item .button {
    margin-left: 10px;
    padding: 2px 8px;
    font-size: 12px;
}

/* ================== TABLA GANTT (DASHBOARD) - CORREGIDA ================== */
.vpm-table-scroll {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
}

.vpm-vehiculos-table.vpm-gantt-table {
    min-width: 900px;
    width: auto;
    border-collapse: collapse;
    table-layout: fixed; /* Control de anchos */
}

/* Estilo general de celdas */
.vpm-vehiculos-table.vpm-gantt-table th,
.vpm-vehiculos-table.vpm-gantt-table td {
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
    height: 20px;
    line-height: 20px !important;
    border: 1px solid #ddd;
}

/* Cabeceras de procesos */
.vpm-vehiculos-table.vpm-gantt-table th {
    padding: 8px 12px;
    font-weight: bold;
    white-space: normal;
    width: 140px;
    min-width: 120px;
    max-width: 200px;
    height: auto;
    line-height: 1.4;
    background: #f5f5f5;
}

/* Columnas fijas (ID, VIN, Modelo) */
.vpm-vehiculos-table.vpm-gantt-table th:first-child,
.vpm-vehiculos-table.vpm-gantt-table th:nth-child(2),
.vpm-vehiculos-table.vpm-gantt-table th:nth-child(3),
.vpm-vehiculos-table.vpm-gantt-table td:first-child,
.vpm-vehiculos-table.vpm-gantt-table td:nth-child(2),
.vpm-vehiculos-table.vpm-gantt-table td:nth-child(3) {
    width: 110px;
    min-width: 100px;
    max-width: 150px;
    padding: 0 8px;
}

/* Celdas de progreso */
.vpm-vehiculos-table.vpm-gantt-table td.vpm-progreso-cell {
    position: relative;
    width: 140px;
    min-width: 120px;
    max-width: 200px;
    height: 40px;
    padding: 0 !important;
    background-color: #f9f9f9;
    overflow: hidden; /* Evita desbordes */
}

/* Barra de progreso */
.vpm-progreso-barra {
    position: absolute;
    top: 0;
    left: 0;
    height: 40px !important; /* Fuerza la altura */
    border-radius: 4px;
    transition: width 0.3s;
    z-index: 1;
}

/* Etiqueta de estado */
.vpm-progreso-etiqueta {
    position: absolute;
    left: 8px;
    top: 0;
    color: #333;
    font-size: 12px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
    z-index: 2;
    line-height: 20px !important;
    pointer-events: none;
}

/* ================== TRUNCAR TEXTO EN CELDAS ================== */
.vpm-vehiculos-table.vpm-gantt-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* Ajusta según el ancho deseado */
}

/* Ancho específico para la columna VIN (segunda columna) */
.vpm-vehiculos-table.vpm-gantt-table td:nth-child(2) {
    max-width: 120px;
}

/* Ancho para la columna Modelo (tercera columna) */
.vpm-vehiculos-table.vpm-gantt-table td:nth-child(3) {
    max-width: 100px;
}

/* Opcional: para las celdas de proceso (a partir de la cuarta columna) */
.vpm-vehiculos-table.vpm-gantt-table td:nth-child(n+4) {
    max-width: 140px;
}

/* ================== MODALES DE SUBPROCESOS ================== */
#vpm-subprocesos-modal,
#vpm-subproceso-modal {
    position: fixed;
    top: 0; left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.vpm-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.vpm-subprocesos-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.vpm-subprocesos-table th,
.vpm-subprocesos-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.vpm-subprocesos-table th {
    background: #f5f5f5;
}

#vpm-subproceso-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

/* ================== GRÁFICO ================== */
.vpm-grafico-container {
    height: 300px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 30px 0;
}

.vpm-grafico-container canvas {
    min-width: 600px;
    height: 100% !important;
}

/* ================== TABLA DE MI PROCESO (compacta) ================== */
.vpm-mi-proceso-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vpm-mi-proceso-table th,
.vpm-mi-proceso-table td {
    border: 1px solid #ddd;
    padding: 8px 5px;
    text-align: left;
    vertical-align: middle;
}

.vpm-mi-proceso-table th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Columna de vehículo compacta */
.vpm-vehiculo-info {
    min-width: 120px;
    line-height: 1.3;
}

.vpm-vehiculo-info small {
    color: #666;
    font-size: 11px;
}

/* Estados con colores */
.vpm-estado-proceso {
    font-weight: 500;
    text-align: center;
    min-width: 80px;
}
.vpm-estado-proceso.enproceso { color: #007cba; }
.vpm-estado-proceso.completado { color: #46b450; }
.vpm-estado-proceso.espera { color: #ffb900; }
.vpm-estado-proceso.devuelto { color: #dc3232; }

/* Subprocesos */
.vpm-subproceso {
    text-align: center;
    min-width: 100px;
    background: #fafafa;
}
.vpm-subproceso .vpm-sub-nombre {
    display: block;
    font-weight: 500;
    margin-bottom: 3px;
}
.vpm-subproceso .vpm-sub-estado {
    display: block;
    font-size: 11px;
    margin: 3px 0;
}
.vpm-subproceso.enproceso { background: #e5f5ff; }
.vpm-subproceso.completado { background: #e3f5e3; }
.vpm-subproceso button {
    margin: 2px 0;
    padding: 2px 6px;
    font-size: 11px;
}

/* Botones pequeños */
.button-small {
    padding: 3px 8px;
    font-size: 11px;
    line-height: 1.5;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    cursor: pointer;
    margin: 2px;
}
.button-small:hover {
    background: #e7e7e7;
}

/* Columna de acciones */
.vpm-acciones {
    min-width: 100px;
    white-space: nowrap;
}

/* Fila de archivos oculta */
.vpm-fila-archivos {
    background: #f9f9f9;
}
.vpm-fila-archivos td {
    padding: 15px !important;
}
.vpm-archivos-container {
    max-width: 600px;
}
.vpm-archivos-container h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

/* Scroll horizontal */
.vpm-table-scroll {
    overflow-x: auto;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ================== TABLA DE ARCHIVOS ADMIN ================== */
.vpm-admin-archivos-wrapper {
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.vpm-archivos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vpm-archivos-table th,
.vpm-archivos-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.vpm-archivos-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.vpm-archivos-table tr:hover {
    background: #f9f9f9;
}

/* Versión responsive para móviles */
@media (max-width: 768px) {
    .vpm-mi-proceso-table {
        font-size: 12px;
    }
    .vpm-subproceso {
        min-width: 80px;
    }
    .vpm-acciones {
        min-width: 80px;
    }
}
/* ================== PAGINACIÓN ================== */
.vpm-paginacion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 0;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.vpm-pag-info {
    color: #666;
    font-size: 13px;
}

.vpm-pag-botones {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.vpm-pag-btn {
    min-width: 36px;
    text-align: center;
    padding: 4px 10px !important;
    font-size: 13px !important;
    text-decoration: none !important;
}

.vpm-pag-btn.button-primary {
    cursor: default;
}

.vpm-pag-ellipsis {
    padding: 0 4px;
    color: #999;
}

@media (max-width: 600px) {
    .vpm-paginacion {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ================== ENTREGA DE VEHÍCULOS ================== */
.vpm-row-entregado {
    opacity: 0.7;
    background: #f0fff4 !important;
}

.vpm-row-listo-entrega {
    background: #fffbeb !important;
    box-shadow: inset 0 0 0 2px #f6ad55;
    animation: vpm-pulse-entrega 2s infinite;
}

@keyframes vpm-pulse-entrega {
    0%, 100% { background-color: #fffbeb !important; }
    50%       { background-color: #fef3c7 !important; }
}

.vpm-badge-entregado {
    display: inline-block;
    background: #c6f6d5;
    color: #276749;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #9ae6b4;
    white-space: nowrap;
}

.vpm-badge-listo-entrega {
    display: inline-block;
    background: #fefcbf;
    color: #744210;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #f6e05e;
    white-space: nowrap;
    animation: vpm-badge-blink 1.5s infinite;
}

@keyframes vpm-badge-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.vpm-badge-incompleto {
    display: inline-block;
    background: #fff5f5;
    color: #9b2c2c;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #feb2b2;
    white-space: nowrap;
}

.vpm-btn-confirmar-entrega {
    background: #38a169 !important;
    color: #fff !important;
    border: none !important;
    font-size: 12px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: background 0.2s;
}
.vpm-btn-confirmar-entrega:hover {
    background: #276749 !important;
}

.vpm-metrica-alerta {
    border: 2px solid #f6ad55 !important;
    background: #fffbeb !important;
    color: #744210 !important;
}
.vpm-metrica-alerta .vpm-metrica-valor { color: #c05621 !important; }

.vpm-metrica-entregado {
    border: 2px solid #9ae6b4 !important;
    background: #f0fff4 !important;
}
.vpm-metrica-entregado .vpm-metrica-valor { color: #276749 !important; }

/* ================== BUSCADOR Y FILTROS SERVER-SIDE ================== */
.vpm-filtros-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: #f9f9f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
}

.vpm-filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 160px;
}

.vpm-filtro-grupo label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vpm-filtro-grupo select,
.vpm-filtro-grupo input[type="text"] {
    height: 36px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 0 10px;
    font-size: 14px;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.vpm-filtro-grupo select:focus,
.vpm-filtro-grupo input[type="text"]:focus {
    border-color: #4299e1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(66,153,225,0.2);
}

.vpm-input-buscar {
    min-width: 200px;
}

.vpm-filtro-botones {
    flex: 0 0 auto;
}

.vpm-resultado-busqueda {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    color: #2b6cb0;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .vpm-filtros-grid {
        flex-direction: column;
    }
    .vpm-filtro-grupo {
        min-width: 100%;
    }
}
