/**
 * style.css - Módulo de Ventas (Gestión de Órdenes)
 * Componente: UI Híbrida (Formulario ERP + POS Drag&Drop)
 * Encapsulamiento estricto bajo .modulo-ordenes-ord
 */

.modulo-ordenes-ord {
    /* Paleta Púrpura Original Luxor */
    --lux-primary-ord: #6b5b95; 
    --lux-secondary-ord: #f8f9fa;
    --lux-dark-ord: #495057;
    --lux-border-ord: #ced4da;
    --lux-accent-ord: #554877;
    
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f6f9;
    padding-bottom: 30px;
    min-height: 100vh;
}

/* Cabecera Principal */
.modulo-ordenes-ord .luxor-header {
    background-color: var(--lux-primary-ord);
    color: white;
    padding: 16px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Tarjetas Base Planas */
.modulo-ordenes-ord .card-luxor {
    border: 1px solid var(--lux-border-ord);
    border-radius: 6px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

/* Bordes Decorativos */
.modulo-ordenes-ord .border-lux-accent {
    border-top: 3px solid var(--lux-primary-ord);
}

/* Encabezados de Tarjeta */
.modulo-ordenes-ord .card-header-luxor {
    background-color: #ffffff;
    color: var(--lux-primary-ord);
    padding: 15px 20px;
    border-bottom: 1px solid var(--lux-border-ord);
    border-radius: 6px 6px 0 0;
    font-weight: bold;
    font-size: 1rem;
}

/* Inputs y Selects */
.modulo-ordenes-ord .form-control-lg, 
.modulo-ordenes-ord .form-select-lg {
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--lux-border-ord);
    background-color: #ffffff;
    color: var(--lux-dark-ord);
}

.modulo-ordenes-ord .form-control:focus, 
.modulo-ordenes-ord .form-select:focus,
.modulo-ordenes-ord .border-luxor-ord:focus {
    border-color: var(--lux-primary-ord) !important;
    box-shadow: none !important;
    outline: 1px solid var(--lux-primary-ord);
}

/* Botones Principales */
.modulo-ordenes-ord .btn-luxor {
    background-color: var(--lux-primary-ord);
    color: white;
    border: 1px solid var(--lux-primary-ord);
    font-weight: 600;
    border-radius: 4px;
    padding: 12px 20px;
    transition: background-color 0.2s, border-color 0.2s;
}

.modulo-ordenes-ord .btn-luxor:hover,
.modulo-ordenes-ord .btn-luxor:active {
    background-color: var(--lux-accent-ord);
    border-color: var(--lux-accent-ord);
    color: white;
}

.modulo-ordenes-ord .btn-luxor:disabled {
    background-color: #a399b8;
    border-color: #a399b8;
    cursor: not-allowed;
}

/* Barra de Resumen Colapsada */
.modulo-ordenes-ord .mini-summary-bar {
    background-color: #f1f3f5;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 0 6px 6px;
    border-top: 1px solid var(--lux-border-ord);
    transition: background-color 0.2s;
}

.modulo-ordenes-ord .mini-summary-bar:hover {
    background-color: #e9ecef;
}

.modulo-ordenes-ord .mini-summary-bar i,
.modulo-ordenes-ord .mini-summary-bar svg {
    transition: transform 0.3s ease;
}

.modulo-ordenes-ord .icon-expanded {
    transform: rotate(180deg);
}

/* ===== ESTILOS INVENTARIO, DRAG & DROP Y SELECCIÓN MÚLTIPLE ===== */

/* Contenedor Inventario (Izquierda) */
.modulo-ordenes-ord .inventario-scroll-container {
    max-height: 480px;
    overflow-y: auto;
    padding-right: 5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modulo-ordenes-ord .inventario-scroll-container::-webkit-scrollbar {
    width: 6px;
}
.modulo-ordenes-ord .inventario-scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--lux-border-ord);
    border-radius: 4px;
}

/* Encabezados de Agrupación (Cargas) */
.modulo-ordenes-ord .group-header-ord {
    background-color: #e2e8f0;
    color: var(--lux-dark-ord);
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: bold;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.modulo-ordenes-ord .carga-group-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

/* Checkboxes Personalizados */
.modulo-ordenes-ord .form-check-input.master-checkbox-ord,
.modulo-ordenes-ord .form-check-input.child-checkbox-ord {
    cursor: pointer;
    transform: scale(1.15);
}
.modulo-ordenes-ord .form-check-input:checked {
    background-color: var(--lux-primary-ord);
    border-color: var(--lux-primary-ord);
}

/* Tarjeta de Lote Arrastrable */
.modulo-ordenes-ord .draggable-card-ord {
    background: #ffffff;
    border: 1px solid var(--lux-border-ord);
    border-left: 4px solid var(--lux-primary-ord);
    border-radius: 6px;
    padding: 12px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
    user-select: none;
    position: relative;
}

.modulo-ordenes-ord .draggable-card-ord:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-left-color: var(--lux-accent-ord);
}

.modulo-ordenes-ord .draggable-card-ord:active {
    cursor: grabbing;
}

.modulo-ordenes-ord .draggable-card-ord.is-dragging {
    opacity: 0.5;
    border: 1px dashed var(--lux-primary-ord);
    background-color: #f8f9fa;
}

/* Checkbox dentro de la tarjeta */
.modulo-ordenes-ord .card-checkbox-wrapper {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
}

/* Barra Flotante de Acción Masiva */
.modulo-ordenes-ord .floating-action-bar-ord {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 2px solid var(--lux-primary-ord);
    padding: 12px 20px;
    display: none; /* Oculto por defecto */
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    border-radius: 0 0 6px 6px;
}

/* Elementos internos de la Tarjeta */
.modulo-ordenes-ord .inv-prod-name { font-weight: bold; font-size: 0.95rem; color: var(--lux-primary-ord); margin-bottom: 4px; display: block; padding-right: 25px; }
.modulo-ordenes-ord .inv-lote-info { font-size: 0.8rem; color: #6c757d; }
.modulo-ordenes-ord .inv-stock-boxes {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.modulo-ordenes-ord .stock-box {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 4px 8px;
    text-align: center;
    font-size: 0.75rem;
}
.modulo-ordenes-ord .stock-box.stock-fisico { color: #198754; font-weight: bold; border-color: #badbcc; background: #d1e7dd;}
.modulo-ordenes-ord .stock-box.stock-pronostico { color: #0dcaf0; font-weight: bold; border-color: #b6effb; background: #cff4fc;}

/* Botón Híbrido Mobile (Oculto en PC) */
.modulo-ordenes-ord .btn-tap-add-ord {
    display: none;
    position: absolute;
    right: 10px;
    bottom: 10px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    padding: 0;
    line-height: 35px;
    text-align: center;
    z-index: 2;
}

/* Zona Drop (Dropzone - Carrito) */
.modulo-ordenes-ord .dropzone-container-ord {
    position: relative;
    min-height: 250px;
    transition: background-color 0.2s, border 0.2s;
}

.modulo-ordenes-ord .dropzone-overlay-ord {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(107, 91, 149, 0.1); /* Tono primary con opacidad */
    border: 2px dashed var(--lux-primary-ord);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; 
    opacity: 0;
    transition: opacity 0.2s;
}

.modulo-ordenes-ord .dropzone-container-ord.drag-active .dropzone-overlay-ord {
    opacity: 1;
    display: flex !important;
}

.modulo-ordenes-ord .dropzone-msg {
    color: var(--lux-primary-ord);
    font-weight: 900;
    font-size: 1.2rem;
    text-align: center;
    background: rgba(255,255,255,0.95);
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Grilla de Datos (Carrito) */
.modulo-ordenes-ord .table-dark {
    background-color: var(--lux-dark-ord);
    color: white;
}

.modulo-ordenes-ord .table-hover tbody tr:hover {
    background-color: rgba(107, 91, 149, 0.04);
}

.modulo-ordenes-ord .input-qty-grid {
    width: 70px;
    text-align: center;
    font-weight: bold;
    color: var(--lux-primary-ord);
    border: 1px solid var(--lux-border-ord);
    border-radius: 4px;
    padding: 4px;
}

.modulo-ordenes-ord .btn-icon {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: #dc3545;
    cursor: pointer;
    padding: 5px 10px;
    transition: transform 0.2s;
}
.modulo-ordenes-ord .btn-icon:hover {
    transform: scale(1.15);
}

.modulo-ordenes-ord .list-group-item {
    border-radius: 0;
    border-left: none;
    border-right: none;
}
.modulo-ordenes-ord .item-cliente-ord {
    cursor: pointer;
    transition: background-color 0.1s;
    border-left: 3px solid transparent;
}
.modulo-ordenes-ord .item-cliente-ord:hover {
    background-color: #f1f3f5;
    border-left: 3px solid var(--lux-primary-ord);
}

/* --- RESPONSIVIDAD HÍBRIDA --- */
@media (max-width: 991.98px) {
    .modulo-ordenes-ord .order-mobile-1 { order: 1; }
    .modulo-ordenes-ord .order-mobile-2 { order: 2; margin-top: 20px; }
    
    .modulo-ordenes-ord .mini-summary-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px; 
        position: relative; 
        padding-right: 40px; 
    }
    .modulo-ordenes-ord .mini-summary-bar > * {
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block; 
    }
    .modulo-ordenes-ord .mini-summary-bar > i,
    .modulo-ordenes-ord .mini-summary-bar > svg {
        position: absolute;
        top: 20px;
        right: 20px;
        transform: none;
        width: auto; 
    }
    .modulo-ordenes-ord .mini-summary-bar .icon-expanded {
        transform: rotate(180deg);
    }

    /* En móvil, mostramos el botón tap-to-add pero mantenemos los checkboxes como opción masiva */
    .modulo-ordenes-ord .draggable-card-ord {
        cursor: default; 
    }
    .modulo-ordenes-ord .btn-tap-add-ord {
        display: block; 
    }
    .modulo-ordenes-ord .dropzone-overlay-ord {
        display: none !important; 
    }
    .modulo-ordenes-ord .floating-action-bar-ord {
        position: fixed; /* Más visible en móvil */
        bottom: 0;
        z-index: 1050;
    }
}