:root {
  --bg: #0f0f1a;
  --card: #1a1a2e;
  --border: #333;
  --text: #e0e0e0;
  --muted: #888;
  --primary: #4f46e5;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
}

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

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

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  z-index: 100;
}

/* Animated gradient bar on the left edge of sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(
    180deg,
    #4f46e5,
    #9333ea,
    #ec4899,
    #f43f5e,
    #f97316,
    #fbbf24,
    #84cc16,
    #22c55e,
    #14b8a6,
    #06b6d4,
    #3b82f6,
    #4f46e5
  );
  background-size: 100% 400%;
  animation: gradientFlow 15s ease infinite;
}

@keyframes gradientFlow {
  0%, 100% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 0% 100%;
  }
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: none;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.nav-links {
  list-style: none;
  padding: 9px 0 15px 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 12px 30px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.nav-links a.active {
  color: #fff;
  background: rgba(79, 70, 229, 0.2);
  border-right: 2px solid var(--primary);
}

.nav-links li.divider {
  border-top: 1px solid var(--border);
  margin: 15px 30px;
  padding: 0;
}

/* Lucide icon styling in nav */
.nav-links a i,
.nav-links a [data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
  flex-shrink: 0;
}

.icon { font-size: 18px; }

/* Main Content */
main {
  padding: 20px;
}

main.with-sidebar {
  margin-left: 220px;
}

/* Container for full-width pages using Shopify nav */
main.container,
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 28px;
  color: #fff;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  display: block;
  margin-bottom: 10px;
}

.back-link:hover { color: #fff; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 16px 32px; font-size: 18px; }
.btn-secondary { background: var(--card); border: 1px solid var(--border); }

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

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

.card-header h2 {
  font-size: 16px;
  color: #fff;
}

.card-body { padding: 20px; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

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

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  color: var(--muted);
  margin-top: 5px;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}

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

.data-table a {
  color: var(--primary);
  text-decoration: none;
}

.data-table a:hover { text-decoration: underline; }

.view-link {
  color: var(--muted);
  font-size: 12px;
}

.view-link:hover {
  color: var(--primary);
}

/* Score Badge */
.score-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.score-badge.excellent { background: #166534; color: var(--success); }
.score-badge.good { background: #1e3a5f; color: #60a5fa; }
.score-badge.needs-work { background: #854d0e; color: var(--warning); }
.score-badge.poor { background: #991b1b; color: var(--error); }

/* Issues */
.issue-item {
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 3px solid var(--error);
}

.issue-item p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.issue-item .rec {
  color: var(--success);
  background: rgba(74,222,128,0.1);
  padding: 8px;
  border-radius: 4px;
  margin-top: 8px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 8px;
  text-transform: uppercase;
}

.badge.high { background: #991b1b; color: var(--error); }
.badge.medium { background: #854d0e; color: var(--warning); }
.badge.low { background: #1e3a5f; color: #60a5fa; }

/* Score badges with color coding */
.score-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}
.score-badge.good { background: rgba(74,222,128,0.2); color: #4ade80; }
.score-badge.warning, .score-badge.medium { background: rgba(251,191,36,0.2); color: #fbbf24; }
.score-badge.poor { background: rgba(248,113,113,0.2); color: #f87171; }
.score-badge.none { background: rgba(136,136,136,0.1); color: #888; }

/* Alerts */
.alert-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.alert-item.unread { background: rgba(79,70,229,0.1); }
.alert-item strong { color: #fff; }
.alert-item p { color: var(--muted); margin: 5px 0; }
.alert-item small { color: var(--muted); }

/* Forms */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-weight: 500;
}

.form-group input,
.form-group select {
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  max-width: 400px;
}

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

.search-input {
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

/* Product Detail */
.score-section {
  text-align: center;
  padding: 30px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.big-score {
  font-size: 72px;
  font-weight: 700;
  color: var(--success);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

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

/* Landing Page */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.hero {
  text-align: center;
  padding: 60px;
}

.hero h1 {
  font-size: 48px;
  color: #fff;
  margin-bottom: 20px;
}

.hero p {
  font-size: 20px;
  color: var(--muted);
  margin-bottom: 30px;
}

/* Error Pages */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

.error-page h1 {
  font-size: 72px;
  color: #fff;
  margin-bottom: 20px;
}

.error-page p {
  color: var(--muted);
  margin-bottom: 30px;
}

.error-page a {
  color: var(--primary);
}

/* Charts Layout */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  min-height: 280px;
}

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

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 10px;
}

.page-header {
  flex-wrap: wrap;
  gap: 15px;
}

/* Responsive */
@media (max-width: 1200px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  main.with-sidebar { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .header-actions { 
    width: 100%;
    flex-wrap: wrap;
  }
  .header-actions .btn {
    flex: 1;
    min-width: 120px;
  }
}

/* Active nav item */
.nav-links li a.active,
.nav-links li a[data-active="true"] {
  background: rgba(79, 70, 229, 0.2);
  color: #fff;
  border-left: 3px solid var(--primary);
  padding-left: 27px;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active {
  display: flex;
}
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 25px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-size: 18px;
  color: #fff;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: #fff;
}

/* Floating Progress Widget */
.floating-progress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 20px;
  min-width: 280px;
  max-width: 350px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  z-index: 9999;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.floating-progress.hiding {
  animation: slideOut 0.3s ease forwards;
}
@keyframes slideOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(100px); opacity: 0; }
}
.floating-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.floating-progress-title {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}
.floating-progress-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.floating-progress-close:hover {
  color: #fff;
}
.floating-progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.floating-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #9333ea);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.floating-progress-status {
  font-size: 12px;
  color: var(--muted);
}
.floating-progress-status.success {
  color: #4ade80;
}
.floating-progress-status.error {
  color: #f87171;
}
