/* ── Reset & Base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f2f5; color: #222; }

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  background: #2c1a4a;
  color: white;
  padding: 16px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
header h1 { font-size: 20px; font-weight: 600; letter-spacing: 0.3px; }
header nav a {
  color: rgba(255,255,255,0.80);
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
  transition: color 0.2s;
}
header nav a:hover { color: #fff; }

/* ── Container ────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 30px auto; padding: 0 20px; }

/* ── Card ─────────────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

/* ── Toolbar ──────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar input[type=text] {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}
.toolbar input[type=text]:focus {
  outline: none;
  border-color: #6c3fa8;
  box-shadow: 0 0 0 3px rgba(108,63,168,0.10);
}
.count-label { font-size: 13px; color: #888; white-space: nowrap; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  padding: 9px 18px;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-save {
  background: #6c3fa8;
  color: white;
  white-space: nowrap;
}
.btn-save:hover:not(:disabled) { background: #572f8a; }

.btn-secondary {
  background: #eee;
  color: #444;
}
.btn-secondary:hover { background: #ddd; }

/* ── Table ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
  border-bottom: 2px solid #f0f0f0;
  white-space: nowrap;
}
tbody tr:hover { background: #faf8ff; }
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f4f4f4;
  vertical-align: middle;
}

.sku-cell { font-family: monospace; font-size: 13px; color: #666; }
.name-cell { max-width: 340px; }

/* ── Inline inputs ────────────────────────────────────────────────────── */
.inline-input {
  width: 100px;
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.18s;
}
.inline-input:focus {
  outline: none;
  border-color: #6c3fa8;
  box-shadow: 0 0 0 3px rgba(108,63,168,0.10);
}

/* ── Save status ──────────────────────────────────────────────────────── */
.save-status {
  font-size: 13px;
  margin-left: 8px;
  white-space: nowrap;
}
.save-ok  { color: #27ae60; font-weight: 600; }
.save-err { color: #e74c3c; font-weight: 600; }

/* ── Badge ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-info { background: #eef2ff; color: #4a6fa5; }

/* ── Loading ──────────────────────────────────────────────────────────── */
.loading-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  color: #666;
  font-size: 14px;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid #ddd;
  border-top-color: #6c3fa8;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alert ────────────────────────────────────────────────────────────── */
.alert-error {
  background: #fdf2f2;
  border: 1px solid #f5c6cb;
  color: #c0392b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Login page ───────────────────────────────────────────────────────── */
body.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f0f2f5;
}
.login-card {
  background: white;
  border-radius: 14px;
  width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  overflow: hidden;
}
.login-header {
  background: #2c1a4a;
  padding: 30px 40px 22px;
  text-align: center;
}
.login-header h1 { color: white; font-size: 26px; }
.login-header p  { color: rgba(255,255,255,0.70); font-size: 13px; margin-top: 6px; }
.login-body-inner { padding: 30px 36px 36px; }
.login-body-inner input[type=password] {
  width: 100%; padding: 12px 14px;
  border: 1px solid #ddd; border-radius: 8px;
  font-size: 15px; margin-bottom: 14px;
}
.login-body-inner input[type=password]:focus {
  outline: none; border-color: #6c3fa8;
  box-shadow: 0 0 0 3px rgba(108,63,168,0.10);
}
.login-body-inner button {
  width: 100%; background: #6c3fa8; color: white;
  border: none; padding: 13px; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.login-body-inner button:hover { background: #572f8a; }
.error { color: #e74c3c; font-size: 13px; margin-bottom: 12px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 12px 16px; }
  header h1 { font-size: 16px; }
  .container { margin: 16px auto; padding: 0 10px; }
  .card { padding: 16px 12px; }
  .name-cell { max-width: 180px; }
  .inline-input { width: 80px; }
}

/* Groupes de produits */
tr.group-header td {
  background: #2c1a4a;
  color: #fff;
  font-weight: 700;
  font-size: 0.95em;
  padding: 10px 14px;
  letter-spacing: 0.03em;
}
.group-count {
  font-weight: 400;
  opacity: 0.7;
  font-size: 0.9em;
}
