/* eBay Marketplace-Inspired Design System */

:root {
  /* eBay Brand Colors */
  --ebay-blue: #3665F3;
  --ebay-blue-dark: #2852D4;
  --ebay-blue-darker: #1F44B8;
  --ebay-dark-blue: #282828;
  --ebay-red: #E53238;
  --ebay-red-dark: #CC2D32;
  --ebay-yellow: #F5AF02;
  --ebay-green: #86B817;
  --ebay-green-dark: #75A114;
  
  /* Neutral Colors */
  --bg-light: #F7F7F7;
  --card-white: #FFFFFF;
  --border-gray: #E5E5E5;
  --border-gray-light: #C7C7C7;
  --text-primary: #191919;
  --text-secondary: #707070;
  --text-muted: #959595;
  
  /* Status Colors */
  --status-valid: #10b981;
  --status-valid-alt: #86B817; /* eBay green alternative */
  --status-error: #E53238;
  --status-warning: #F5AF02;
  --status-info: #3665F3;
  
  /* Status Backgrounds */
  --status-valid-bg: #E8F5E9;
  --status-error-bg: #FFEBEE;
  --status-warning-bg: #FFF8E1;
  --status-info-bg: #E3F2FD;
  
  /* Typography */
  --font-family: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-size-page-title: 24px;
  --font-size-section-header: 18px;
  --font-size-card-title: 16px;
  --font-size-body: 14px;
  --font-size-small: 12px;
  --font-size-micro: 11px;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-heading: 1.2;
  --line-height-body: 1.5;
  --line-height-compact: 1.3;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 24px;
  --radius-circle: 50%;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-xl: -4px 0 16px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease-out;
}

/* Dark Mode Overrides */
.dark {
  --text-primary: #e2e8f0; /* Light text for dark backgrounds */
  --text-secondary: #cbd5e1; /* Lighter grey for better contrast */
  --text-muted: #94a3b8; /* Medium grey for muted text */
  --bg-light: #1e293b; /* Dark background */
  --card-white: #334155; /* Dark card background */
  --border-gray: #475569; /* Dark border */
  --border-gray-light: #64748b; /* Lighter dark border */
  --ebay-blue: #60a5fa; /* Lighter blue for dark mode */
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--text-primary);
  background-color: var(--bg-light);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* eBay-Style Buttons */
.btn-ebay-primary {
  background: var(--ebay-blue);
  color: white;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-ebay-primary:hover {
  background: var(--ebay-blue-dark);
}

.btn-ebay-primary:active {
  background: var(--ebay-blue-darker);
  transform: scale(0.98);
}

.btn-ebay-primary:disabled {
  background: var(--border-gray);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-ebay-secondary {
  background: white;
  color: var(--ebay-blue);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ebay-blue);
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-ebay-secondary:hover {
  background: #F0F3FE;
}

.btn-ebay-danger {
  background: var(--ebay-red);
  color: white;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-ebay-danger:hover {
  background: var(--ebay-red-dark);
}

.btn-ebay-success {
  background: var(--ebay-green);
  color: white;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-ebay-success:hover {
  background: var(--ebay-green-dark);
}

.btn-ebay-tertiary {
  background: transparent;
  color: var(--ebay-blue);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  padding: 8px 12px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-ebay-tertiary:hover {
  text-decoration: underline;
}

/* eBay-Style Inputs */
.input-ebay {
  height: 40px;
  padding: 0 var(--space-md);
  border: 1px solid var(--border-gray-light);
  border-radius: var(--radius-md);
  font-size: var(--font-size-body);
  font-family: var(--font-family);
  color: var(--text-primary);
  background: white;
  transition: all var(--transition-base);
}

.input-ebay:focus {
  outline: none;
  border-color: var(--ebay-blue);
  box-shadow: 0 0 0 2px rgba(54, 101, 243, 0.2);
}

.input-ebay-search {
  height: 44px;
  padding: 0 44px 0 44px;
  border-radius: var(--radius-pill);
  background: var(--bg-light);
  border: 1px solid var(--border-gray);
}

.input-ebay-search:focus {
  background: white;
  border-color: var(--ebay-blue);
}

/* eBay-Style Cards */
.card-ebay {
  background: var(--card-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-md);
  box-shadow: none;
  transition: all var(--transition-base);
}

.card-ebay:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Status Badges */
.badge-ebay-valid {
  background: var(--status-valid-bg);
  color: var(--status-valid);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.badge-ebay-error {
  background: var(--status-error-bg);
  color: #C62828;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.badge-ebay-warning {
  background: var(--status-warning-bg);
  color: #F57F17;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Product Card with Issues Highlighting – minimal top-edge accent */
.product-card-ebay.has-errors {
  border-top: 3px solid var(--ebay-red);
}

.product-card-ebay.has-warnings {
  border-top: 3px solid var(--ebay-yellow);
}

.badge-ebay-sku {
  background: var(--ebay-blue);
  color: white;
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Validation Status Card */
.validation-card {
  background: #FAFAFA;
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.validation-card-header {
  font-size: var(--font-size-small);
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
}

.validation-issue {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid #F0F0F0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: var(--font-size-body);
  color: var(--text-primary);
}

.validation-issue:last-child {
  border-bottom: none;
}

.validation-issue-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Character Count Progress Bar */
.char-count-progress {
  width: 100%;
  height: 6px;
  background: var(--border-gray);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--space-xs);
}

.char-count-progress-bar {
  height: 100%;
  transition: all var(--transition-base);
}

.char-count-progress-bar.under-75 {
  background: var(--ebay-yellow);
}

.char-count-progress-bar.optimal {
  background: var(--ebay-green);
}

.char-count-progress-bar.over-80 {
  background: var(--ebay-red);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  padding: var(--space-lg);
}

@media (max-width: 1199px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 991px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    padding: var(--space-md);
  }
}

@media (max-width: 479px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

/* Product Card – Light theme: white card (like Walmart). Dark theme: glassmorphism */
.product-card-ebay,
.product-card-ebay.enterprise-card,
.product-card-ebay.glass-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  position: relative;
}

.dark .product-card-ebay,
.dark .product-card-ebay.enterprise-card,
.dark .product-card-ebay.glass-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.product-card-ebay:hover,
.product-card-ebay.enterprise-card:hover,
.product-card-ebay.glass-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 0 20px var(--brand-primary-glow);
  transform: translateY(-4px);
}

.dark .product-card-ebay:hover,
.dark .product-card-ebay.enterprise-card:hover,
.dark .product-card-ebay.glass-card:hover {
  background: rgba(30, 41, 59, 0.75);
}

/* Light theme: white card (match Walmart). Dark theme: glass */
.glass-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.dark .glass-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Light theme: keep text dark on glass for readability (no hover washout) */
.glass-card .text-slate-900 {
  color: #1e293b !important;
}

.glass-card .text-slate-100 {
  color: #1e293b !important;
}

.glass-card .text-slate-600,
.glass-card .text-slate-500,
.glass-card .text-slate-400 {
  color: #475569 !important;
}

/* Dark theme: white text on glass */
.dark .glass-card .text-slate-900,
.dark .glass-card .text-slate-100 {
  color: #ffffff !important;
}

.dark .glass-card .text-slate-600,
.dark .glass-card .text-slate-500,
.dark .glass-card .text-slate-400 {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Walmart only (no .product-card-ebay): clearer error/warning colors in dark theme – no brown */
.dark .glass-card:not(.product-card-ebay) .text-red-600,
.dark .glass-card:not(.product-card-ebay) .text-red-300 {
  color: #f87171 !important;
}

.dark .glass-card:not(.product-card-ebay) .text-amber-600,
.dark .glass-card:not(.product-card-ebay) .text-amber-300 {
  color: #fbbf24 !important;
}

.product-card-image {
  width: 100%;
  aspect-ratio: 1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: contain;
  border-bottom: 1px solid #e2e8f0;
}

.dark .product-card-image {
  background: rgba(255, 255, 255, 0.02);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.product-card-status {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 10;
}

/* Light theme: dark text so readable on translucent glass (and on hover) */
.product-card-content {
  padding: var(--space-md);
  background: transparent;
  color: #1e293b;
}

.dark .product-card-content {
  color: #ffffff;
}

.product-card-sku {
  font-size: var(--font-size-small);
  color: #475569;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.dark .product-card-sku,
.dark .product-card-ebay .product-card-sku {
  color: rgba(255, 255, 255, 0.9);
}

.product-card-title {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: #1e293b;
  line-height: var(--line-height-compact);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-sm);
  min-height: 40px;
}

.dark .product-card-title,
.dark .product-card-ebay .product-card-title {
  color: #ffffff;
}

.product-card-price {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-bold);
  color: var(--ebay-blue);
}

.dark .product-card-price,
.dark .product-card-ebay .product-card-price {
  color: var(--brand-primary, #60a5fa);
}

/* Detail Panel */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 680px;
  max-width: 60vw;
  height: 100vh;
  background: var(--card-white);
  border-left: 1px solid var(--border-gray);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.detail-panel-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Image Gallery */
.image-gallery-main {
  width: 100%;
  aspect-ratio: 1;
  max-width: 300px;
  background: var(--bg-light);
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  position: relative;
}

.image-gallery-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-gallery-thumbnails {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}

.image-gallery-thumbnail {
  width: 56px;
  height: 56px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.image-gallery-thumbnail:hover,
.image-gallery-thumbnail.active {
  border-color: var(--ebay-blue);
}

.image-gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Section Headers */
.section-header {
  font-size: var(--font-size-section-header);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-header-small {
  font-size: var(--font-size-small);
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
}

/* Sticky Image Gallery for eBay Detail View */
.ebay-image-gallery-sticky {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.ebay-image-gallery-sticky::-webkit-scrollbar {
  width: 6px;
}

.ebay-image-gallery-sticky::-webkit-scrollbar-track {
  background: transparent;
}

.ebay-image-gallery-sticky::-webkit-scrollbar-thumb {
  background: var(--border-gray);
  border-radius: 3px;
}

.ebay-image-gallery-sticky::-webkit-scrollbar-thumb:hover {
  background: var(--border-gray-light);
}

/* Responsive */
@media (max-width: 991px) {
  .detail-panel {
    width: 100%;
    max-width: 100vw;
  }
  
  .ebay-image-gallery-sticky {
    position: relative;
    top: 0;
    max-height: none;
  }
}
