/* ==========================================================================
   components.css - Thành phần dùng lại: nút, thẻ, nhãn, biểu mẫu, thông báo, tồn kho, bộ chọn số lượng.
   Dùng cho: TẤT CẢ các trang.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.2;
  transition: var(--transition);
}

.btn svg,
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.btn:hover,
.icon-btn:hover {
  transform: var(--lift-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: var(--sp-2) var(--sp-4);
}

.btn-block {
  width: 100%;
}

.btn-lime {
  background: var(--lime);
  color: var(--ink);
}

.btn-lime:hover {
  background: var(--white);
}

.btn-dark {
  background: var(--ink);
  color: var(--white);
}

.btn-dark:hover {
  background: #2b3330;
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.35);
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--white);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  transition: var(--transition);
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: var(--transition);
}

.card:hover {
  transform: var(--lift-md);
  box-shadow: var(--shadow-hover);
  border-color: rgba(21, 25, 24, 0.3);
}

.badge {
  display: inline-block;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--lime);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

.badge-out {
  background: var(--ink);
  color: var(--white);
  left: auto;
  right: var(--sp-3);
}

.stock {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ok);
}

.stock-low {
  color: #a35a00;
}

.stock-out {
  color: var(--danger);
}

.qty button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.qty button:disabled:hover {
  background: transparent;
}

.chip {
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: var(--transition);
}

.chip:hover {
  transform: var(--lift-sm);
  border-color: var(--ink);
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.text-link {
  font-weight: 700;
  border-bottom: 2px solid var(--lime);
  transition: var(--transition);
}

.text-link:hover {
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field > span {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: var(--transition);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: rgba(21, 25, 24, 0.45);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid var(--lime);
  outline-offset: 0;
  border-color: var(--ink);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.form-error {
  min-height: 1.4em;
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.alert {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
}

.alert-ok {
  border-left-color: var(--ok);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--white);
  font-size: var(--fs-sm);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: var(--transition);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.price {
  font-weight: 800;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.empty {
  padding: var(--sp-7) var(--sp-5);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
}

.qty button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: var(--fs-lg);
  transition: var(--transition);
}

.qty button:hover {
  background: var(--paper);
}

.qty span,
.qty input {
  min-width: 36px;
  text-align: center;
  font-weight: 800;
}

.hint {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--muted);
}

@media (max-width: 560px) {
  .btn-ghost span {
      display: none;
  }
}
