/* MarketScope Extension - Popup Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --border: #334155;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  width: 420px;
  min-height: 500px;
  max-height: 600px;
  overflow-y: auto;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

body::-webkit-scrollbar {
  width: 6px;
}
body::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  width: 32px;
  height: 32px;
  color: var(--accent-blue);
}

.header h1 {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* Badges */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-free { background: var(--bg-hover); color: var(--text-secondary); }
.badge-pro { background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; }
.badge-info { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--accent-yellow); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }

/* Sections */
.section {
  padding: 12px 16px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

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

.card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Input */
.input-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-group input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--accent-blue);
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #475569;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 14px;
  margin-top: 10px;
}

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

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

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

.stat-min .stat-value { color: var(--accent-green); }
.stat-max .stat-value { color: var(--accent-red); }
.stat-avg .stat-value { color: var(--accent-blue); }
.stat-median .stat-value { color: var(--accent-purple); }
.stat-count .stat-value { color: var(--accent-yellow); }
.stat-std .stat-value { color: var(--text-secondary); }

/* Chart Tabs */
.chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.chart-container {
  height: 200px;
  position: relative;
}

/* Product List */
.product-list {
  max-height: 250px;
  overflow-y: auto;
}

.product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

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

.product-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.product-info {
  flex: 1;
  margin: 0 10px;
  min-width: 0;
}

.product-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-store {
  font-size: 10px;
  color: var(--text-muted);
}

.product-price {
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-green);
  flex-shrink: 0;
}

/* AI Content */
.ai-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ai-price-card {
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.ai-price-card.entry { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); }
.ai-price-card.competitive { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); }
.ai-price-card.premium { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); }

.ai-price-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.ai-price-value {
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
}

.ai-price-card.entry .ai-price-value { color: var(--accent-green); }
.ai-price-card.competitive .ai-price-value { color: var(--accent-blue); }
.ai-price-card.premium .ai-price-value { color: var(--accent-yellow); }

.ai-risk {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: center;
}

.risk-low { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.risk-medium { background: rgba(245, 158, 11, 0.1); color: var(--accent-yellow); }
.risk-high { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

.ai-insights {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.ai-insights p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  padding-left: 12px;
  position: relative;
}

.ai-insights p::before {
  content: '💡';
  position: absolute;
  left: 0;
  font-size: 9px;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.action-buttons .btn { flex: 1; justify-content: center; }

/* Status text */
.status-text {
  font-size: 11px;
  margin-top: 6px;
}

.status-success { color: var(--accent-green); }
.status-error { color: var(--accent-red); }

.text-muted { color: var(--text-muted); font-size: 11px; }
.text-center { text-align: center; }

/* Footer */
.footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 10px;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-blue);
  text-decoration: none;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stats-grid, .card, .action-buttons {
  animation: fadeIn 0.3s ease;
}
