/* ============================================
   ToyFlip Design System
   Dark theme, green accent, speed-focused UI
   Pro tool — clean lines, no cards, crisp text
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0f;
  color: #f0f0f4;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: #4CAF50;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

.text-secondary {
  color: #c8c8d4;
}

.text-mono {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.text-green { color: #4CAF50; }
.text-orange { color: #ff6b35; }
.text-red { color: #ef4444; }

/* --- Layout --- */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 80px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #1e1e2e;
  background: #0a0a0f;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header h1 {
  font-size: 1.25rem;
}

.page-content {
  padding: 16px;
}

/* --- Sections (replaces cards) --- */
.section {
  padding: 16px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid #1e1e2e;
}

.section:last-child {
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

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

.btn-primary {
  background: #4CAF50;
  color: #fff;
}
.btn-primary:hover {
  background: #43a047;
}

.btn-secondary {
  background: #1e1e2e;
  color: #f0f0f4;
}
.btn-secondary:hover {
  background: #2a2a3a;
}

.btn-ghost {
  background: transparent;
  color: #c8c8d4;
  border: 1px solid #2a2a3a;
}
.btn-ghost:hover {
  background: #141420;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
  border-radius: 10px;
  min-height: 56px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  min-height: 36px;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8c8d4;
  border: 1px solid #2a2a3a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.btn-icon:hover {
  background: #141420;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: #c8c8d4;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: #111118;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  color: #f0f0f4;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #4CAF50;
}

.form-input::placeholder {
  color: #555568;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row > * {
  flex: 1;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-scanned {
  background: rgba(156, 163, 175, 0.15);
  color: #d1d5db;
}

.badge-priced {
  background: rgba(59, 130, 246, 0.15);
  color: #93bbfd;
}

.badge-listed {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
}

.badge-sold {
  background: rgba(76, 175, 80, 0.15);
  color: #66bb6a;
}

.badge-shipped {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0a0a0f;
  border-top: 1px solid #1e1e2e;
  display: flex;
  justify-content: center;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-inner {
  display: flex;
  max-width: 480px;
  width: 100%;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 8px;
  color: #888898;
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
  gap: 4px;
}

.nav-item:hover {
  text-decoration: none;
  color: #f0f0f4;
}

.nav-item.active {
  color: #4CAF50;
}

.nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-bottom: 16px;
  background: #1e1e2e;
  border: 1px solid #1e1e2e;
  border-radius: 8px;
  overflow: hidden;
}

.stat-cell {
  background: #0e0e16;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.stat-value.green { color: #4CAF50; }

.stat-label {
  font-size: 0.8rem;
  color: #c8c8d4;
  margin-top: 4px;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  background: transparent;
  color: #c8c8d4;
  border: 1px solid #2a2a3a;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: #444;
  color: #ffffff;
}

.filter-chip.active {
  background: rgba(76, 175, 80, 0.12);
  color: #4CAF50;
  border-color: #4CAF50;
}

/* --- Inventory Item Row --- */
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #1e1e2e;
  cursor: pointer;
  transition: background 0.15s;
}

.item-row:last-child {
  border-bottom: none;
}

.item-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #141420;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  overflow: hidden;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #f0f0f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 0.8rem;
  color: #c8c8d4;
  margin-top: 2px;
}

.item-price {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #4CAF50;
  flex-shrink: 0;
}

/* --- Scanner Viewfinder --- */
.viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #0e0e16;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1e1e2e;
  margin-bottom: 16px;
}

.viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewfinder-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-line {
  width: 70%;
  height: 3px;
  background: #4CAF50;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
  border-radius: 2px;
  animation: scanPulse 2s ease-in-out infinite;
}

@keyframes scanPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.viewfinder-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #888898;
}

.viewfinder-placeholder .icon {
  font-size: 3rem;
}

/* --- Result Section (scan page) --- */
.result-section {
  padding-top: 20px;
  margin-top: 16px;
  border-top: 1px solid #1e1e2e;
}

.result-product {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}

.result-image {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  background: #141420;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.result-details {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  margin-bottom: 4px;
}

.result-brand {
  font-size: 0.85rem;
  color: #c8c8d4;
}

.price-display {
  text-align: center;
  padding: 20px 16px;
  margin-bottom: 16px;
  border-top: 1px solid #1e1e2e;
  border-bottom: 1px solid #1e1e2e;
}

.price-main {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 2.2rem;
  font-weight: 700;
  color: #4CAF50;
}

.price-label {
  font-size: 0.8rem;
  color: #c8c8d4;
  margin-bottom: 4px;
}

.price-range {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9rem;
  color: #e0e0e8;
  margin-top: 6px;
}

.price-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: #c8c8d4;
}

/* --- Condition Selector --- */
.condition-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.condition-option {
  padding: 10px;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: #c8c8d4;
}

.condition-option:hover {
  border-color: #444;
  color: #ffffff;
}

.condition-option.selected {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.08);
  color: #4CAF50;
}

/* --- Status Timeline --- */
.timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2a2a3a;
  position: relative;
}

.timeline-dot.complete {
  background: #4CAF50;
}

.timeline-dot.current {
  background: #4CAF50;
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
}

.timeline-label {
  font-size: 0.7rem;
  color: #888898;
  font-weight: 500;
}

.timeline-label.active {
  color: #4CAF50;
}

.timeline-connector {
  flex: 1;
  height: 2px;
  background: #2a2a3a;
  margin-bottom: 20px;
}

.timeline-connector.complete {
  background: #4CAF50;
}

/* --- Settings Sections --- */
.settings-section {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e1e2e;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h2 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: #ffffff;
}

/* --- Listing Preview --- */
.listing-preview {
  background: #0e0e16;
  border-left: 3px solid #4CAF50;
  padding: 16px;
  margin-top: 8px;
}

.listing-title {
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  margin-bottom: 12px;
}

.listing-body {
  font-size: 0.9rem;
  color: #dddde4;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* --- Action Row --- */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.action-row .btn {
  flex: 1;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #888898;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state p {
  margin-bottom: 16px;
}

/* --- Loading --- */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #2a2a3a;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, #141420 25%, #1e1e2e 50%, #141420 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

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

/* --- Toast / Notification --- */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  color: #f0f0f4;
  z-index: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  display: none;
}

.toast.show {
  display: block;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Quota Bar --- */
.quota-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #c8c8d4;
}

.quota-count {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  color: #4CAF50;
  font-weight: 600;
}

.quota-count.low {
  color: #ff6b35;
}

.quota-count.empty {
  color: #ef4444;
}

/* --- Chart Placeholder --- */
.chart-container {
  border: 1px solid #1e1e2e;
  border-radius: 8px;
  padding: 16px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888898;
}

/* --- Data Row (key-value pairs) --- */
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #141420;
}

.data-row:last-child {
  border-bottom: none;
}

.data-key {
  color: #c8c8d4;
  font-size: 0.9rem;
}

.data-val {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-weight: 700;
  color: #f0f0f4;
}

.data-val.green { color: #4CAF50; }

/* --- Progress Bar --- */
.progress-row {
  margin-bottom: 14px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.progress-header .label {
  color: #f0f0f4;
}

.progress-header .value {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  color: #c8c8d4;
}

.progress-track {
  height: 6px;
  background: #1e1e2e;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .page-content {
    padding: 12px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
  }

  h1 { font-size: 1.4rem; }

  .price-main {
    font-size: 1.8rem;
  }
}

@media (min-width: 768px) {
  .app-container {
    max-width: 600px;
  }

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

/* --- Page-Specific Layouts --- */
.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.summary-count {
  font-weight: 600;
  font-size: 1rem;
  color: #ffffff;
}

.summary-value {
  font-size: 0.85rem;
  color: #c8c8d4;
}

.summary-value strong {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-weight: 700;
  color: #4CAF50;
  font-size: 1.05rem;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.bulk-actions .btn {
  flex: 1;
}

.ai-price {
  text-align: center;
  margin-bottom: 20px;
}

.ai-price-value {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: #ff6b35;
}

.ai-price-note {
  font-size: 0.8rem;
  color: #888898;
  margin-top: 2px;
}

.manual-entry {
  margin-bottom: 16px;
}

.manual-entry-row {
  display: flex;
  gap: 8px;
}

.page-header-center {
  flex: 1;
  text-align: center;
}

.product-upc {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #888898;
}

.badge-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.input-green {
  color: #4CAF50;
  font-weight: 700;
}

.input-orange {
  color: #ff6b35;
  font-weight: 700;
}

.listing-meta {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #c8c8d4;
}

.listing-meta strong {
  color: #f0f0f4;
}

.delete-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delete-label {
  font-weight: 600;
  color: #ef4444;
}

.delete-note {
  font-size: 0.8rem;
  color: #888898;
}

.dashboard-margin {
  text-align: right;
  font-size: 0.8rem;
  color: #c8c8d4;
}

.data-row-total {
  font-weight: 600;
  color: #ffffff;
}

.chart-placeholder {
  text-align: center;
}

.chart-placeholder-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provider-note {
  font-size: 0.85rem;
  color: #c8c8d4;
  margin-bottom: 12px;
}

.phase2-disabled {
  opacity: 0.5;
}

.phase2-note {
  font-size: 0.85rem;
  color: #888898;
}

.data-mgmt-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.clear-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid rgba(220, 38, 38, 0.2);
}

.clear-label {
  font-weight: 600;
  color: #ef4444;
}

.clear-note {
  font-size: 0.8rem;
  color: #888898;
}

.app-info {
  text-align: center;
  padding: 24px 0;
  color: #888898;
  font-size: 0.8rem;
}

.app-info-name {
  font-weight: 600;
  margin-bottom: 4px;
  color: #c8c8d4;
}

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 0;
  gap: 12px;
}

.loading-text {
  color: #c8c8d4;
  font-size: 0.9rem;
}

/* --- Utility --- */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.w-full { width: 100%; }
