/* ==========================================================
   components.css — Nút, card sản phẩm, tabs, giỏ hàng, popup, toast
   ========================================================== */

/* ----- Buttons ----- */
.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: all .2s;
  text-align: center;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--outline {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}
.btn--outline:hover { background: var(--color-primary); color: #fff; }
.btn--full { width: 100%; }
.btn--sm { padding: 8px 16px; font-size: 0.85rem; }

/* ----- Menu tabs ----- */
.menu-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.menu-tab {
  padding: 9px 22px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  font-weight: 600;
  color: var(--color-text);
  transition: all .2s;
}
.menu-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.menu-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ----- Product card ----- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}
.product-card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s;
}
.product-card:hover { transform: translateY(-5px); }
.product-card__img {
  background: var(--color-bg-alt);
  height: 180px;
  position: relative;
  overflow: hidden;
}
.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .product-card__img img { transform: scale(1.06); }
.product-card__tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.product-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
}
.product-card__name { font-size: 1.02rem; font-weight: 700; }
.product-card__desc {
  font-size: 0.85rem;
  color: var(--color-muted);
  flex: 1;
}
.product-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.product-card__price { color: var(--color-primary); font-weight: 800; font-size: 1.1rem; }

/* ----- Cart button ----- */
.cart-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.35rem;
}
.cart-btn__count {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ----- Cart drawer ----- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: var(--color-white);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s;
  box-shadow: -8px 0 30px rgba(0,0,0,.15);
}
.cart-drawer.open { transform: translateX(0); }
.cart-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}
.cart-drawer__close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--color-muted);
}
.cart-drawer__freeship {
  font-size: 0.83rem;
  padding: 10px 20px;
  background: var(--color-bg-alt);
  color: var(--color-text);
}
.cart-drawer__items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-empty { text-align: center; color: var(--color-muted); padding: 40px 0; }
.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.cart-item__img {
  background: var(--color-bg-alt);
  border-radius: 10px;
  width: 52px;
  height: 52px;
  overflow: hidden;
  flex-shrink: 0;
}
.cart-item__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ----- Ghi chú đơn hàng ----- */
.cart-note { margin-bottom: 14px; }
.cart-note label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-dark);
}
.cart-note textarea {
  resize: vertical;
  min-height: 56px;
  font-size: 0.9rem;
}
.cart-item__info { flex: 1; }
.cart-item__name { font-weight: 600; font-size: 0.92rem; }
.cart-item__price { color: var(--color-primary); font-weight: 700; font-size: 0.9rem; }
.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-item__qty button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  font-weight: 700;
}
.cart-item__remove {
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 1rem;
}
.cart-drawer__footer {
  padding: 18px 20px;
  border-top: 1px solid var(--color-border);
}
.cart-drawer__total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 14px;
}
.cart-drawer__total strong { color: var(--color-primary); font-size: 1.2rem; }

/* ----- Promo popup ----- */
.promo {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.promo__box {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 40px 34px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow);
}
.promo__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-muted);
}
.promo__eyebrow {
  color: var(--color-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.8rem;
}
.promo__percent {
  font-size: 3rem;
  font-weight: 800;
  color: var(--color-primary);
  margin: 6px 0;
}
.promo__box .btn { margin-top: 18px; }

/* ----- Toast ----- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-dark);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 400;
  box-shadow: var(--shadow);
  animation: toast-in .25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
