/* =========================================
   JM Celulares — Carrito Styles
   ========================================= */

/* ---- Topbar: cart icon & clear btn ---- */
.topbar__cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-b);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.topbar__cart:hover { color: var(--text); border-color: var(--primary); }

.topbar__cart-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
}

.topbar__clear-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.25);
  color: var(--red-text);
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s;
}
.topbar__clear-cart:hover { background: rgba(239,68,68,.2); }

/* ---- Add to cart button (in catalog) ---- */
.btn-add-cart {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 50px;
  border: 1px solid var(--primary);
  background: rgba(59,130,246,.1);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-add-cart:hover { background: var(--primary); color: #fff; }
.btn-add-cart--added {
  background: rgba(16,185,129,.15);
  border-color: var(--green-text);
  color: var(--green-text);
}

/* ---- Cart page layout ---- */
.cart-content {
  padding: 12px;
}

/* ---- Empty state ---- */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 72px 20px 40px;
  color: var(--text-muted);
  text-align: center;
}
.cart-empty svg { color: var(--text-dim); }
.cart-empty p { font-size: .95rem; }

/* ---- Cart items ---- */
.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  animation: fadeIn .2s ease both;
}

.cart-item__info { flex: 1; min-width: 0; }

.cart-item__name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cart-item__cat {
  font-size: .72rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.cart-item__price {
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
}

.cart-item__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cart-qty-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-b);
  background: var(--bg-card-h);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.cart-qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.cart-qty {
  min-width: 24px;
  text-align: center;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

.cart-remove-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,.25);
  background: rgba(239,68,68,.08);
  color: var(--red-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 2px;
  transition: background .12s;
}
.cart-remove-btn:hover { background: rgba(239,68,68,.2); }

/* ---- Summary ---- */
.cart-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-b);
  border-radius: 16px;
  padding: 18px;
  margin-top: 6px;
}

.cart-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .88rem;
  color: var(--text-muted);
  padding: 4px 0;
}

.cart-summary__total {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.cart-summary__note {
  font-size: .72rem;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.4;
}

.btn-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px;
  margin-top: 16px;
  background: linear-gradient(135deg, #25d366, #1ebe5d);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s, transform .15s;
  box-shadow: 0 4px 16px rgba(37,211,102,.3);
}
.btn-checkout:hover {
  opacity: .92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,211,102,.4);
}
.btn-checkout:active { transform: translateY(0); }

.branch-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.branch-modal[hidden] {
  display: none;
}

.branch-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(6, 10, 20, .62);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

.branch-modal__sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100%, 560px);
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(21, 27, 42, .98), rgba(11, 16, 29, .99));
  border: 1px solid rgba(255,255,255,.08);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -18px 50px rgba(0,0,0,.38);
  padding: 14px 14px 18px;
  animation: branchSheetIn .2s ease-out both;
}

.branch-modal__handle {
  width: 56px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.15);
  margin: 0 auto 14px;
}

.branch-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.branch-modal__eyebrow {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7dd3fc;
  margin-bottom: 4px;
}

.branch-modal__title {
  margin: 0;
  color: var(--text);
  font-size: 1.12rem;
}

.branch-modal__text {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: .84rem;
  line-height: 1.4;
}

.branch-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-b);
  background: rgba(255,255,255,.04);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.branch-list {
  display: grid;
  gap: 10px;
}

.branch-option {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
  color: inherit;
  padding: 14px;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

.branch-option:hover {
  transform: translateY(-1px);
  border-color: rgba(37,211,102,.48);
  background: rgba(37,211,102,.08);
}

.branch-option__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.branch-option__name {
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
}

.branch-option__badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(37,211,102,.16);
  color: #7ef0a3;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}

.branch-option__meta {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: .8rem;
  line-height: 1.45;
}

@keyframes branchSheetIn {
  from {
    opacity: 0;
    transform: translate(-50%, 18px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
