/* UI / Floating Navigation */
.r-ui {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 0; /* Gap handled by padding/margins during expansion */
  padding: 8px; /* Initial minimal padding */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  font-family: var(--font);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  max-width: 140px; /* Default collapsed width approx */
}

/* Expanded State */
.r-ui.is-expanded {
  max-width: 500px; /* Enough to fit actions */
  padding-right: 12px;
}

/* Rainbow Title */
.r-ui__title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  display: flex;
  padding: 0 16px;
  white-space: nowrap;
  line-height: 48px; /* Touch target size */
}

.r-ui__title span {
  display: inline-block;
  transition: transform 0.2s;
}

/* Menu Actions */
.r-ui__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.3, 0, 0, 1.3);
  width: 0;
}

/* Show actions when expanded */
.r-ui.is-expanded .r-ui__actions {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  width: auto;
  padding-left: 8px;
  border-left: 1px solid rgba(0,0,0,0.08); /* Divider */
  margin-left: 4px;
}

.r-btn-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  
  color: #000;
  position: relative;
  flex-shrink: 0;
}

.r-btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}

.r-btn-icon:active {
  transform: scale(0.95);
}

.r-btn-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Cart Specifics */
.r-cart-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.3, 0, 0, 1.3);
}

.r-cart-badge.has-items {
  transform: scale(1);
}

.r-cart-btn,
#btn-notes-filter {
  opacity: 0.4;
}

.r-cart-btn.is-active,
.r-cart-btn.has-items,
#btn-notes-filter.is-active {
  opacity: 1;
}

.r-cart-btn.is-active,
#btn-notes-filter.is-active {
  background: #000;
  color: #fff;
}

.r-cart-btn.is-active:hover,
#btn-notes-filter.is-active:hover {
  background: #333;
}

  /* Legacy Link (Text Only) */
  #btn-legacy {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #999;
    padding: 0 12px;
    height: 42px;
    display: flex; /* Ensure alignment */
    align-items: center;
    text-decoration: none;
    border-radius: 99px; /* hover effect shape */
  }
  
  #btn-legacy:hover {
    color: #000;
    background: rgba(0,0,0,0.05); /* Subtle hover bg */
  }

  /* Reset Cart Button */ 
  #btn-reset {
    color: #999;
    width: 36px; /* slightly smaller than main icons */
    height: 36px;
    margin: 0 4px;
  }
  #btn-reset:hover {
    color: #ff3b30; /* Destructive red on hover */
    background: rgba(255, 59, 48, 0.1);
  }

/* Legacy Link */
.r-link-legacy {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  height: 36px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  border-radius: 99px;
  transition: all 0.2s;
  margin-left: 4px;
}

.r-link-legacy:hover {
  color: #000;
  border-color: #000;
  background: #fff;
}

/* Responsive */
@media (max-width: 600px) {
  .r-ui {
    bottom: 24px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: 140px; /* Reset for mobile initial state */
    padding: 6px;
  }

  .r-ui.is-expanded {
    max-width: 90vw;
  }
  
  .r-ui__title {
    font-size: 14px;
    line-height: 42px;
  }
}
