/* Advanced Sell System UI */

.sell-wizard {
  padding: var(--space-4);
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 5rem);
}

.sell-wizard__header {
  margin-bottom: var(--space-4);
}

.sell-wizard__header--hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 60%, #fdf2f8 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.sell-wizard__header-art img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(168, 85, 247, 0.15));
  animation: float-slow 5s ease-in-out infinite;
}

.sell-wizard__title {
  font-size: 0.9375rem;
  font-weight: var(--weight-bold);
}

.sell-wizard__sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress */
.sell-progress {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-5);
}

.sell-progress__step {
  flex: 1;
  height: 3px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  transition: background var(--duration-normal) var(--ease-out);
}

.sell-progress__step.active,
.sell-progress__step.done {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.sell-progress__labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
}

.sell-progress__label {
  font-size: 0.5625rem;
  color: var(--text-muted);
  text-align: center;
  flex: 1;
}

.sell-progress__label.active {
  color: var(--accent);
  font-weight: var(--weight-medium);
}

/* Steps */
.sell-step {
  display: none;
  animation: page-enter var(--duration-slow) var(--ease-out);
}

.sell-step.active {
  display: block;
}

.sell-step__title {
  font-size: 0.8125rem;
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.sell-step__desc {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

/* Brand grid */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.brand-option {
  padding: var(--space-3) var(--space-2);
  text-align: center;
  background: var(--bg-glass-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 0.6875rem;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.brand-option:hover {
  border-color: var(--border-default);
  background: var(--surface-hover);
}

.brand-option.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.brand-option input {
  display: none;
}

/* Check cards */
.check-grid {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.check-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.check-card:has(input:checked) {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.06);
}

.check-card__info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.check-card__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: 8px;
  color: var(--accent);
}

.check-card__icon svg {
  width: 16px;
  height: 16px;
}

.check-card__label {
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
}

.check-card__hint {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.check-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Toggle group */
.toggle-group {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.toggle-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.6875rem;
  font-weight: var(--weight-medium);
  text-align: center;
  background: var(--bg-glass-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all var(--duration-fast);
  color: var(--text-secondary);
}

.toggle-btn.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
}

.toggle-btn input {
  display: none;
}

/* Condition rating */
.condition-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.condition-option {
  padding: var(--space-3);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: all var(--duration-fast);
  text-align: center;
}

.condition-option.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.condition-option__name {
  font-size: 0.6875rem;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.condition-option__desc {
  font-size: 0.5625rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.condition-option input {
  display: none;
}

/* Photo upload */
.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.photo-slot {
  aspect-ratio: 1;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--bg-glass-light);
  transition: border-color var(--duration-fast);
  margin: 0;
  text-align: center;
  padding: 8px;
}

.photo-slot:hover {
  border-color: var(--accent);
}

.photo-slot__icon svg,
.photo-slot__icon img {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  opacity: 0.65;
  display: block;
  margin: 0 auto;
}

.photo-slot__label {
  font-size: 0.5625rem;
  color: var(--text-muted);
  line-height: 1.2;
  z-index: 1;
}

.photo-slot img.preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.photo-slot__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}

.photo-slot.has-image .photo-slot__icon,
.photo-slot.has-image .photo-slot__label {
  opacity: 0;
}

.photo-slot.has-image {
  border-style: solid;
  border-color: var(--accent);
}

.form-row {
  display: grid;
  gap: var(--space-3);
}

.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 600px) {
  .form-row--2, .form-row--3 { grid-template-columns: 1fr; }
  .photo-upload-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Valuation result */
.valuation-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.valuation-panel__price {
  font-size: 1.5rem;
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-align: center;
}

.valuation-panel__range {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

.valuation-panel__confidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.5625rem;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin: var(--space-3) auto 0;
  width: fit-content;
}

/* Price breakdown */
.breakdown-list {
  margin-top: var(--space-4);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.6875rem;
}

.breakdown-item__label {
  color: var(--text-secondary);
}

.breakdown-item__value {
  font-weight: var(--weight-medium);
}

.breakdown-item--bonus .breakdown-item__value {
  color: var(--success);
}

.breakdown-item--penalty .breakdown-item__value {
  color: var(--error);
}

/* Health report mini */
.health-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.health-mini__item {
  text-align: center;
  padding: var(--space-2);
  background: var(--bg-glass-light);
  border-radius: 8px;
}

.health-mini__score {
  font-size: 0.8125rem;
  font-weight: var(--weight-semibold);
  color: var(--accent);
}

.health-mini__label {
  font-size: 0.5625rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.health-grade {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--accent-muted);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-3);
}

.health-grade__badge {
  font-size: 1.25rem;
  font-weight: var(--weight-semibold);
  color: var(--accent);
}

.health-grade__score {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Wizard nav */
.sell-wizard__nav {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: calc(var(--app-max-width) - 2rem);
  display: flex;
  gap: var(--space-2);
  z-index: 90;
}

.sell-wizard__nav .btn {
  flex: 1;
}

/* Offer page */
.offer-hero {
  text-align: center;
  padding: var(--space-5) var(--space-4);
  background: linear-gradient(180deg, var(--accent-muted), transparent);
  margin: calc(-1 * var(--space-4));
  margin-bottom: var(--space-4);
}

.offer-hero__amount {
  font-size: 2rem;
  font-weight: var(--weight-semibold);
  color: var(--accent);
}

.offer-hero__label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.offer-expiry {
  font-size: 0.6875rem;
  color: var(--warning);
  margin-top: var(--space-2);
}

.offer-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
}

/* Tracking timeline */
.sell-timeline {
  padding: var(--space-4);
}

.sell-timeline__item {
  position: relative;
  padding-left: var(--space-6);
  padding-bottom: var(--space-4);
}

.sell-timeline__item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}

.sell-timeline__item:last-child::before {
  display: none;
}

.sell-timeline__dot {
  position: absolute;
  left: 2px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-default);
  border: 2px solid var(--bg-primary);
}

.sell-timeline__item.active .sell-timeline__dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.sell-timeline__title {
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
}

.sell-timeline__msg {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sell-timeline__time {
  font-size: 0.5625rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* IMEI input */
.imei-input {
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  text-align: center;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  padding: 0.1875rem 0.5rem;
  font-size: 0.625rem;
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  text-transform: capitalize;
}

.status-badge--offer_sent { background: rgba(59,130,246,0.12); color: var(--info); }
.status-badge--submitted { background: rgba(59,130,246,0.12); color: var(--info); }
.status-badge--under_review { background: rgba(245,158,11,0.12); color: #b45309; }
.status-badge--price_verified { background: rgba(139,92,246,0.12); color: #7c3aed; }
.status-badge--approved { background: rgba(34,197,94,0.12); color: var(--success); }
.status-badge--offer_accepted { background: rgba(34,197,94,0.12); color: var(--success); }
.status-badge--pickup_scheduled { background: var(--accent-muted); color: var(--accent); }
.status-badge--pickup_assigned { background: rgba(99,102,241,0.12); color: #4f46e5; }
.status-badge--pickup_in_progress,
.status-badge--picked_up { background: rgba(59,130,246,0.12); color: var(--info); }
.status-badge--document_verification_pending { background: rgba(245,158,11,0.15); color: #b45309; }
.status-badge--verified { background: rgba(16,185,129,0.15); color: #059669; }
.status-badge--inspection,
.status-badge--inspection_complete { background: rgba(245,158,11,0.12); color: #b45309; }
.status-badge--payment_approved,
.status-badge--payment_sent { background: rgba(16,185,129,0.12); color: #059669; }
.status-badge--completed { background: rgba(34,197,94,0.12); color: var(--success); }
.status-badge--rejected,
.status-badge--cancelled,
.status-badge--offer_rejected { background: rgba(239,68,68,0.12); color: var(--error); }

/* Device unified search */
.sell-device-search { position: relative; }
.sell-search-results {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  z-index: 50;
  background: var(--surface, #fff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.12);
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}
.sell-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.8125rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
}
.sell-search-item:hover { background: var(--bg-secondary, #f8fafc); }
.sell-search-item small { color: var(--text-muted); font-size: 0.6875rem; }
.sell-search-item--empty { color: var(--text-muted); cursor: default; }

/* Premium valuation panel */
.sell-valuation-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.sell-valuation-loading__spinner {
  display: inline-block;
  width: 24px; height: 24px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sell-spin 0.8s linear infinite;
  margin-bottom: 8px;
}
@keyframes sell-spin { to { transform: rotate(360deg); } }

.valuation-panel--premium { padding: 0; }
.valuation-panel__header { margin-bottom: 1rem; }
.valuation-panel__device { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.5rem; }
.valuation-price-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 1rem;
}
.valuation-price-card {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.valuation-price-card--main { grid-column: span 2; background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(168,85,247,0.06)); border-color: rgba(236,72,153,0.2); }
.valuation-price-card--quote { background: linear-gradient(135deg, #ec4899, #a855f7); color: #fff; border: none; }
.valuation-price-card--quote .valuation-price-card__lbl { color: rgba(255,255,255,0.85); }
.valuation-price-card__lbl { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.valuation-price-card__val { font-size: 1.125rem; font-weight: 700; color: var(--accent); }
.valuation-price-card--quote .valuation-price-card__val { color: #fff; font-size: 1.375rem; }

.sell-review-card { padding: 1rem; margin-bottom: 1rem; }
.sell-review-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.875rem; }
.sell-review-row--quote strong { color: var(--accent); font-size: 1.25rem; }

/* Preview page */
.sell-preview-hero { text-align: center; padding: 2rem 1rem; }
.sell-preview-hero__icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.sell-preview-hero__title { font-size: 1.375rem; font-weight: 700; margin: 0 0 0.5rem; }
.sell-preview-hero__sub { color: var(--text-muted); font-size: 0.875rem; margin: 0; }
.sell-preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 1rem; }
.sell-preview-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 14px; }
.sell-preview-card--highlight { grid-column: span 2; }
.sell-preview-card__lbl { display: block; font-size: 0.625rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.sell-preview-card__code { display: block; font-family: var(--font-mono); font-size: 1rem; margin-bottom: 6px; }
.sell-preview-card__price { font-size: 1.25rem; color: var(--accent); }
.sell-preview-section { padding: 1rem; margin-bottom: 1rem; }
.sell-preview-section__title { font-size: 0.875rem; font-weight: 700; margin: 0 0 0.75rem; }
.sell-preview-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; font-size: 0.8125rem; }
.sell-preview-info span { display: block; font-size: 0.625rem; color: var(--text-muted); text-transform: uppercase; }
.sell-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.sell-photo-grid__item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.sell-photo-grid__item figcaption { font-size: 0.5625rem; text-align: center; color: var(--text-muted); margin-top: 2px; }
.sell-preview-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 1rem; }

.sell-detail-hero { padding: 1rem; margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.sell-detail-hero__price span { display: block; font-size: 0.625rem; color: var(--text-muted); }
.sell-detail-hero__price strong { font-size: 1.25rem; color: var(--accent); }
.sell-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }

.sell-status-track { display: flex; flex-wrap: wrap; gap: 6px; }
.sell-status-step { display: flex; align-items: center; gap: 4px; font-size: 0.625rem; padding: 4px 8px; border-radius: 999px; background: var(--bg-secondary); color: var(--text-muted); }
.sell-status-step--done { background: rgba(34,197,94,0.12); color: var(--success); }
.sell-status-step--active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.sell-status-step--rejected { background: rgba(239,68,68,0.12); color: var(--error, #ef4444); }
.sell-status-step__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sell-track-pickup { padding: 0.875rem; margin-bottom: 1rem; font-size: 0.75rem; }
.pickup-doc-timeline { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.5rem; }
.pickup-doc-timeline__step { flex: 1; min-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.5625rem; padding: 6px 4px; border-radius: 8px; background: var(--bg-secondary); color: var(--text-muted); text-align: center; }
.pickup-doc-timeline__step--done { background: rgba(34,197,94,0.12); color: var(--success); }
.pickup-doc-timeline__step--active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.pickup-doc-timeline__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pickup-doc-list--user .pickup-doc-item { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; margin-bottom: 0.5rem; }
.pickup-doc-item__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pickup-doc-item__type { display: block; font-size: 0.625rem; color: var(--text-muted); }
.pickup-doc-item__remarks { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.pickup-doc-item__preview { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.status-badge--pickup_assigned, .status-badge--pickup_in_progress, .status-badge--document_verification_pending, .status-badge--verified { font-size: 0.625rem; }

.sell-order-card { padding: 1rem; display: block; text-decoration: none; color: inherit; }
.sell-order-card__top { display: flex; justify-content: space-between; gap: 8px; }
.sell-order-card__device { font-size: 0.875rem; font-weight: 600; }
.sell-order-card__meta { font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; }
.sell-order-card__price { font-size: 1rem; font-weight: 700; color: var(--accent); margin-top: 0.5rem; }
.sell-order-card__date { font-size: 0.625rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Admin sell dashboard */
.adm-sell-hero { padding: 1.25rem 1.5rem; background: linear-gradient(135deg, #0f172a, #334155); color: #fff; border-radius: 12px; margin-bottom: 1rem; }
.adm-sell-hero__title { margin: 0 0 4px; font-size: 1.25rem; }
.adm-sell-hero__sub { margin: 0; font-size: 0.8125rem; opacity: 0.75; }
.adm-sell-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-bottom: 1rem; }
.adm-sell-kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; text-align: center; }
.adm-sell-kpi__val { display: block; font-size: 1.25rem; font-weight: 800; }
.adm-sell-kpi__lbl { font-size: 0.625rem; color: #64748b; text-transform: uppercase; }
.adm-pickup-form { display: flex; flex-wrap: wrap; gap: 4px; min-width: 280px; }
.adm-pickup-form .form-select, .adm-pickup-form .form-input { font-size: 0.75rem; max-width: 130px; }
.adm-sell-toolbar { padding: 12px 16px !important; margin-bottom: 1rem; display: flex; gap: 8px; flex-wrap: wrap; }
.adm-sell-tabs { margin-bottom: 1rem; overflow-x: auto; }

@media (min-width: 640px) {
  .brand-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .photo-upload-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
