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

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --accent: #f59e0b;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* Navigation */
nav {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

nav .logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

nav .nav-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
nav .nav-links a { color: var(--text); font-size: 0.9rem; font-weight: 500; }
nav .nav-links a:hover { color: var(--primary); text-decoration: none; }
nav .nav-links a.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; opacity: 0.9; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--text-light); font-size: 0.9rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #d97706; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

/* Products */
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-img {
  height: 200px;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.product-info { padding: 1rem; }
.product-info h3 { margin-bottom: 0.25rem; }
.product-price { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin: 0.5rem 0; }
.product-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* Sections */
section { margin: 3rem 0; }
section h2 { font-size: 1.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }

/* Event Log Panel */
.event-log {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 400px;
  max-height: 300px;
  background: #1e1e2e;
  color: #cdd6f4;
  border-top-left-radius: var(--radius);
  box-shadow: -2px -2px 10px rgba(0,0,0,0.2);
  z-index: 999;
  display: flex;
  flex-direction: column;
}
.event-log-header {
  padding: 0.5rem 1rem;
  background: #313244;
  font-weight: 600;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: var(--radius);
  cursor: pointer;
}
.event-log-body {
  overflow-y: auto;
  padding: 0.5rem;
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
}
.event-log-body .event-item {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid #313244;
}
.event-log-body .event-type { color: #89b4fa; font-weight: 600; }
.event-log-body .event-time { color: #6c7086; margin-right: 0.5rem; }
.event-log-body .event-detail { color: #a6adc8; }
.event-log.collapsed .event-log-body { display: none; }

/* Cart */
.cart-badge {
  position: relative;
  display: inline-block;
}
.cart-badge .count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Long content for scroll testing */
.long-content { min-height: 200vh; }
.scroll-marker {
  padding: 1rem;
  margin: 2rem 0;
  background: #e0e7ff;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
}

/* Checkout */
.checkout-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.checkout-step {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  background: var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.85rem;
}
.checkout-step.active { background: var(--primary); color: white; }
.checkout-step.completed { background: var(--success); color: white; }

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 320px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  animation: slideIn 0.3s ease;
  display: none;
}
.toast.show { display: block; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
