/* =============================================
   DHV Rutas — Estilos Frontend (v1.1)
   ============================================= */

.dhv-recojo-wrap *,
.dhv-recojo-wrap *::before,
.dhv-recojo-wrap *::after { box-sizing: border-box; }

.dhv-recojo-wrap {
    max-width: 860px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #2d3748;
    padding: 0 4px;
}

/* Header */
.dhv-recojo-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 24px; padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}
.dhv-recojo-icon { font-size: 2rem; line-height: 1; }
.dhv-recojo-title { margin: 0; font-size: 1.4rem; font-weight: 700; color: #1e2a3a; }
.dhv-recojo-date  { margin: 3px 0 0; color: #718096; font-size: .8rem; font-weight: 500; }

/* Empty state */
.dhv-empty-state {
    text-align: center; padding: 48px 24px;
    background: #fff; border-radius: 12px;
    border: 2px dashed #e2e8f0; color: #718096;
}
.dhv-empty-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }

/* Cliente card */
.dhv-cliente-card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    margin-bottom: 14px; overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Cabecera cliente */
.dhv-cliente-header {
    display: flex; align-items: center; justify-content: space-between;
    background: #1e2a3a; color: #fff;
    padding: 13px 16px; cursor: pointer;
    user-select: none; transition: background .2s;
    -webkit-tap-highlight-color: transparent;
}
.dhv-cliente-header:hover { background: #263548; }
.dhv-cliente-info  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dhv-cliente-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: #1a6fc4;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.dhv-cliente-name  { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dhv-cliente-meta  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.dhv-badge         { background: rgba(255,255,255,.15); border-radius: 20px; padding: 2px 10px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.dhv-toggle-icon   { font-size: .7rem; transition: transform .25s; display: inline-block; }
.dhv-cliente-card.is-open .dhv-toggle-icon { transform: rotate(90deg); }

/* Cuerpo desplegable */
.dhv-cliente-body  { display: none; }
.dhv-cliente-card.is-open .dhv-cliente-body { display: block; }

/* Bulk bar */
.dhv-bulk-bar {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 8px; padding: 10px 16px;
    background: #f7fafc; border-bottom: 1px solid #e2e8f0;
}
.dhv-check-label {
    display: flex; align-items: center; gap: 7px;
    font-size: .82rem; font-weight: 600;
    cursor: pointer; white-space: nowrap; color: #2d3748;
}
.dhv-check-label input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer;
    accent-color: #1a6fc4; flex-shrink: 0;
}
.dhv-bulk-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.dhv-selected-count { font-size: .75rem; color: #718096; white-space: nowrap; }

/* Selects */
.dhv-status-select {
    border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 6px 8px; font-size: .82rem;
    background: #fff; color: #2d3748;
    cursor: pointer; min-width: 130px;
}
.dhv-status-select:focus { outline: 2px solid #1a6fc4; outline-offset: 1px; }

/* Botones */
.dhv-btn {
    display: inline-flex; align-items: center; gap: 4px;
    border: none; border-radius: 7px; padding: 7px 14px;
    font-size: .82rem; font-weight: 600; cursor: pointer;
    transition: background .18s, transform .1s;
    white-space: nowrap; line-height: 1.3;
    -webkit-tap-highlight-color: transparent;
}
.dhv-btn:active { transform: scale(.97); }
.dhv-btn-primary { background: #1a6fc4; color: #fff; }
.dhv-btn-primary:hover { background: #155ba0; }
.dhv-btn-apply   { background: #e2e8f0; color: #2d3748; }
.dhv-btn-apply:hover { background: #cbd5e0; }
.dhv-btn.loading { opacity: .55; pointer-events: none; }

/* Fila pedido */
.dhv-pedido-row {
    display: flex; align-items: center;
    justify-content: space-between; flex-wrap: wrap;
    gap: 8px; padding: 11px 16px;
    border-bottom: 1px solid #e2e8f0; transition: background .12s;
}
.dhv-pedido-row:last-child { border-bottom: none; }
.dhv-pedido-row:hover      { background: #f7fafc; }
.dhv-pedido-row.is-selected{ background: #ebf4ff; }
.dhv-pedido-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dhv-pedido-check { width: 16px; height: 16px; cursor: pointer; accent-color: #1a6fc4; flex-shrink: 0; }
.dhv-pedido-info  { display: flex; align-items: center; gap: 7px; }
.dhv-tracking-dot { width: 7px; height: 7px; border-radius: 50%; background: #1a6fc4; flex-shrink: 0; }
.dhv-tracking-num { font-size: .88rem; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.dhv-pedido-right { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* Badges estado */
.dhv-status-badge { font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.dhv-estado-pendiente { background: #fefcbf; color: #744210; }
.dhv-estado-en-espera { background: #bee3f8; color: #2a4365; }
.dhv-estado-devuelto  { background: #fed7d7; color: #742a2a; }
.dhv-estado-entregado { background: #c6f6d5; color: #1c4532; }

/* Toast */
.dhv-toast {
    position: fixed; bottom: 20px; right: 16px; left: 16px;
    max-width: 340px; margin: 0 auto;
    background: #1e2a3a; color: #fff;
    padding: 11px 18px; border-radius: 9px;
    font-size: .85rem; font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,.28);
    opacity: 0; transform: translateY(14px);
    transition: opacity .28s, transform .28s;
    pointer-events: none; z-index: 99999;
}
.dhv-toast.show    { opacity: 1; transform: translateY(0); }
.dhv-toast.success { border-left: 4px solid #38a169; }
.dhv-toast.error   { border-left: 4px solid #e53e3e; }

/* ── RESPONSIVE MÓVIL ── */
@media (max-width: 640px) {
    .dhv-recojo-title { font-size: 1.15rem; }
    .dhv-bulk-bar { flex-direction: column; align-items: flex-start; padding: 10px 12px; }
    .dhv-bulk-controls { margin-left: 0; width: 100%; flex-direction: column; align-items: stretch; }
    .dhv-status-select  { width: 100%; min-width: unset; }
    .dhv-btn-primary    { width: 100%; justify-content: center; }
    .dhv-selected-count { align-self: flex-end; }
    .dhv-pedido-row     { flex-direction: column; align-items: flex-start; padding: 10px 12px; }
    .dhv-pedido-right   { width: 100%; }
    .dhv-pedido-right .dhv-status-select { flex: 1; }
    .dhv-toast          { left: 10px; right: 10px; bottom: 12px; max-width: 100%; }
}
@media (max-width: 380px) {
    .dhv-cliente-header { padding: 11px 10px; }
    .dhv-badge { display: none; }
}

/* Override mdb.min.css que oculta todos los selects */
.dhv-recojo-wrap select { display: inline-block !important; }

/* =============================================
   DHV Rutas — Entrega (extensión de estilos)
   ============================================= */

/* Alias del wrapper de entrega — reutiliza todos los estilos de recojo */
.dhv-entrega-wrap *,
.dhv-entrega-wrap *::before,
.dhv-entrega-wrap *::after { box-sizing: border-box; }

.dhv-entrega-wrap {
    max-width: 860px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #2d3748;
    padding: 0 4px;
}

/* Header entrega */
.dhv-entrega-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 24px; padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}
.dhv-entrega-icon  { font-size: 2rem; line-height: 1; }
.dhv-entrega-title { margin: 0; font-size: 1.4rem; font-weight: 700; color: #1e2a3a; }
.dhv-entrega-date  { margin: 3px 0 0; color: #718096; font-size: .8rem; font-weight: 500; }

/* Avatar de entrega en color distinto para diferenciar visualmente */
.dhv-entrega-avatar { background: #2d7a4f !important; }

/* Cabecera card entrega — tono verde oscuro */
.dhv-entrega-wrap .dhv-cliente-header { background: #1a3d2b; }
.dhv-entrega-wrap .dhv-cliente-header:hover { background: #244f38; }

/* Punto tracking entrega */
.dhv-entrega-dot { background: #2d7a4f !important; }

/* Botón bulk entrega */
.dhv-btn-entrega { background: #2d7a4f; color: #fff; }
.dhv-btn-entrega:hover { background: #245f3d; }

/* Badges de estado para entrega */
.dhv-estado-en-ruta      { background: #bee3f8; color: #2a4365; }
.dhv-estado-reprogramado { background: #feebc8; color: #7b341e; }
.dhv-estado-anulado      { background: #e2e8f0; color: #4a5568; }
/* dhv-estado-entregado y dhv-estado-devuelto ya están definidos arriba */

/* Override select display para entrega */
.dhv-entrega-wrap select { display: inline-block !important; }

/* Responsive entrega */
@media (max-width: 640px) {
    .dhv-entrega-title { font-size: 1.15rem; }
    .dhv-entrega-wrap .dhv-bulk-bar { flex-direction: column; align-items: flex-start; padding: 10px 12px; }
    .dhv-entrega-wrap .dhv-bulk-controls { margin-left: 0; width: 100%; flex-direction: column; align-items: stretch; }
    .dhv-entrega-wrap .dhv-status-select { width: 100%; min-width: unset; }
    .dhv-btn-entrega { width: 100%; justify-content: center; }
    .dhv-entrega-wrap .dhv-selected-count { align-self: flex-end; }
    .dhv-entrega-wrap .dhv-pedido-row { flex-direction: column; align-items: flex-start; padding: 10px 12px; }
    .dhv-entrega-wrap .dhv-pedido-right { width: 100%; }
    .dhv-entrega-wrap .dhv-pedido-right .dhv-status-select { flex: 1; }
}
@media (max-width: 380px) {
    .dhv-entrega-wrap .dhv-cliente-header { padding: 11px 10px; }
    .dhv-entrega-wrap .dhv-badge { display: none; }
}
