@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;900&family=Noto+Kufi+Arabic:wght@400;600;700&display=swap');

:root {
  --primary: #6366f1; /* Electric Indigo */
  --primary-glow: rgba(99, 102, 241, 0.3);
  --secondary: #10b981; /* Emerald Green */
  --secondary-glow: rgba(16, 185, 129, 0.2);
  --bg: #0b0b14; /* Deep Space Background */
  --card-bg: rgba(26, 26, 46, 0.45);
  --card-border: rgba(255, 255, 255, 0.06);
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --warning: #f59e0b;
  --font-en: 'Outfit', sans-serif;
  --font-ar: 'Noto Kufi Arabic', sans-serif;
}

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

body {
  font-family: var(--font-en);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Header */
header {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(11, 11, 20, 0.7);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-container p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 12px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--text);
  background: var(--card-bg);
  border-color: var(--card-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Main Container */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Catalog View */
.catalog-controls {
  backdrop-filter: blur(16px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrapper {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

.search-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.search-wrapper i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-select {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  cursor: pointer;
  min-width: 200px;
  transition: all 0.3s ease;
}

.filter-select:focus {
  border-color: var(--primary);
}

select option {
  background: #11111a;
  color: var(--text);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* Product Card */
.product-card {
  backdrop-filter: blur(12px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.product-image {
  height: 220px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-image img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

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

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.product-price-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(16, 185, 129, 0.9);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.product-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.product-names {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.name-en {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.name-ar {
  font-family: var(--font-ar);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: #a78bfa; /* Violet accent for Arabic */
  direction: rtl;
  text-align: right;
  margin-top: 4px;
}

.product-footer {
  border-top: 1px solid var(--card-border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.sku-tag {
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 11px;
}

/* Pagination */
.pagination {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.pag-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.pag-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.pag-info {
  font-size: 15px;
  color: var(--text-muted);
}

/* Operations Panel Layout */
.ops-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 32px;
}

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

/* Operations - Left (Console & Logs) */
.ops-console-card {
  backdrop-filter: blur(16px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e; /* Green for connected/live */
  box-shadow: 0 0 8px #22c55e;
}

.terminal-dot.paused {
  background: #eab308;
  box-shadow: 0 0 8px #eab308;
}

.terminal-dot.idle {
  background: #9ca3af;
  box-shadow: none;
}

.terminal-window {
  background: #050508;
  border-radius: 12px;
  height: 350px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.log-entry {
  line-height: 1.5;
}

.log-time {
  color: var(--text-muted);
  margin-right: 8px;
}

.log-level {
  font-weight: bold;
  margin-right: 8px;
}

.log-level.INFO { color: #10b981; }
.log-level.WARNING { color: #f59e0b; }
.log-level.ERROR { color: #ef4444; }

.log-text {
  color: #e5e7eb;
}

/* Operations - Right (Controls & Stats) */
.ops-panel-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ops-card {
  backdrop-filter: blur(16px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
}

.ops-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 10px;
}

/* Control Panel elements */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.field-group input, .field-group select {
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.field-group input:focus, .field-group select:focus {
  border-color: var(--primary);
}

.btn-group-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
}

.btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: #4f46e5;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--text-muted);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

/* Stats list */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.stat-value {
  font-size: 16px;
  font-weight: 700;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Notification Empty state */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.no-products i {
  font-size: 48px;
  color: var(--primary);
  opacity: 0.5;
}

/* Tab Badge */
.tab-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  display: inline-block;
  margin-left: 4px;
}

/* Conflicts Layout */
.conflicts-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 24px;
}

.conflict-item-card {
  backdrop-filter: blur(16px);
  background: var(--card-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 30px rgba(239, 68, 68, 0.03);
}

.conflict-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.conflict-sku-badge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 10px;
}

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

.conflict-comparison-row {
  display: grid;
  grid-template-columns: 1fr 50px 1fr;
  align-items: center;
  gap: 16px;
}

@media (max-width: 800px) {
  .conflict-comparison-row {
    grid-template-columns: 1fr;
  }
  .conflict-divider {
    transform: rotate(90deg);
    margin: 10px 0;
  }
}

.conflict-side-panel {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.conflict-side-panel.existing {
  border-color: rgba(16, 185, 129, 0.2);
}

.conflict-side-panel.skipped {
  border-color: rgba(99, 102, 241, 0.2);
}

.panel-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 6px;
  align-self: flex-start;
}

.panel-tag.existing {
  background: rgba(16, 185, 129, 0.1);
  color: var(--secondary);
}

.panel-tag.skipped {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.conflict-prod-details {
  display: flex;
  gap: 16px;
  align-items: center;
}

.conflict-prod-img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  object-fit: contain;
  border: 1px solid var(--card-border);
}

.conflict-prod-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conflict-prod-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.conflict-prod-name-ar {
  font-family: var(--font-ar);
  font-size: 12px;
  color: #a78bfa;
  margin-top: 2px;
  direction: rtl;
  text-align: right;
}

.conflict-prod-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
}

.conflict-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  font-weight: bold;
  font-size: 18px;
}

.conflict-actions-row {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--card-border);
  padding-top: 16px;
}
