:root {
  --primary: #009ee3;
  --primary-dark: #007bbf;
  --accent: #ffe600;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-muted: #666666;
  --border: #e0e0e0;
  --danger: #e53935;
  --success: #43a047;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

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

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

header .logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
  letter-spacing: -0.5px;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.9rem;
  opacity: 0.9;
}

header nav a:hover { opacity: 1; text-decoration: underline; }

/* Main layout */
main {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
}

h1 { font-size: 1.8rem; margin-bottom: 8px; }
h2 { font-size: 1.4rem; margin-bottom: 16px; color: var(--text); }

/* Category filter tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.category-tab {
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.category-tab:hover, .category-tab.active {
  background: var(--primary);
  color: white;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #f8f8f8;
  padding: 12px;
}

.product-card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
}

.product-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  flex: 1;
}

.product-card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Product detail page */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.product-detail img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  background: #f8f8f8;
  border-radius: var(--radius);
  padding: 16px;
}

.product-detail-info { display: flex; flex-direction: column; gap: 14px; }
.product-detail-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  font-weight: 700;
}
.product-detail-name { font-size: 1.6rem; font-weight: 700; }
.product-detail-price { font-size: 2rem; font-weight: 700; color: var(--primary-dark); }
.product-detail-desc { color: var(--text-muted); font-size: 0.95rem; }
.product-detail-stock { font-size: 0.875rem; color: var(--text-muted); }

.badge-agentic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  border: none;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-back {
  color: var(--primary);
  background: transparent;
  border: 2px solid var(--primary);
  padding: 8px 18px;
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: inline-block;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.btn-back:hover { background: var(--primary); color: white; }

/* Admin styles */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.admin-table {
  width: 100%;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-collapse: collapse;
  overflow: hidden;
}

.admin-table th {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f0f7ff; }

.toggle-agentic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.toggle-agentic.enabled {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.toggle-agentic.disabled {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.toggle-agentic:hover { opacity: 0.8; }

/* Login form */
.login-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-card h2 { text-align: center; margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.875rem; }
.alert-error { background: #fce4ec; color: var(--danger); border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; }

/* Page title area */
.page-hero {
  margin-bottom: 28px;
}

.page-hero p { color: var(--text-muted); margin-top: 4px; }

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 48px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  .product-detail {
    grid-template-columns: 1fr;
  }
  header { padding: 0 16px; }
  main { padding: 0 16px; margin: 20px auto; }
  .admin-table { display: block; overflow-x: auto; }
}

/* Agentic MP column icon */
.icon-check { color: var(--success); font-size: 1.1rem; }
.icon-cross { color: var(--danger); font-size: 1.1rem; }
