/* ============================================================
   COMPONENTS — buttons, product cards, badges, forms, etc.
   ============================================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(0,112,210,.35);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-light);
}

.btn-dark {
  background: var(--color-header-bg);
  color: #fff;
}

.btn-dark:hover {
  background: #1a2035;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}

.btn-accent:hover {
  background: #e55a26;
  box-shadow: 0 4px 12px rgba(255,107,53,.35);
}

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn-full { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

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

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.5;
}

.badge-sale         { background: var(--color-badge-sale);        color: var(--color-badge-sale-text); }
.badge-new          { background: var(--color-badge-new);         color: var(--color-badge-new-text); }
.badge-bestseller   { background: var(--color-badge-bestseller);  color: var(--color-badge-bestseller-text); }
.badge-toprated     { background: var(--color-badge-toprated);    color: var(--color-badge-toprated-text); }

/* ── Product Card ── */
.product-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.product-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
  border-color: var(--color-primary);
}

.product-card-img {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--color-surface-2);
}

.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-card-img img {
  transform: scale(1.04);
}

.product-card-badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
}

.product-card-wishlist {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.product-card:hover .product-card-wishlist { opacity: 1; }
.product-card-wishlist:hover { color: var(--color-error); }

.product-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.product-card-category {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-medium);
}

.product-card-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-rating {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.stars { color: #f59e0b; letter-spacing: 1px; }

.product-card-footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.price-current {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text);
}

.price-original {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: line-through;
}

/* ── Product Grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-5);
}

.product-grid-3 { grid-template-columns: repeat(3, 1fr); }
.product-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Rating stars helper ── */
.star-rating {
  display: inline-flex;
  gap: 1px;
}

.star-rating .star { color: #f59e0b; font-size: var(--text-sm); }
.star-rating .star-empty { color: var(--color-border); font-size: var(--text-sm); }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text);
}

.form-input {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input::placeholder { color: var(--color-text-muted); }

/* ── Card ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Qty stepper ── */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
}

.qty-btn:hover { background: var(--color-border); }

.qty-value {
  width: 48px;
  height: 36px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
}

/* ── Toast notification ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 1000;
}

.toast {
  background: var(--color-header-bg);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideInRight 300ms ease;
  max-width: 320px;
}

.toast-success { border-left: 3px solid var(--color-success); }
.toast-error   { border-left: 3px solid var(--color-error); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(120%); }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-20) var(--space-8);
  color: var(--color-text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.empty-state h3 { font-size: var(--text-xl); margin-bottom: var(--space-2); color: var(--color-text); }
.empty-state p  { margin-bottom: var(--space-6); }

/* ── Overlay/Modal ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 250ms ease;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-border) 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--color-border); margin: var(--space-6) 0; }
