/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #dbeafe;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: all 0.2s ease;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.8rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
p  { color: var(--text-secondary); }

/* ── Layout Utilities ─────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  width: 100%;
  transition: var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
input::placeholder { color: var(--text-muted); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: rgba(59,130,246,0.4); }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-blue  { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-amber { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-red   { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,23,42,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.navbar-brand { font-size: 20px; font-weight: 800; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.navbar-brand span { color: var(--accent); }
.navbar-links { display: flex; align-items: center; gap: 16px; }
.navbar-links a { color: var(--text-secondary); font-size: 14px; font-weight: 500; transition: var(--transition); }
.navbar-links a:hover { color: var(--text-primary); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59,130,246,0.15), transparent);
}
.hero h1 { font-size: 3.5rem; max-width: 700px; margin: 0 auto 24px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { font-size: 1.15rem; max-width: 520px; margin: 0 auto 40px; }
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ── Features ─────────────────────────────────────────────────────────────── */
.features { padding: 80px 0; }
.section-title { text-align: center; margin-bottom: 56px; }
.section-title h2 { margin-bottom: 12px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card { padding: 32px; }
.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 { margin-bottom: 8px; }

/* ── Pricing ──────────────────────────────────────────────────────────────── */
.pricing { padding: 80px 0; background: var(--bg-secondary); }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 700px; margin: 0 auto; }
.pricing-card { padding: 36px; position: relative; }
.pricing-card.popular { border-color: var(--accent); }
.popular-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 4px 16px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.price-amount { font-size: 3rem; font-weight: 800; color: var(--text-primary); }
.price-amount span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.price-features { list-style: none; margin: 24px 0; display: flex; flex-direction: column; gap: 10px; }
.price-features li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.price-features li::before { content: "✓"; color: var(--success); font-weight: 700; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal .tabs { display: flex; gap: 4px; background: var(--bg-input); border-radius: var(--radius); padding: 4px; margin-bottom: 24px; }
.modal .tab { flex: 1; text-align: center; padding: 8px; border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-muted); border: none; background: none; transition: var(--transition); }
.modal .tab.active { background: var(--accent); color: #fff; }
.modal .form-group + .form-group { margin-top: 16px; }
.modal .btn { margin-top: 20px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Dashboard Layout ─────────────────────────────────────────────────────── */
.dashboard-header { padding: 24px 0; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.dashboard-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.dashboard-header h1 { font-size: 1.6rem; }

.dashboard-grid { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; }

/* ── Add Product Panel ────────────────────────────────────────────────────── */
.add-product-panel { position: sticky; top: 88px; }
.add-product-panel .form-group + .form-group { margin-top: 14px; }
.add-product-panel .btn { margin-top: 16px; }
.scraping-indicator { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Product Cards ────────────────────────────────────────────────────────── */
.products-section h2 { margin-bottom: 20px; font-size: 1.2rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.products-list { display: flex; flex-direction: column; gap: 16px; }
.product-card { padding: 20px 24px; }
.product-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.product-name { font-size: 15px; font-weight: 600; color: var(--text-primary); flex: 1; }
.product-url { font-size: 12px; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
.product-card-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.stat-value.price-drop { color: var(--success); }
.stat-value.on-target  { color: var(--warning); }
.stat-value.null-price { color: var(--text-muted); font-size: 1rem; }
.product-card-footer { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.last-checked { font-size: 12px; color: var(--text-muted); }
.product-actions { display: flex; gap: 8px; }

/* Target price inline edit */
.target-edit { display: flex; gap: 6px; align-items: center; }
.target-edit input { width: 90px; padding: 4px 8px; font-size: 14px; }
.target-edit .btn-sm { padding: 4px 10px; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; }

/* ── Alerts Section ───────────────────────────────────────────────────────── */
.alerts-section { margin-top: 48px; }
.alerts-section h2 { margin-bottom: 20px; font-size: 1.2rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.alert-item .alert-name { font-size: 14px; font-weight: 600; }
.alert-item .alert-price { font-size: 16px; font-weight: 700; color: var(--success); }
.alert-item .alert-time  { font-size: 12px; color: var(--text-muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 32px 0; text-align: center; color: var(--text-muted); font-size: 14px; margin-top: 80px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .add-product-panel { position: static; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 2.2rem; }
  .product-card-body { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 2rem; }
}
