/* ================================================================
   Admin panel styles
   ================================================================ */

/* admin.html laadt styles.css + shell.css mee (voor consistente CSS-vars).
   Die bestanden zetten body { height:100vh; display:flex; overflow:hidden }
   voor de modeller-canvas. Op admin-pagina willen we juist gewoon scrollen —
   we resetten body terug naar normaal block-gedrag. !important is nodig omdat
   shell.css ook !important gebruikt. */
html:has(body.admin-body) {
  height: auto !important;
  overflow: visible !important;
}
body.admin-body {
  font-family: 'Outfit', -apple-system, system-ui, sans-serif;
  background: #f8fafc;
  color: #111827;
  margin: 0;
  min-height: 100vh;
  height: auto !important;
  display: block !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-topbar-left {
  display: flex; align-items: center; gap: 12px;
}
.admin-logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: #111827; color: #fbbf24;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.admin-topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.admin-subtitle { color: #6b7280; font-size: 12px; background: #fef3c7; padding: 2px 8px; border-radius: 4px; }
.admin-topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-backlink { color: #3D2EFF; text-decoration: none; font-size: 14px; }
.admin-backlink:hover { text-decoration: underline; }
.admin-user { font-size: 14px; color: #374151; }

.admin-main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
}

.admin-loading, .admin-unauth {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 48px; text-align: center;
}
.admin-unauth h2 { margin-top: 0; }
.admin-muted { color: #6b7280; font-size: 13px; }

.admin-header-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.admin-header-row h2 { margin: 0; font-size: 24px; }
.admin-hint { color: #6b7280; margin: 0 0 20px; font-size: 13px; }
.admin-hint code {
  background: #f3f4f6; padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
}

.admin-org-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.admin-org-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.admin-org-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.admin-org-card-header {
  display: flex; align-items: center; gap: 12px;
}
.admin-org-avatar {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 18px;
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.admin-org-name { font-size: 16px; font-weight: 600; }
.admin-org-slug { font-size: 12px; color: #6b7280; font-family: ui-monospace, Consolas, monospace; }
.admin-org-meta { font-size: 12px; color: #6b7280; display: flex; gap: 8px; flex-wrap: wrap; }
.admin-org-meta span {
  background: #f3f4f6; padding: 2px 8px; border-radius: 4px;
}
.admin-org-actions {
  display: flex; gap: 6px; margin-top: auto; padding-top: 12px;
  border-top: 1px solid #f3f4f6; align-items: center;
}
.admin-org-action {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: #3D2EFF; text-decoration: none;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  padding: 6px 10px; border-radius: 6px; font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.admin-org-action svg { flex-shrink: 0; }
.admin-org-action:hover {
  background: #EEF2FF; border-color: #C7D2FE; text-decoration: none;
}
.admin-org-action-danger {
  color: #9ca3af; margin-left: auto;
}
.admin-org-action-danger:hover {
  color: #dc2626; background: #fef2f2; border-color: #fecaca;
}

/* Modal */
.admin-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.admin-modal.hidden { display: none; }
.admin-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}
.admin-modal-content {
  position: relative;
  background: #fff;
  border-radius: 14px;
  width: min(960px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.admin-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-modal-header h2 { margin: 0; font-size: 20px; }
.admin-modal-close {
  background: transparent; border: none; font-size: 26px; cursor: pointer;
  color: #6b7280;
}
.admin-modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

/* Tabs inside modal */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafbfc;
}
.admin-tab {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.admin-tab:hover { color: #374151; }
.admin-tab.active {
  color: #3D2EFF;
  border-bottom-color: #3D2EFF;
}
.admin-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-tab-pane {
  display: grid;
  grid-template-columns: 320px 1fr;
}
.admin-tab-pane.hidden { display: none; }
@media (max-width: 800px) {
  .admin-tab-pane { grid-template-columns: 1fr; }
}

/* Members tab */
.admin-members-pane {
  padding: 24px;
  grid-column: 1 / -1;  /* spans both columns when only this pane is visible */
}
.admin-members-section {
  margin-bottom: 28px;
}
.admin-members-section h3 {
  font-size: 14px; margin: 0 0 6px;
  color: #374151; text-transform: uppercase; letter-spacing: 0.04em;
}
.admin-invite-row {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 8px;
  margin-top: 12px;
}
.admin-invite-row input,
.admin-invite-row select {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.admin-invite-row button {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .admin-invite-row { grid-template-columns: 1fr; }
}

.admin-members-list,
.admin-invitations-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-member-row,
.admin-invitation-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
}
.admin-member-email { font-weight: 500; color: #111827; word-break: break-all; }
.admin-member-meta { font-size: 11px; color: #6b7280; }
.admin-invitation-row .admin-member-email { font-style: italic; color: #4b5563; }
.admin-role-select {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
}
.admin-row-action {
  background: transparent;
  border: none;
  color: #b91c1c;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
}
.admin-row-action:hover { text-decoration: underline; }
.admin-row-action.neutral { color: #3D2EFF; }

/* Preview */
.admin-preview {
  background: #f8fafc;
  border-right: 1px solid #e5e7eb;
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0;
}
.admin-preview-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #6b7280;
}
.admin-preview-topbar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
}
.admin-preview-logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--pv-primary, #3D2EFF);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.admin-preview-app-name { font-weight: 600; font-size: 13px; }
.admin-preview-sub { font-size: 11px; color: #6b7280; }
.admin-preview-buttons {
  display: flex; gap: 8px;
}
.admin-preview-primary {
  background: var(--pv-primary, #3D2EFF);
  color: #fff; border: none; padding: 8px 16px; border-radius: 8px; cursor: default;
  font-family: inherit; font-size: 12px;
}
.admin-preview-accent {
  background: var(--pv-accent, #00D959);
  color: #111827; border: none; padding: 8px 16px; border-radius: 8px; cursor: default;
  font-family: inherit; font-size: 12px;
}
.admin-preview-url {
  font-size: 11px; color: #6b7280; word-break: break-all;
}
.admin-preview-url code {
  background: #fff; padding: 4px 6px; border-radius: 4px;
  border: 1px solid #e5e7eb; font-size: 11px;
}

/* Form */
.admin-form {
  padding: 20px 24px;
  overflow: auto;
}
.admin-form-section {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e7eb;
}
.admin-form-section h3 {
  font-size: 14px; margin: 0 0 14px; color: #374151; text-transform: uppercase; letter-spacing: 0.04em;
}
.admin-form-row {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 14px;
}
.admin-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: #374151;
}
.admin-form label span:first-child { font-weight: 500; }
.admin-form-wide { grid-column: 1 / -1; }
.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="url"],
.admin-form select,
.admin-form textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.admin-form input[type="color"] {
  height: 38px; width: 100%; padding: 2px; cursor: pointer;
  border: 1px solid #d1d5db; border-radius: 6px;
}
.admin-form input[type="file"] {
  font-size: 12px;
}
.admin-form small { color: #6b7280; font-size: 11px; }

.admin-modal-footer {
  border-top: 1px solid #e5e7eb;
  padding: 14px 24px;
  margin: 20px -24px -20px;   /* strek tot aan de modal-rand, overschrijf form-padding */
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky;
  bottom: -20px;              /* compenseer de negatieve margin zodat hij écht onderaan plakt */
  background: #fff;
  z-index: 2;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.04);
}
.btn-primary, .btn-secondary, .btn-danger {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.btn-primary { background: #3D2EFF; color: #fff; }
.btn-primary:hover { background: #2418D6; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-secondary { background: #f3f4f6; color: #111827; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.hidden { display: none !important; }

/* Toast */
/* AI scan box */
.ai-scan-box {
  background: linear-gradient(135deg, #eff6ff 0%, #faf5ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.ai-scan-header {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 10px;
}
.ai-scan-icon { font-size: 20px; line-height: 1; }
.ai-scan-title {
  font-weight: 600; font-size: 13px; color: #3730a3;
  margin-bottom: 2px;
}
.ai-scan-sub { font-size: 12px; color: #4b5563; line-height: 1.4; }
.ai-scan-row {
  display: flex; gap: 8px;
}
.ai-scan-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.ai-scan-row input:focus {
  outline: none; border-color: #6366f1;
}
.ai-scan-row button {
  white-space: nowrap;
}
.ai-scan-row button:disabled {
  opacity: 0.6; cursor: progress;
}
/* Onderscheidende stijl voor de scan-knop zodat gebruikers 'm niet
   verwarren met de Opslaan-knop (beide primary waren misleidend). */
.btn-ai-scan-go {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ai-scan-go:hover { filter: brightness(1.08); }
.btn-ai-scan-go:disabled { opacity: 0.6; cursor: progress; }
.ai-scan-status {
  font-size: 12px; color: #4b5563;
  margin-top: 8px; min-height: 16px;
}
.ai-scan-status.success { color: #047857; }
.ai-scan-status.error { color: #b91c1c; }
.ai-scan-status .tone-note {
  display: block; font-style: italic; color: #6b7280; margin-top: 4px;
}

.admin-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 2000;
}
.admin-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.admin-toast.error { background: #b91c1c; }
.admin-toast.ok { background: #047857; }

/* ================================================================
   AI Brand Scanner v2 — uitgebreide branding-velden (chunk 3)
   ================================================================ */

/* Sub-sectie binnen het branding-form (Kleurpalet, Vorm en sfeer) */
.admin-form-section-sub {
  margin-top: 18px;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.admin-form-section-sub h4 {
  font-size: 12px;
  margin: 0 0 4px;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.admin-form-section-sub p.admin-muted {
  margin: 0 0 12px;
  font-size: 12px;
}

/* Kleur-grid: 7 pickers passen netjes in een responsive grid */
.admin-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.admin-color-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}

/* Range-slider voor border-radius */
.admin-form input[type="range"] {
  width: 100%;
  accent-color: #3D2EFF;
  cursor: pointer;
}
#theme-borderRadius-out {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #3D2EFF;
  margin-left: 4px;
}

/* Tweak-balk: verschijnt 60s na succesvolle scan onderaan het form,
   net boven de modal-footer. Sticky zodat hij in beeld blijft. */
.admin-tweak-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px -24px 0;
  padding: 12px 24px;
  background: linear-gradient(90deg, #ecfdf5 0%, #eff6ff 100%);
  border-top: 1px solid #a7f3d0;
  border-bottom: 1px solid #a7f3d0;
  position: sticky;
  bottom: 60px;     /* boven de footer (54px hoog + 6px lucht) */
  z-index: 3;
  animation: tweakSlideIn 0.25s ease-out;
}
@keyframes tweakSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.admin-tweak-message {
  flex: 1;
  font-size: 13px;
  color: #064e3b;
  line-height: 1.4;
}
.admin-tweak-message strong { color: #047857; margin-right: 4px; }
.admin-tweak-bar .btn-primary,
.admin-tweak-bar .btn-secondary {
  flex-shrink: 0;
}

/* Slug-input met unlock-knop ernaast */
.admin-slug-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.admin-slug-row input { flex: 1; }
.admin-slug-unlock {
  flex-shrink: 0;
  padding: 6px 12px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  white-space: nowrap;
}
.admin-slug-unlock:hover {
  background: #fde68a;
}
