/* Global Variables & Colors */
:root {
  --bg-primary: #070913;
  --bg-secondary: #0e1222;
  --bg-glass: rgba(13, 18, 38, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  --accent-primary: #6366f1; /* Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-primary-glow: rgba(99, 102, 241, 0.2);
  
  --color-green: #10b981; /* Emerald */
  --color-green-glow: rgba(16, 185, 129, 0.15);
  
  --color-yellow: #f59e0b; /* Amber */
  --color-yellow-glow: rgba(245, 158, 11, 0.15);
  
  --color-red: #f43f5e; /* Rose */
  --color-red-glow: rgba(244, 63, 94, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-neon: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-neon-primary: 0 0 15px rgba(99, 102, 241, 0.25);
}

/* Base resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 9, 19, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary-glow);
}

/* Ambient glow backgrounds */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.15;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 80%);
  top: -10%;
  left: -10%;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--color-green) 0%, transparent 80%);
  bottom: -10%;
  right: -10%;
}

/* Glassmorphism Panel style */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: var(--shadow-neon);
}

/* App container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent-primary), #a855f7);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-neon-primary);
  animation: logo-glowing 3s infinite alternate;
}

.logo-area h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.logo-area p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Stats dashboard */
.stats-container {
  display: grid;
  grid-template-columns: repeat(4, 160px);
  gap: 1rem;
}

@media (max-width: 900px) {
  .stats-container {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon i {
  width: 18px;
  height: 18px;
}

.icon-blue {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
}

.icon-green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-green);
}

.icon-yellow {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-yellow);
}

.icon-red {
  background: rgba(244, 63, 94, 0.1);
  color: var(--color-red);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main layouts */
.app-main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

/* Control Panel (Forms & Action Buttons) */
.control-panel {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.control-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-panel h2 i {
  color: var(--accent-primary);
}

.panel-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: -0.5rem;
}

.scrape-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.textarea-wrapper {
  position: relative;
  background: rgba(7, 9, 19, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.textarea-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 1rem;
  color: var(--text-main);
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-primary-sm, .btn-secondary-sm {
  font-family: var(--font-sans);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  width: 100%;
  box-shadow: var(--shadow-neon-primary);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-glass);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  width: 100%;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary-sm {
  background: var(--accent-primary);
  color: white;
  padding: 0.5rem 1rem;
  font-size: 0.825rem;
  text-decoration: none;
}

.btn-primary-sm:hover {
  background: var(--accent-primary-hover);
}

.btn-secondary-sm {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-glass);
  padding: 0.5rem 1rem;
  font-size: 0.825rem;
}

.btn-secondary-sm:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon-only {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon-only:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.panel-divider {
  height: 1px;
  background: var(--border-glass);
}

.export-tools {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.export-tools h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
}

.export-buttons {
  display: flex;
  gap: 0.75rem;
}

/* Catalog panel layout */
.catalog-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.catalog-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Loading & Empty state displays */
.catalog-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-glass);
  border-radius: 16px;
  text-align: center;
}

.catalog-state.hidden {
  display: none !important;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.catalog-state h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.catalog-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 400px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

/* Grid of product cards */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.products-grid.hidden {
  display: none !important;
}

/* Product Card */
.product-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(99, 102, 241, 0.1);
}

/* Status overlays on cards */
.card-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  backdrop-filter: blur(8px);
}

.status-pending {
  background: rgba(245, 158, 11, 0.85);
  color: white;
}

.status-processing {
  background: rgba(99, 102, 241, 0.85);
  color: white;
}

.status-failed {
  background: rgba(244, 63, 94, 0.85);
  color: white;
}

.card-image-wrapper {
  position: relative;
  height: 200px;
  width: 100%;
  overflow: hidden;
  background: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image-wrapper img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  transition: var(--transition-smooth);
}

.product-card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

.card-image-placeholder {
  font-size: 2.5rem;
  color: var(--text-dark);
}

.card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.7rem;
}

.card-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.card-price {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-green);
}

.card-original-price {
  font-size: 0.85rem;
  text-decoration: line-through;
  color: var(--text-muted);
}

.card-discount {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-green);
  background: var(--color-green-glow);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.card-meta-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-error-text {
  font-size: 0.75rem;
  color: var(--color-red);
  background: var(--color-red-glow);
  padding: 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Detail Modal Style */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: var(--transition-smooth);
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-container {
  width: 100%;
  max-width: 1050px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 2rem;
}

.modal-overlay.hidden .modal-container {
  animation: none;
  transform: scale(0.95);
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  z-index: 10;
}

.modal-close-btn:hover {
  background: var(--color-red-glow);
  color: var(--color-red);
  border-color: rgba(244, 63, 94, 0.3);
}

.modal-content {
  display: grid;
  grid-template-columns: 45% 55%;
  gap: 2rem;
  margin-top: 1rem;
}

@media (max-width: 800px) {
  .modal-content {
    grid-template-columns: 1fr;
  }
}

/* Gallery inside modal */
.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.main-image-container {
  height: 350px;
  background: #090c14;
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1rem;
}

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

.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
}

.thumb-wrapper {
  height: 60px;
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  background: #090c14;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: var(--transition-smooth);
}

.thumb-wrapper:hover, .thumb-wrapper.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.thumb-wrapper img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

/* Details inside modal */
.modal-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.details-header {
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.product-id-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 1px;
}

.details-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.price-container {
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
}

.price-original {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.price-current {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.price-current .price-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-green);
}

.discount-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-green);
  background: var(--color-green-glow);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.product-meta-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Tabs navigator inside modal */
.tabs-navigator {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
  gap: 1.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding-bottom: 0.75rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
}

/* Tab Panels */
.tabs-content {
  overflow-y: auto;
  max-height: 300px;
}

.tab-panel {
  display: none;
  animation: fade-in 0.3s ease-out;
}

.tab-panel.active {
  display: block;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.specs-table tr:last-child {
  border: none;
}

.specs-table td {
  padding: 0.65rem 0.5rem;
  font-size: 0.875rem;
}

.specs-table td:first-child {
  font-weight: 600;
  color: var(--text-muted);
  width: 35%;
}

.specs-table td:last-child {
  color: var(--text-main);
}

.description-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-line;
}

.json-code {
  background: #090c14;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #34d399; /* Greenish code look */
  overflow-x: auto;
  max-height: 280px;
  white-space: pre-wrap;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-neon);
  animation: slide-in-bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: var(--transition-smooth);
}

.toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#toast-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

#toast-message {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Animations */
@keyframes logo-glowing {
  0% {
    box-shadow: 0 0 5px rgba(99, 102, 241, 0.2);
  }
  100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5), 0 0 30px rgba(168, 85, 247, 0.3);
  }
}

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

@keyframes scale-up {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-in-bottom {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
