/* ========================================
   FILE: frontend/css/components.css
   ======================================== */

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-base);
  border: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,60,0,0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
}
.btn-secondary:hover {
  background: #333;
  border-color: #333;
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-dark);
}
.btn-outline:hover {
  background: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--color-bg-light);
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: 18px 40px;
  font-size: var(--font-size-base);
}

.btn-full { width: 100%; }

.btn-loading {
  position: relative;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}


/* ── Card (generic) ───────────────────────────────────────────────────────── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

/* ── Input / Form Controls ────────────────────────────────────────────────── */
.input-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255,60,0,0.10);
}
.input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.10);
}
.input::placeholder { color: var(--color-text-muted); }

.input-icon {
  position: relative;
}
.input-icon .input { padding-left: 44px; }
.input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 16px;
  pointer-events: none;
}

.field-error {
  font-size: var(--font-size-xs);
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Select ───────────────────────────────────────────────────────────────── */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ── Checkbox / Radio ─────────────────────────────────────────────────────── */
.checkbox-wrap, .radio-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.checkbox-wrap input[type="checkbox"],
.radio-wrap input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Toggle ───────────────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border-dark);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-base);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
}
.toggle input:checked + .toggle-slider { background: var(--color-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Accordion ────────────────────────────────────────────────────────────── */
.accordion-item {
  border-bottom: 1px solid var(--color-border);
}
.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  width: 100%;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  text-align: left;
}
.accordion-trigger .icon {
  transition: transform var(--transition-base);
  font-size: 14px;
  color: var(--color-text-muted);
}
.accordion-item.open .accordion-trigger .icon {
  transform: rotate(45deg);
}
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}
.accordion-body-inner {
  padding-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--line-height-loose);
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4xl) var(--space-md);
  text-align: center;
  gap: var(--space-md);
}
.empty-state__icon {
  font-size: 64px;
  opacity: 0.3;
}
.empty-state__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}
.empty-state__subtitle {
  color: var(--color-text-muted);
  max-width: 320px;
}

/* ── Status Badges ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-PENDING,    .status-badge.pending    { background: #fff3cd; color: #856404; }
.status-PAID,       .status-badge.paid       { background: #d4edda; color: #155724; }
.status-PROCESSING, .status-badge.processing { background: #cce5ff; color: #004085; }
.status-SHIPPED,    .status-badge.shipped    { background: #d1ecf1; color: #0c5460; }
.status-DELIVERED,  .status-badge.delivered  { background: #d4f6e6; color: #0f6b38; }
.status-CANCELLED,  .status-badge.cancelled  { background: #fde8e6; color: #9c1f15; }
.status-RETURNED,   .status-badge.returned   { background: #f0e6ff; color: #5c0080; }

/* ── Price Display ────────────────────────────────────────────────────────── */
.price-group {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.price-current {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
}
.price-original {
  color: var(--color-text-muted);
  text-decoration: line-through;
  font-size: var(--font-size-lg);
}
.price-discount {
  color: var(--color-success);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}
