/* ============================================
   BOTTOM SHEET - Mobile & Desktop Styles
   ============================================ */

/* ===== MOBILE: BOTTOM SHEET ===== */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  transition: height 0.3s ease;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Estados del Bottom Sheet */
.bottom-sheet.collapsed {
  height: 80px;
}

.bottom-sheet.half {
  height: 50vh;
}

.bottom-sheet.full {
  height: 85vh;
}

/* Backdrop */
.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.backdrop.active {
  opacity: 1;
  pointer-events: all;
}

/* Drag Handle Container - Siempre visible, no hace scroll */
.drag-handle-container {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
}

/* Drag Handle del bottom sheet - delgado y discreto como en el prototipo */
.drag-handle-container > .drag-handle {
  width: 40px;
  height: 4px;
  background: var(--text-secondary);
  border-radius: 2px;
  margin: 0 auto 12px;
  cursor: pointer;
}

/* ===== ESTILOS PARA BOTTOM SHEET HEADER ===== */
/* Muy específicos para evitar conflictos con otros componentes */
.drag-handle-container .progress-info {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 8px !important;
  width: 100% !important;
  gap: 16px;
}

.drag-handle-container .progress-text {
  flex: 0 0 auto !important;
  position: static !important;
  transform: none !important;
  text-align: left !important;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.drag-handle-container .progress-count {
  font-weight: 700 !important;
  font-size: 0.875rem !important;
  color: var(--text-primary);
}

/* NUEVO: Contador de paquetes a la derecha */
.drag-handle-container .progress-packages {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto !important;
}

.drag-handle-container .packages-count {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
}

/* ===== PROGRESS BAR (multi-color) ===== */
.progress-bar-container {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--bg-surface-variant);
  border-radius: 2px;
  overflow: visible;
  opacity: 1;
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
}

/* Barra verde: paquetes entregados */
.progress-bar-delivered {
  background: var(--color-success);
  z-index: 2;
}

/* Barra roja: paquetes fallidos */
.progress-bar-failed {
  background: var(--color-error);
  z-index: 3;
}

/* Package List - Solo esta área hace scroll */
.package-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px;
  position: relative;
}

.package-list::-webkit-scrollbar {
  width: 8px;
}

.package-list::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

.package-list::-webkit-scrollbar-thumb {
  background: var(--bg-surface-variant);
  border-radius: 4px;
}

.package-list::-webkit-scrollbar-thumb:hover {
  background: var(--bg-surface-container);
}

/* No packages state */
.no-packages {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.no-packages-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.no-packages-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.no-packages-subtitle {
  font-size: 14px;
  opacity: 0.8;
}

/* ===== RESPONSIVE: DESKTOP ===== */
@media (min-width: 768px) {
  /* En desktop, el bottom sheet se convierte en sidebar */
  .bottom-sheet {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    width: var(--sidebar-width);
    height: auto !important;
    border-radius: 0;
    border-right: 1px solid var(--border-color);
    box-shadow: none;
  }

  /* Ocultar drag handle en desktop */
  .drag-handle {
    display: none;
  }

  .drag-handle-container {
    cursor: default;
  }

  /* Progress bar siempre visible en desktop */
  .progress-bar-container {
    opacity: 1 !important;
  }

  /* El mapa ocupa el resto del espacio */
  .map-container {
    left: var(--sidebar-width);
  }

  /* Backdrop no se muestra en desktop */
  .backdrop {
    display: none !important;
  }
}
