/* CN-Probes Beheer - styling */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  background: #f5f5f5;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---- Login overlay ---- */
.login-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
  z-index: 100;
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  max-width: 400px;
  text-align: center;
}
.login-card h1 { margin: 0 0 16px 0; font-size: 22px; color: #333; }
.login-card p { margin: 0 0 24px 0; color: #666; }
.error-message {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 12px;
  border-radius: 4px;
  margin-top: 16px;
  font-size: 13px;
}

/* ---- Header & tabs ---- */
header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.header-content {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px;
}
.header-content h1 { margin: 0; font-size: 18px; font-weight: 700; color: #2C8BBF; }
.user-info {
  display: flex; gap: 12px; align-items: center;
  font-size: 13px; color: #555;
}
.tabs { display: flex; gap: 2px; padding: 0 24px; background: #fafafa; }
.tab-button {
  background: none; border: none;
  padding: 10px 18px; cursor: pointer;
  font-size: 14px; color: #555;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tab-button:hover { color: #0078d4; }
.tab-button.active {
  color: #0078d4;
  border-bottom-color: #0078d4;
  font-weight: 600;
}

/* ---- Main ---- */
main { padding: 24px; max-width: 1800px; margin: 0 auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex; gap: 12px; margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input[type=search] {
  flex: 1; min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #ccc; border-radius: 4px;
  font-size: 14px;
}
.toolbar select {
  padding: 8px 12px;
  border: 1px solid #ccc; border-radius: 4px;
  font-size: 14px; background: #fff;
}
.status-bar { margin-bottom: 8px; color: #666; font-size: 13px; }

/* ---- Table ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-radius: 4px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
th {
  background: #fafafa;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
}
tr:last-child td { border-bottom: none; }
tr:hover { background: #fafbff; }
td.loading, td.error { text-align: center; padding: 32px; color: #888; }
td.error { color: #c00; }
td.actions { white-space: nowrap; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* ---- Badges ---- */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-badge { background: #eee; color: #555; }
.status-ok   { background: #dcfce7; color: #166534; }
.status-warn { background: #fef3c7; color: #92400e; }
.status-bad  { background: #fee2e2; color: #991b1b; }

/* ---- Forms ---- */
.form-card {
  background: #fff;
  padding: 24px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  max-width: 640px;
}
.form-card h2 { margin: 0 0 4px 0; font-size: 18px; }
.form-card .help { color: #666; margin: 0 0 20px 0; font-size: 13px; }
form label { display: block; margin-bottom: 14px; }
form label > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
form label small { font-weight: normal; color: #888; }
form input[type=text], form select {
  width: 100%; padding: 8px 12px;
  border: 1px solid #ccc; border-radius: 4px;
  font-size: 14px; font-family: inherit;
}
form input:focus, form select:focus {
  outline: none; border-color: #0078d4;
  box-shadow: 0 0 0 2px rgba(0,120,212,0.2);
}
form small { display: block; margin-top: 4px; font-size: 12px; color: #888; }
form fieldset {
  margin: 16px 0; padding: 12px 16px;
  border: 1px solid #ddd; border-radius: 4px;
}
form legend { font-weight: 600; font-size: 13px; padding: 0 6px; color: #555; }
.form-actions { margin-top: 20px; display: flex; gap: 8px; }

/* ---- Buttons ---- */
button { cursor: pointer; border-radius: 4px; font-family: inherit; font-size: 14px; }
.btn-primary {
  background: #0078d4; color: white;
  border: 1px solid #0078d4; padding: 8px 18px; font-weight: 500;
}
.btn-primary:hover { background: #106ebe; }
.btn-secondary {
  background: #fff; color: #333;
  border: 1px solid #ccc; padding: 8px 16px;
}
.btn-secondary:hover { background: #f5f5f5; }
.btn-danger {
  background: #d83b01; color: white;
  border: 1px solid #d83b01; padding: 8px 16px;
}
.btn-danger:hover { background: #a52e02; }
.btn-small {
  padding: 4px 10px; font-size: 12px;
  background: #fff; border: 1px solid #ccc;
  margin-right: 4px;
}
.btn-small:hover { background: #f0f0f0; }
.btn-danger-outline { color: #d83b01; border-color: #d83b01; }
.btn-danger-outline:hover { background: #fee; }

/* ---- Result cards ---- */
.success-card, .error-card {
  margin-top: 20px;
  padding: 16px;
  border-radius: 4px;
}
.success-card { background: #f0fdf4; border: 1px solid #86efac; }
.success-card h3 { margin: 0 0 12px 0; color: #166534; font-size: 15px; }
.success-card dl {
  margin: 0; display: grid;
  grid-template-columns: 180px 1fr; gap: 8px 16px;
}
.success-card dt { font-weight: 600; color: #555; }
.success-card dd { margin: 0; word-break: break-all; }
.success-card .secret {
  display: inline-block; word-break: break-all;
  background: #fff; border: 1px solid #ccc;
  padding: 4px 8px; margin-right: 4px; max-width: 100%;
}
.success-card .warning {
  margin: 12px 0 0 0; padding: 8px;
  background: #fef3c7; border-left: 3px solid #f59e0b;
  font-size: 12px; color: #92400e;
}
.error-card {
  background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b;
}

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: #fff; padding: 24px; border-radius: 6px;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-content h3 { margin: 0 0 8px 0; }
.modal-content p { margin: 0 0 20px 0; color: #444; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- Export-vinklijst modal ---- */
.export-modal-content { max-width: 640px; width: 90%; }
.export-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.export-toolbar input[type="search"] {
  flex: 1; max-width: 280px; padding: 6px 10px;
  border: 1px solid #ccc; border-radius: 6px;
}
.export-list {
  max-height: 360px; overflow-y: auto;
  border: 1px solid #e0e0e0; border-radius: 6px; margin-bottom: 16px;
}
.export-row {
  display: grid; grid-template-columns: 24px 1fr 1fr auto;
  align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer;
}
.export-row:last-child { border-bottom: none; }
.export-row:hover { background: #f7f9fc; }
.export-date { color: #777; font-size: 0.85em; white-space: nowrap; }
.export-customer { color: #444; overflow: hidden; text-overflow: ellipsis; }

/* ---- Inventory-sync resultaat + inline veld ---- */
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; }
.result-success, .result-error, .result-info {
  margin-top: 16px; padding: 12px 16px; border-radius: 8px; font-size: 14px;
}
.result-success { background: #eafaf0; border: 1px solid #59DB8F; color: #1c6b3f; }
.result-error   { background: #fdecec; border: 1px solid #E45959; color: #8a2020; }
.result-info    { background: #eef4fc; border: 1px solid #9ec3ee; color: #2c5a8a; }
.result-warn    { color: #8a5a00; }

/* Toelichtingstekst bij formuliervelden */
.hint { font-size: 13px; color: #666; margin: 0 0 12px 0; line-height: 1.5; }
.hint strong { color: #444; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column; gap: 8px;
    align-items: flex-start; padding: 12px 16px;
  }
  main { padding: 16px; }
  .tabs { padding: 0 16px; }
  th, td { padding: 8px 6px; font-size: 13px; }
  td.actions button { margin-bottom: 2px; }
  .success-card dl { grid-template-columns: 1fr; }
  .login-card { margin: 20px; padding: 24px; }
}

/* --- Forti-blokken op het toewijzen-formulier --- */
.forti-block {
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 12px 16px 4px;
  margin: 16px 0;
}
.forti-block legend {
  padding: 0 6px;
  font-weight: 600;
}
.forti-block .toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
}
.forti-block .toggle.inline {
  font-weight: 400;
  margin: 4px 0 8px;
}
.forti-block .toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.forti-block .toggle span { user-select: none; }

/* --- Live naam-preview op het toewijzen-formulier --- */
.name-preview {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0 16px;
  font-size: 0.9em;
}
.name-preview ul { margin: 6px 0 0; padding-left: 18px; }
.name-preview li { margin: 2px 0; }
.name-preview code { background: #fff; padding: 1px 5px; border-radius: 4px; }

/* --- Klant-dropdown met ververs-knop --- */
.customer-row { display: flex; gap: 8px; align-items: stretch; }
.customer-row select { flex: 1; }
.customer-row .btn-small { flex: 0 0 auto; padding: 0 12px; font-size: 1.1em; }
.muted { color: #57606a; }

/* --- Melding bij her-toewijzen van een al-actieve probe --- */
.reassign-notice {
  background: #fff8e1;
  border: 1px solid #f0d488;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 0.9em;
}

/* --- Sorteerbare tabelkoppen --- */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: rgba(44, 139, 191, 0.12); }
