/**
 * ped.css – Estilos exclusivos del módulo de Pedidos (Enterprise-Grade v3.0)
 * Complementa estilos.css. No duplica nada del global.
 * Fusion: Fluent Depth + Material Clarity + AdminLTE small-box
 * ISO 25010: Usabilidad, Mantenibilidad
 */

/* ══════════════════════════════════════════════════════════════
   1. CABECERA FLUENT DEPTH
══════════════════════════════════════════════════════════════ */
.ped-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 28px 25px 24px;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.ped-header-title {
    font-weight: 300;
    margin: 0;
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    color: white;
}

.ped-header-title i {
    opacity: 0.9;
    margin-right: 12px;
}

.ped-badge-title {
    font-size: 0.85rem;
    font-weight: 500;
    vertical-align: middle;
    padding: 0.45rem 1rem;
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border-radius: 20px;
    margin-left: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.ped-header-sub {
    margin-top: 6px;
    margin-bottom: 0;
    opacity: 0.72;
    font-size: 0.95rem;
    color: white;
}

/* ══════════════════════════════════════════════════════════════
   2. KPIs – SMALL-BOX (AdminLTE) con paleta Enterprise
   Fieles al patrón de la imagen adjunta:
   [ Pedidos ] [ Pendientes ] [ Producir m³ ] [ En Ruta X/Y ]
══════════════════════════════════════════════════════════════ */

/* -- KPI 1: Pedidos (azul corporativo) -- */
.ped-kpi-pedidos {
    background-color: #408cbc !important;
    color: #fff !important;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(64, 140, 188, 0.35) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ped-kpi-pedidos:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(64, 140, 188, 0.45) !important;
}

/* -- KPI 2: Pendientes (naranja/advertencia) -- */
.ped-kpi-pendientes {
    background-color: #f59e0b !important;
    color: #fff !important;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ped-kpi-pendientes:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.45) !important;
}

/* -- KPI 3: Producir m³ (verde éxito) -- */
.ped-kpi-producir {
    background-color: #10b981 !important;
    color: #fff !important;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ped-kpi-producir:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.45) !important;
}

/* -- KPI 4: En Ruta (índigo oscuro) -- */
.ped-kpi-enruta {
    background-color: #4f46e5 !important;
    color: #fff !important;
    border-radius: 14px 0 0 14px;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-right: 0 !important;
}
.ped-kpi-enruta:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.45) !important;
}

/* Número grande del small-box */
.ped-kpi-num {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -1px;
}

/* Superíndice unidad (m³) */
.ped-kpi-unit {
    font-size: 1rem;
    font-weight: 400;
    vertical-align: super;
    opacity: 0.85;
    margin-left: 3px;
}

/* Números del KPI En Ruta (X/Y) */
.ped-kpi-enruta-val {
    font-size: 2rem;
    font-weight: 700;
}
.ped-kpi-enruta-sep {
    font-size: 1.6rem;
    font-weight: 300;
    opacity: 0.8;
    margin: 0 2px;
}

/* Footer del small-box */
.ped-sb-footer {
    background: rgba(0, 0, 0, 0.12) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 0 0 14px 14px;
    font-size: 0.82rem;
    padding: 6px 12px;
    display: block;
    transition: background 0.2s ease;
}
.ped-sb-footer:hover {
    background: rgba(0, 0, 0, 0.22) !important;
    color: #fff !important;
    text-decoration: none;
}

/* ── Leyenda lateral "← En ruta: X mixer de Y" ── */
.ped-enruta-leyenda {
    background: #3730a3;
    border-radius: 0 14px 14px 0;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 100px;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.25);
    transition: transform 0.2s ease;
    margin-bottom: 24px; /* alinea con el small-box-footer */
}

.ped-enruta-arrow {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
    text-align: center;
    margin-bottom: 2px;
}

.ped-enruta-text {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   3. TARJETA PRINCIPAL
══════════════════════════════════════════════════════════════ */
.ped-card-main {
    border-radius: 20px !important;
    overflow: hidden;
}

.ped-card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
}

.ped-card-title {
    font-weight: 700;
    color: #1e293b;
    font-size: 1rem;
}

.ped-toolbar {
    gap: 8px;
}

/* ══════════════════════════════════════════════════════════════
   4. BOTONES DE TOOLBAR
══════════════════════════════════════════════════════════════ */
.ped-btn-range {
    border-radius: 8px;
    font-size: 0.85rem;
    border-width: 1.5px;
    transition: all 0.2s ease;
}
.ped-btn-range:hover {
    background-color: #f1f5f9;
}

.ped-btn-export {
    border-width: 1.5px;
    transition: all 0.2s ease;
}
.ped-btn-export:hover {
    transform: scale(1.05);
}

.ped-btn-refresh {
    border-radius: 8px;
    transition: all 0.2s ease;
}
.ped-btn-refresh:hover {
    transform: rotate(20deg);
}

/* ══════════════════════════════════════════════════════════════
   5. TABLA DE PEDIDOS
══════════════════════════════════════════════════════════════ */
#tblPedidos thead th {
    background-color: #f1f5f9;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    color: #1e293b;
    white-space: nowrap;
}

#tblPedidos tbody tr.ped-row {
    transition: background-color 0.15s ease;
}

#tblPedidos tbody tr.ped-row:hover {
    background-color: #f0f7ff;
    cursor: default;
}

#tblPedidos tbody tr.ped-row-cancelado {
    opacity: 0.55;
}

.ped-cliente-nom {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.88rem;
}

/* Pie de tabla con totales */
#tblPedidos tfoot th.ped-tfoot {
    background: #f8fafc;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 2px solid #e2e8f0;
}

/* ══════════════════════════════════════════════════════════════
   6. BARRA DE PROGRESO DE PRODUCCIÓN
══════════════════════════════════════════════════════════════ */
.ped-vol-wrap {
    min-width: 80px;
}

.ped-vol-num {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.9rem;
}

.ped-progress {
    border-radius: 4px;
    background-color: #e2e8f0;
}

/* ══════════════════════════════════════════════════════════════
   7. BADGE "EN RUTA" (columna de tabla)
══════════════════════════════════════════════════════════════ */
.ped-enruta-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.ped-enruta-activo {
    background-color: #4f46e5;
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.ped-enruta-cero {
    background-color: #e2e8f0;
    color: #64748b;
}

/* ══════════════════════════════════════════════════════════════
   8. BADGES DE ESTADO
══════════════════════════════════════════════════════════════ */
.ped-badge-estado {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ══════════════════════════════════════════════════════════════
   9. BOTONES DE ACCIÓN EN TABLA
══════════════════════════════════════════════════════════════ */
.ped-actions-cell {
    white-space: nowrap;
}

/* Botón base extra-pequeño */
.btn.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
    border-width: 1.5px;
    transition: all 0.18s ease;
}

/* Botón Aprobar */
.ped-btn-aprobar {
    background-color: transparent;
    border-color: #61d7ef;
    color: #61d7ef;
}
.ped-btn-aprobar:hover {
    background-color: #61d7ef;
    color: #fff;
    transform: scale(1.04);
}

/* Botón GRE */
.ped-btn-gre {
    background-color: transparent;
    border-color: #408cbc;
    color: #408cbc;
}
.ped-btn-gre:hover {
    background-color: #408cbc;
    color: #fff;
    transform: scale(1.04);
}
.ped-btn-gre:disabled,
.ped-btn-gre.disabled {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 1;
    transform: none;
}
.ped-btn-gre:disabled:hover,
.ped-btn-gre.disabled:hover {
    background-color: #f1f5f9;
    color: #94a3b8;
    transform: none;
}

/* Botón CPE */
.ped-btn-cpe {
    background-color: transparent;
    border-color: #10b981;
    color: #10b981;
}
.ped-btn-cpe:hover {
    background-color: #10b981;
    color: #fff;
    transform: scale(1.04);
}

/* Botón Anular */
.ped-btn-anular {
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
}
.ped-btn-anular:hover {
    background-color: #dc3545;
    color: #fff;
    transform: scale(1.04);
}

/* ══════════════════════════════════════════════════════════════
   10. SPINNER DE CARGA
══════════════════════════════════════════════════════════════ */
.ped-spinner {
    width: 3rem;
    height: 3rem;
}

/* ══════════════════════════════════════════════════════════════
   11. RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    /* En tablet, la leyenda de En Ruta se mueve debajo del small-box */
    .col-lg-3:last-child .d-flex {
        flex-direction: column;
    }
    .ped-enruta-leyenda {
        border-radius: 0 0 14px 14px;
        flex-direction: row;
        justify-content: center;
        padding: 6px 12px;
        min-width: auto;
        margin-bottom: 24px;
    }
    .ped-kpi-enruta {
        border-radius: 14px 14px 0 0;
    }
    .ped-enruta-arrow {
        margin-right: 6px;
        margin-bottom: 0;
    }
}

@media (max-width: 767px) {
    .ped-header-title {
        font-size: 1.6rem;
    }
    .ped-card-header {
        flex-direction: column;
        gap: 10px;
    }
    .ped-toolbar {
        flex-wrap: wrap;
    }
    /* Ocultar columnas menos críticas en móvil */
    #tblPedidos th:nth-child(5),
    #tblPedidos td:nth-child(5) {
        display: none;
    }
}
