/* =============================================================================
   tania-bolsa.css — "Mi bolsa" como panel lateral derecho (ver tania-bolsa.js).
   Mismos colores de la tarjeta nueva: morado #72246c, verde-azul #00a9a8.
   ============================================================================= */

/* La caja vieja que bajaba bajo el header ya no se muestra (el número sí) */
.icon-bag .cartInfo { display: none !important; }
.icon-bag .bag-click { cursor: pointer; }

html.tb-lock, html.tb-lock body { overflow: hidden !important; }

.tb-overlay {
  position: fixed; inset: 0; z-index: 10000001;
  background: rgba(29, 29, 31, .55);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.tb-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .3s ease; }

.tb-drawer {
  --tb-purple: #72246c;
  --tb-purple-dark: #5a1c55;
  --tb-purple-soft: #f6eef5;
  --tb-teal: #00a9a8;
  --tb-ink: #1d1d1f;
  --tb-muted: #6e6e73;
  --tb-line: #ececef;
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 10000002;
  width: 420px; max-width: 100%;
  display: flex; flex-direction: column;
  background: #fff; color: var(--tb-ink);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .14);
  transform: translateX(100%); visibility: hidden;
  transition: transform .38s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .38s;
  font-size: 14px; line-height: 1.35; text-align: left;
}
.tb-drawer.is-open { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.22, .61, .36, 1); }
.tb-drawer *, .tb-drawer *::before, .tb-drawer *::after { box-sizing: border-box; }

/* ---------- Encabezado */
.tb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--tb-line);
  flex: 0 0 auto;
}
.tb-title {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--tb-ink);
}
.tb-count { color: var(--tb-purple); font-weight: 600; letter-spacing: 0; }
.tb-close {
  width: 40px; height: 40px; margin: -8px -10px -8px 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--tb-ink);
  cursor: pointer; transition: background .2s;
}
.tb-close:hover { background: var(--tb-purple-soft); color: var(--tb-purple); }

/* ---------- Productos */
.tb-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; outline: 0; }
.tb-list { list-style: none; margin: 0; padding: 4px 20px; }
.tb-item {
  position: relative; display: flex; gap: 14px;
  padding: 16px 30px 16px 0; border-bottom: 1px solid var(--tb-line);
  transition: opacity .2s, background-color .6s;
}
.tb-item:last-child { border-bottom: 0; }
.tb-item.is-busy { opacity: .45; pointer-events: none; }
.tb-item.is-new { animation: tb-new 2.2s ease; }
@keyframes tb-new { 0%, 40% { background: var(--tb-purple-soft); } 100% { background: transparent; } }

.tb-img { flex: 0 0 84px; width: 84px; height: 112px; border-radius: 8px; overflow: hidden; background: #f5f5f7; }
.tb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tb-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tb-name {
  color: var(--tb-ink) !important; font-weight: 600; font-size: 14px; text-decoration: none !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tb-name:hover { color: var(--tb-purple) !important; }
.tb-variant { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--tb-muted); font-size: 12.5px; }
.tb-variant b { color: var(--tb-ink); font-weight: 600; }
.tb-color { display: inline-flex; align-items: center; gap: 5px; }
.tb-color i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.tb-warn { color: #c0392b; font-size: 12px; }
.tb-item.is-unavailable .tb-img { opacity: .5; }

.tb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.tb-qty {
  display: inline-flex; align-items: center; height: 34px;
  border: 1px solid #d9d9de; border-radius: 999px; overflow: hidden;
}
.tb-qty button {
  width: 34px; height: 100%; padding: 0; border: 0; background: transparent;
  font-size: 18px; line-height: 1; color: var(--tb-ink); cursor: pointer;
  touch-action: manipulation;
}
.tb-qty button:hover:not([disabled]) { background: var(--tb-purple-soft); color: var(--tb-purple); }
.tb-qty button[disabled] { color: #c7c7cc; cursor: default; }
.tb-qty span { min-width: 22px; text-align: center; font-weight: 600; font-size: 14px; }

.tb-price { text-align: right; white-space: nowrap; }
.tb-price span { display: block; font-weight: 700; font-size: 15px; color: var(--tb-ink); }
.tb-old { display: block; color: var(--tb-muted); font-size: 12px; }

.tb-remove {
  position: absolute; top: 12px; right: -6px;
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: #8e8e93; cursor: pointer;
  transition: background .2s, color .2s;
}
.tb-remove:hover { background: #fdecec; color: #c0392b; }

/* ---------- Vacía */
.tb-empty { padding: 64px 32px; text-align: center; color: var(--tb-purple); }
.tb-empty-title { margin: 14px 0 6px; font-size: 17px; font-weight: 700; color: var(--tb-ink); }
.tb-empty-text { margin: 0; color: var(--tb-muted); }

/* ---------- Pie */
.tb-foot {
  flex: 0 0 auto; padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--tb-line); background: #fff;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .04);
}
.tb-ship { margin-bottom: 14px; }
.tb-ship p { margin: 0 0 8px; font-size: 13px; text-align: center; color: var(--tb-ink); }
.tb-ship b { color: var(--tb-purple); }
.tb-ship.is-ok b { color: var(--tb-teal); }
.tb-bar { height: 6px; border-radius: 999px; background: #ececef; overflow: hidden; }
.tb-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--tb-purple), #a54a9c); transition: width .5s ease; }
.tb-ship.is-ok .tb-bar i { background: var(--tb-teal); }

.tb-sum { margin: 0 0 6px; padding: 12px 0 0; border-top: 1px solid var(--tb-line); }
.tb-sum div { display: flex; justify-content: space-between; margin: 0 0 6px; }
.tb-sum dt { font-weight: 400; color: var(--tb-muted); }
.tb-sum dd { margin: 0; font-weight: 600; }
.tb-sum .tb-disc dd { color: var(--tb-teal); }
.tb-sum .tb-total dt, .tb-sum .tb-total dd { color: var(--tb-ink); font-weight: 700; font-size: 17px; }
.tb-note { margin: 0 0 12px; font-size: 12px; color: var(--tb-muted); }

.tb-btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 48px; margin: 0; padding: 0 16px; border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none !important; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.tb-btn--main { background: var(--tb-purple); color: #fff !important; border: 1px solid var(--tb-purple); }
.tb-btn--main:hover { background: var(--tb-purple-dark); border-color: var(--tb-purple-dark); }
.tb-btn--ghost { margin-top: 8px; background: #fff; color: var(--tb-ink); border: 1px solid #d9d9de; }
.tb-btn--ghost:hover { border-color: var(--tb-purple); color: var(--tb-purple); }
.tb-drawer.is-empty .tb-btn--ghost { margin-top: 0; }

.tb-drawer :focus-visible { outline: 2px solid var(--tb-purple); outline-offset: 2px; }
.tb-drawer .tb-body:focus, .tb-drawer .tb-body:focus-visible { outline: 0; }

/* ---------- Celular: ocupa toda la pantalla */
@media (max-width: 575px) {
  .tb-drawer { width: 100%; }
  .tb-head { padding: 14px 16px 12px; }
  .tb-list { padding: 0 16px; }
  .tb-img { flex-basis: 72px; width: 72px; height: 96px; }
  .tb-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .tb-sum .tb-total dt, .tb-sum .tb-total dd { font-size: 16px; }
  .tb-btn { height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .tb-drawer, .tb-overlay, .tb-bar i { transition: none !important; }
  .tb-item.is-new { animation: none; }
}
