/* ApexScrape Premium Dark Glassmorphism Stylesheet */

:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.3);
  
  --primary-cyan: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.4);
  --secondary-indigo: #818cf8;
  --emerald-green: #10b981;
  --amber-yellow: #f59e0b;
  --rose-red: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

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

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

/* Ambient Background Glow */
.glow-bg {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
  top: -100px;
  left: -100px;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  bottom: -200px;
  right: -100px;
}

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Glassmorphism Card Utilities */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff, var(--primary-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--emerald-green);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald-green);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Hero & Input Section */
.url-hero {
  padding: 24px;
}

.url-input-group {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 16px;
  gap: 12px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.url-input-group:focus-within {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 20px var(--primary-glow);
}

.url-prefix {
  color: var(--primary-cyan);
  font-size: 18px;
}

.url-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 15px;
  font-family: var(--font-body);
}

.url-input-group input::placeholder {
  color: var(--text-dim);
}

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

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

.btn-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.3);
}

.btn-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.2);
  color: var(--rose-red);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-export {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  font-size: 13px;
  padding: 8px 14px;
}

.btn-export:hover:not(:disabled) {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  transform: translateY(-1px);
}

.btn-zip {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(99, 102, 241, 0.2));
  border-color: rgba(129, 140, 248, 0.3);
  color: var(--secondary-indigo);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Options Toggle */
.options-toggle-wrapper {
  margin-top: 12px;
}

.options-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.options-toggle-btn:hover {
  color: var(--primary-cyan);
}

.advanced-options {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.option-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-item label {
  font-size: 12px;
  color: var(--text-muted);
}

.option-item input[type="number"] {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  outline: none;
}

.checkbox-item {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.checkbox-item span {
  font-size: 13px;
  color: var(--text-main);
}

/* Switch Toggle */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-cyan);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.icon-blue { background: rgba(56, 189, 248, 0.15); color: var(--primary-cyan); }
.icon-purple { background: rgba(129, 140, 248, 0.15); color: var(--secondary-indigo); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--amber-yellow); }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald-green); }
.icon-rose { background: rgba(244, 63, 94, 0.15); color: var(--rose-red); }

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

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

.stat-value {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
}

/* Action Bar */
.action-bar {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.control-btns, .export-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 4px;
}

/* Progress Section */
.progress-section {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.percent-badge {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary-cyan);
}

.progress-track {
  height: 8px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, var(--primary-cyan));
  box-shadow: 0 0 12px var(--primary-glow);
  transition: width 0.3s ease;
}

/* Terminal Log */
.terminal-wrapper {
  margin-top: 8px;
  background: #070a12;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.terminal-header {
  background: #0f172a;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
}

.terminal-clear {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
}

.terminal-clear:hover { color: var(--text-main); }

.terminal-body {
  padding: 12px;
  font-family: monospace;
  font-size: 12px;
  height: 110px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line { color: var(--text-muted); }
.log-line.text-success { color: var(--emerald-green); }
.log-line.text-error { color: var(--rose-red); }

/* Workspace Section */
.workspace-section {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  width: 320px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 13px;
  width: 100%;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filters-group select {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}

.view-mode-toggle {
  display: flex;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
}

.btn-icon.active {
  background: var(--primary-cyan);
  color: #0f172a;
}

/* Data Table */
.data-view-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
  border: 1px solid var(--border-glass);
}

.prod-title-cell {
  max-width: 300px;
}

.prod-name {
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

.prod-link {
  font-size: 11px;
  color: var(--primary-cyan);
  text-decoration: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-brand { background: rgba(129, 140, 248, 0.15); color: var(--secondary-indigo); }
.badge-category { background: rgba(56, 189, 248, 0.15); color: var(--primary-cyan); }
.badge-stock { background: rgba(16, 185, 129, 0.15); color: var(--emerald-green); }
.badge-out-stock { background: rgba(244, 63, 94, 0.15); color: var(--rose-red); }

.discount-pill {
  background: rgba(244, 63, 94, 0.2);
  color: var(--rose-red);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

/* Gallery Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
}

.card-img-wrap {
  height: 200px;
  position: relative;
  overflow: hidden;
  background: #0f172a;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-discount-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.card-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
}

.price-current {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-cyan);
}

.price-original {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: line-through;
}

/* Empty State */
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 40px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 900px;
  position: relative;
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
}

.modal-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

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

.main-img-wrap {
  height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.main-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-list {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
}

.thumb-list img {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border-glass);
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.modal-desc-box {
  background: rgba(15, 23, 42, 0.4);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.hidden { display: none !important; }
