/* ============================================
   Component Styles
   ============================================ */

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: var(--button-height);
  padding: 0 var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-button-size);
  font-weight: var(--text-button-weight);
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-width: var(--tap-target);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn--primary:active { background: var(--color-primary-dark); transform: scale(0.98); }

.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn--secondary:active { background: var(--color-primary-lightest); }

.btn--tertiary {
  background: transparent;
  color: var(--color-primary);
  padding: 0 var(--space-md);
  height: auto;
}

.btn--destructive {
  background: transparent;
  color: var(--color-error);
  border: 2px solid var(--color-error);
}
.btn--destructive:active { background: var(--color-error-light); }

.btn--disabled, .btn:disabled {
  background: var(--color-border);
  color: var(--color-text-secondary);
  cursor: not-allowed;
  pointer-events: none;
}

.btn--sm {
  height: var(--button-height-sm);
  padding: 0 var(--space-md);
  font-size: var(--text-body-sm-size);
}

.btn--full { width: 100%; }

.btn--icon {
  width: var(--tap-target);
  height: var(--tap-target);
  padding: 0;
  border-radius: var(--radius-full);
}

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

/* === Sticky CTA === */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 428px;
  padding: var(--space-md);
  background: var(--color-bg-white);
  border-top: 1px solid var(--color-border-light);
  z-index: var(--z-sticky);
}

.sticky-cta--with-nav {
  bottom: var(--bottom-nav-height);
}

/* === Input Fields === */
.input-group {
  margin-bottom: var(--space-md);
}

.input-label {
  display: block;
  font-size: var(--text-body-sm-size);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.input-field {
  width: 100%;
  height: var(--input-height);
  padding: 0 var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-body-size);
  background: var(--color-bg-white);
  transition: border-color var(--transition-fast);
}

.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  border-width: 2px;
  padding: 0 calc(var(--space-md) - 1px);
}

.input-field--error {
  border-color: var(--color-error);
}

.input-field--textarea {
  height: auto;
  min-height: 100px;
  padding: var(--space-md);
  resize: vertical;
}

.input-helper {
  font-size: var(--text-caption-size);
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

.input-helper--error {
  color: var(--color-error);
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .input-field {
  padding-left: 44px;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-secondary);
}

/* === Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-badge-size);
  font-weight: var(--text-badge-weight);
  line-height: var(--text-badge-height);
  white-space: nowrap;
}

.badge--stock { background: var(--color-success-light); color: var(--color-success); }
.badge--sale { background: var(--color-accent-light); color: var(--color-accent); }
.badge--new { background: var(--color-info-light); color: var(--color-info); }
.badge--compatible { background: var(--color-primary-lightest); color: var(--color-primary); }
.badge--subscribe { background: var(--color-primary-lightest); color: var(--color-primary); }
.badge--out-of-stock { background: var(--color-error-light); color: var(--color-error); }
.badge--processing { background: var(--color-info-light); color: var(--color-info); }
.badge--shipped { background: var(--color-warning-light); color: var(--color-warning); }
.badge--delivered { background: var(--color-success-light); color: var(--color-success); }
.badge--cancelled { background: var(--color-error-light); color: var(--color-error); }

.badge--count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-error);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Product Card === */
.product-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
  position: relative;
}

.product-card:active {
  transform: scale(0.97);
}

.product-card__image-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
}

.product-card__heart {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: var(--tap-target);
  height: var(--tap-target);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-spring);
}

.product-card__heart:active {
  transform: scale(1.2);
}

.product-card__heart--active svg {
  fill: var(--color-error);
  color: var(--color-error);
}

.product-card__body {
  padding: var(--space-sm) var(--space-md) var(--space-md);
}

.product-card__brand {
  font-size: var(--text-caption-size);
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.product-card__name {
  font-size: var(--text-body-sm-size);
  font-weight: 600;
  color: var(--color-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.product-card__rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--space-xs);
}

.product-card__rating-stars {
  color: var(--color-warning);
  font-size: 12px;
}

.product-card__rating-count {
  font-size: var(--text-caption-size);
  color: var(--color-text-secondary);
}

.product-card__price {
  font-size: var(--text-price-size);
  font-weight: var(--text-price-weight);
  color: var(--color-text-primary);
}

.product-card__price--sale {
  color: var(--color-error);
}

.product-card__price-original {
  font-size: var(--text-body-sm-size);
  color: var(--color-text-secondary);
  text-decoration: line-through;
  margin-left: var(--space-sm);
  font-weight: 400;
}

/* Product Card List View */
.product-card--list {
  display: flex;
  flex-direction: row;
}

.product-card--list .product-card__image-wrap {
  width: 120px;
  aspect-ratio: 1;
  flex-shrink: 0;
}

.product-card--list .product-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* === Search Bar === */
.search-bar {
  display: flex;
  align-items: center;
  height: var(--input-height);
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}

.search-bar__icon {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.search-bar__input {
  flex: 1;
  border: none;
  background: none;
  font-size: var(--text-body-size);
  outline: none;
}

.search-bar__input::placeholder {
  color: var(--color-text-tertiary);
}

/* === Category Pill === */
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: var(--text-body-sm-size);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-pill--active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.category-pill:active {
  transform: scale(0.95);
}

/* === Stepper === */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stepper__btn {
  width: var(--tap-target);
  height: var(--tap-target);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
  cursor: pointer;
  font-size: 18px;
  color: var(--color-text-primary);
  transition: background var(--transition-fast);
}

.stepper__btn:active { background: var(--color-border); }
.stepper__btn--disabled { color: var(--color-text-tertiary); cursor: not-allowed; }

.stepper__value {
  width: 40px;
  text-align: center;
  font-weight: 600;
  font-size: var(--text-body-sm-size);
}

/* === Toggle Switch === */
.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: var(--space-sm);
}

.toggle__track {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--color-border);
  position: relative;
  transition: background var(--transition-normal);
  flex-shrink: 0;
}

.toggle__track--active {
  background: var(--color-primary);
}

.toggle__thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal);
}

.toggle__track--active .toggle__thumb {
  transform: translateX(20px);
}

/* === Progress Bar === */
.progress-bar {
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width var(--transition-slow);
}

.progress-bar--sm { height: 4px; }
.progress-bar--lg { height: 12px; }

/* === Star Rating === */
.star-rating {
  display: inline-flex;
  gap: 2px;
}

.star-rating__star {
  width: 16px;
  height: 16px;
  cursor: pointer;
  color: var(--color-border);
  transition: color var(--transition-fast);
}

.star-rating__star--filled {
  color: var(--color-warning);
}

.star-rating--lg .star-rating__star {
  width: 24px;
  height: 24px;
}

/* === Accordion === */
.accordion {
  border-bottom: 1px solid var(--color-border-light);
}

.accordion__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  cursor: pointer;
  min-height: var(--tap-target);
}

.accordion__title {
  font-size: var(--text-body-size);
  font-weight: 600;
}

.accordion__icon {
  transition: transform var(--transition-normal);
  color: var(--color-text-secondary);
}

.accordion--open .accordion__icon {
  transform: rotate(180deg);
}

.accordion__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.accordion--open .accordion__content {
  max-height: 2000px;
}

.accordion__body {
  padding-bottom: var(--space-md);
  font-size: var(--text-body-sm-size);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  max-width: 380px;
  width: calc(100% - 32px);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-text-primary);
  color: white;
  font-size: var(--text-body-sm-size);
  font-weight: 500;
  text-align: center;
  z-index: var(--z-toast);
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--transition-normal);
}

.toast--success { background: var(--color-success); }
.toast--error { background: var(--color-error); }
.toast--warning { background: var(--color-warning); }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn var(--transition-fast);
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn var(--transition-normal);
}

.modal-content__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
}

.modal-content__body {
  padding: 0 var(--space-lg) var(--space-lg);
}

.modal-content__footer {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  display: flex;
  gap: var(--space-sm);
}

/* === Bottom Sheet === */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-sheet);
  animation: fadeIn var(--transition-fast);
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 428px;
  max-height: 90vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: var(--z-sheet);
  overflow-y: auto;
  animation: slideUp var(--transition-normal);
}

.bottom-sheet__handle {
  display: flex;
  justify-content: center;
  padding: var(--space-sm) 0;
}

.bottom-sheet__handle::after {
  content: '';
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
}

.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg) var(--space-md);
}

.bottom-sheet__body {
  padding: 0 var(--space-lg) var(--space-lg);
}

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

.skeleton--text { height: 16px; width: 80%; margin-bottom: var(--space-sm); }
.skeleton--text-sm { height: 12px; width: 60%; }
.skeleton--title { height: 22px; width: 50%; margin-bottom: var(--space-md); }
.skeleton--image { aspect-ratio: 1; width: 100%; }
.skeleton--circle { width: 48px; height: 48px; border-radius: 50%; }
.skeleton--button { height: var(--button-height); width: 100%; border-radius: var(--radius-md); }

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-lg);
  text-align: center;
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-lg);
  color: var(--color-text-tertiary);
}

.empty-state__title {
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  margin-bottom: var(--space-sm);
}

.empty-state__text {
  font-size: var(--text-body-sm-size);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
  max-width: 280px;
}

/* === List Item === */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  min-height: var(--tap-target);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--color-border-light);
}

.list-item:active {
  background: var(--color-surface-alt);
}

.list-item__icon {
  width: 24px;
  height: 24px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.list-item__content {
  flex: 1;
  min-width: 0;
}

.list-item__title {
  font-weight: 500;
}

.list-item__subtitle {
  font-size: var(--text-body-sm-size);
  color: var(--color-text-secondary);
}

.list-item__arrow {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

/* === Section Group (Account Dashboard) === */
.section-group {
  margin-bottom: var(--space-lg);
}

.section-group__title {
  font-size: var(--text-caption-size);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

/* === Tier Card === */
.tier-card {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  color: white;
  position: relative;
  overflow: hidden;
}

.tier-card--ambassador {
  background: var(--gradient-gold);
}

.tier-card__tier-name {
  font-size: var(--text-caption-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
  opacity: 0.9;
}

.tier-card__points {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.tier-card__points-label {
  font-size: var(--text-body-sm-size);
  opacity: 0.8;
}

.tier-card__progress {
  margin-top: var(--space-md);
}

.tier-card__progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.tier-card__progress-fill {
  height: 100%;
  background: white;
  border-radius: 3px;
  transition: width var(--transition-slow);
}

.tier-card__progress-text {
  font-size: var(--text-caption-size);
  opacity: 0.8;
}

/* === Checkout Step Indicator === */
.checkout-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  gap: var(--space-sm);
}

.checkout-step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.checkout-step__number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-body-sm-size);
  font-weight: 600;
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

.checkout-step--active .checkout-step__number {
  background: var(--color-primary);
  color: white;
}

.checkout-step--completed .checkout-step__number {
  background: var(--color-success);
  color: white;
}

.checkout-step__label {
  font-size: var(--text-caption-size);
  color: var(--color-text-secondary);
}

.checkout-step--active .checkout-step__label {
  color: var(--color-text-primary);
  font-weight: 600;
}

.checkout-step__line {
  width: 24px;
  height: 2px;
  background: var(--color-border-light);
}

.checkout-step__line--completed {
  background: var(--color-success);
}

/* === Notification Item === */
.notification-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notification-item:active { background: var(--color-surface-alt); }

.notification-item--unread { background: var(--color-primary-lightest); }

.notification-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--color-primary-lightest);
  color: var(--color-primary);
}

.notification-item__content { flex: 1; }

.notification-item__title {
  font-weight: 600;
  font-size: var(--text-body-sm-size);
  margin-bottom: 2px;
}

.notification-item__text {
  font-size: var(--text-caption-size);
  color: var(--color-text-secondary);
}

.notification-item__time {
  font-size: var(--text-caption-size);
  color: var(--color-text-tertiary);
  margin-top: var(--space-xs);
}

/* === Bottom Navigation === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 428px;
  height: var(--bottom-nav-height);
  background: var(--color-bg-white);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: var(--z-header);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__tablist {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  height: 100%;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: var(--tap-target);
  min-height: var(--tap-target);
  padding: var(--space-xs);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}

.bottom-nav__item--active {
  color: var(--color-primary);
}

.bottom-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav__label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

/* === Image Gallery === */
.gallery {
  position: relative;
  overflow: hidden;
}

.gallery__track {
  display: flex;
  transition: transform var(--transition-normal);
}

.gallery__slide {
  min-width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--color-surface-alt);
}

.gallery__dots {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  padding: var(--space-md);
}

.gallery__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.gallery__dot--active {
  background: var(--color-primary);
  width: 24px;
  border-radius: 4px;
}
