/* dashboard/admin.css
 *
 * Shared minimal styles for the Admin Dashboard (Monitor + Experiences).
 * Token palette matches dashboard/index.html's existing inline <style>
 * exactly (same background/card/border colors, font stack, radii) so
 * Experiences reads as the same tool, not a redesign. index.html keeps its
 * own inline styles untouched and only pulls the nav/config-error rules
 * from here; experiences.html uses this file as its primary stylesheet.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f3ee;
  color: #2c2c2a;
  padding: 20px;
}

/* Experience operations additions */
.translation-tools { margin-bottom: 16px; }
.file-picker { cursor: pointer; }
.warning-note { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 10px; border-radius: 6px; }
.candidate-image { display: block; max-width: 360px; max-height: 220px; object-fit: cover; border-radius: 8px; margin-top: 12px; }
.offer-meta { display: grid; grid-template-columns: minmax(100px, auto) 1fr; gap: 6px 14px; }
.offer-meta dt { color: #64748b; font-size: 12px; }
.offer-meta dd { margin: 0; overflow-wrap: anywhere; }

/* === Shared top navigation === */
.admin-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.admin-nav-link {
  padding: 6px 14px;
  border: 1px solid #d3d1c7;
  border-radius: 6px;
  background: #fff;
  color: #5f5e5a;
  font-size: 13px;
  text-decoration: none;
  transition: all .15s;
}

.admin-nav-link:hover { border-color: #888; }

.admin-nav-link.active {
  background: #2c2c2a;
  color: #fff;
  border-color: #2c2c2a;
}

/* === Config error (fail-closed hostname state) === */
.config-error {
  max-width: 480px;
  margin: 80px auto;
  padding: 24px;
  background: #fff;
  border: 1px solid #e8e6e0;
  border-radius: 12px;
  text-align: center;
  color: #e24b4a;
  font-size: 14px;
}

/* === First-paint auth state (visible by default; hidden by admin-auth.js
   once restoreSession() resolves) === */
.auth-loading {
  max-width: 480px;
  margin: 80px auto;
  padding: 24px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* === Login overlay (shared markup/ids with index.html) ===
   No default `display` here — visibility is controlled entirely by
   admin-auth.js (via inline style), never by CSS, so there is nothing to
   flash on first paint before JS runs. The initial HTML must set
   style="display:none" on #login-overlay. */
.login-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); align-items: center; justify-content: center; z-index: 100; }
.login-box { background: #fff; padding: 32px; border-radius: 16px; width: 420px; }
.login-box h2 { margin-bottom: 16px; font-size: 17px; font-weight: 600; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #d3d1c7; border-radius: 8px; font-size: 14px; margin-bottom: 12px; font-family: monospace; }
.login-box button { width: 100%; padding: 10px; background: #2c2c2a; color: #fff; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; }
.login-box button:hover { background: #444; }
.login-box .hint { font-size: 12px; color: #888; margin-bottom: 16px; }

.status { font-size: 13px; color: #888; }
.status.ok { color: #1d9e75; }
.status.err { color: #e24b4a; }

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.header-right { display: flex; align-items: center; gap: 12px; }
h1 { font-size: 22px; font-weight: 600; }

/* === Experiences: filter bar === */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input[type="text"], .filter-bar select {
  padding: 7px 10px;
  border: 1px solid #d3d1c7;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: #2c2c2a;
}
.filter-bar input[type="text"] { min-width: 220px; }

.btn { padding: 7px 14px; border: 1px solid #d3d1c7; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; color: #2c2c2a; }
.btn:hover { border-color: #888; }
.btn-primary { background: #2c2c2a; color: #fff; border-color: #2c2c2a; }
.btn-primary:hover { background: #444; }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.btn:disabled:hover { border-color: #d3d1c7; }
.btn-primary:disabled:hover { background: #2c2c2a; border-color: #2c2c2a; }

/* === Tables/cards (same language as Monitor) === */
.table-card { background: #fff; border-radius: 12px; padding: 20px; border: 1px solid #e8e6e0; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 8px 12px; border-bottom: 2px solid #e8e6e0; color: #888; font-weight: 500; font-size: 12px; text-transform: uppercase; }
td { padding: 8px 12px; border-bottom: 1px solid #f0ede6; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #faf9f6; }

.empty-state { color: #bbb; font-size: 14px; padding: 20px 0; text-align: center; }

/* === Status badges/chips — color is never the only signal (also uses text) === */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; color: #fff; }
.badge.published { background: #1d9e75; }
.badge.draft { background: #888; }
.badge.inactive { background: #ba7517; }

.health { font-size: 13px; }
.health.healthy { color: #1d9e75; }
.health.needsreview, .health.needs_review { color: #e24b4a; }
.health.inactive { color: #888; }

.active-pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid #d3d1c7; color: #5f5e5a; }
.active-pill.on { border-color: #1d9e75; color: #1d9e75; }

/* === Experience detail/editor (Phase B) === */
.back-link { display: inline-block; font-size: 13px; color: #5f5e5a; text-decoration: none; margin-bottom: 12px; }
.back-link:hover { color: #2c2c2a; }

.editor-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.editor-header-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.editor-title { font-size: 19px; font-weight: 600; }
.section-card-title { margin-bottom: 14px; font-size: 18px; line-height: 1.25; font-weight: 600; letter-spacing: -.15px; color: #343432; }
.section-card-title.exposure-title { margin-bottom: 7px; }

.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.form-field input[type="text"], .form-field select, .form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d3d1c7;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: #2c2c2a;
  font-family: inherit;
}
.form-field textarea { resize: vertical; min-height: 60px; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.dirty-note { font-size: 12px; color: #ba7517; }

.inline-error { font-size: 13px; color: #e24b4a; margin-top: 6px; }
.inline-note { font-size: 12px; color: #888; margin-top: 4px; }
#flow-status { align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
#flow-status .btn { flex: 0 0 auto; }
.blocked-msg { font-size: 13px; color: #e24b4a; margin: 8px 0; display: none; }

.offer-card { border: 1px solid #e8e6e0; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.offer-card:last-child { margin-bottom: 0; }
.offer-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.offer-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; font-size: 13px; }
.offer-fields div span { color: #888; margin-right: 4px; }
.offer-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.offer-image-manager:empty { display: none; }
.offer-image-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e8e6e0; }
.offer-image-panel-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; color: #686762; }
.offer-image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.offer-image-candidate { min-width: 0; border: 1px solid #e0ded7; border-radius: 7px; padding: 7px; background: #faf9f6; }
.offer-image-candidate.is-selected { border-color: #5f7f68; box-shadow: 0 0 0 1px #5f7f68; }
.offer-image-candidate img { display: block; width: 100%; height: 105px; object-fit: cover; border-radius: 4px; background: #eceae4; }
.offer-image-candidate-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; min-height: 26px; }
.offer-image-footer { display: flex; justify-content: flex-end; margin-top: 10px; }
.page-error { max-width: 480px; margin: 80px auto; padding: 24px; background: #fff; border: 1px solid #e8e6e0; border-radius: 12px; text-align: center; color: #e24b4a; font-size: 14px; }

/* === Relations + Exposure (Phase C) — shared bits === */
.phase-c-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.phase-c-card { min-width: 0; overflow: visible; }
.phase-c-layout .table-card { margin-bottom: 20px; }
.empty-state-small { color: #bbb; font-size: 13px; padding: 6px 0 12px; }
.btn-small { padding: 3px 10px; font-size: 12px; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; background: #efece4; color: #5f5e5a; }

.add-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f0ede6; }
.add-form select { padding: 7px 10px; border: 1px solid #d3d1c7; border-radius: 6px; background: #fff; font-size: 13px; color: #2c2c2a; }

.inline-checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #2c2c2a; }
.inline-checkbox input { width: auto; }

/* === Relations === */
.relation-group { margin-bottom: 16px; }
.relation-group:last-of-type { margin-bottom: 0; }
.relation-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: #888; margin-bottom: 6px; }
.relation-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid #f0ede6; }
.relation-row:last-child { border-bottom: none; }
.relation-label { flex: 1; font-size: 14px; }
.relation-type { font-size: 12px; color: #888; background: #f5f3ee; padding: 2px 8px; border-radius: 4px; }

/* Relations target picker: three peer facets (City/Location/Quest) that
   mutually narrow each other — not a forced cascade, so all three sit in
   one row with equal weight. */
.relation-add-form { flex-direction: column; align-items: stretch; }
.facet-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.facet-row + .facet-row { margin-top: 12px; }
.facet-field { display: flex; flex-direction: column; gap: 3px; min-width: 160px; }
.facet-field label { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: #888; }
.facet-clear {
  border: 1px solid #d3d1c7; background: #fff; border-radius: 6px; color: #888;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px; line-height: 1;
  align-self: flex-end; margin-bottom: 1px;
}
.facet-clear:hover { border-color: #e24b4a; color: #e24b4a; }

/* === Exposure === */
.exposure-helper { color: #686762; font-size: 13px; line-height: 1.45; margin-bottom: 18px; }
.exposure-toggles { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.exposure-distances { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.exposure-distances.is-disabled { opacity: .65; }
.exposure-distances label, .exposure-select-field > span { font-size: 11px; color: #5f5e5a; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.exposure-distances input { display: block; width: 150px; margin-top: 5px; padding: 8px 10px; border: 1px solid #c5c2b9; border-radius: 6px; background: #fcfcfb; color: #2c2c2a; font-size: 13px; transition: border-color .15s, box-shadow .15s, background .15s; }
.exposure-pickers { display: flex; flex-direction: column; gap: 20px; }
.exposure-picker { min-width: 0; padding-top: 16px; border-top: 1px solid #f0ede6; }
.exposure-picker h3 { margin-bottom: 7px; font-size: 12px; color: #5f5e5a; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.exposure-selector-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.exposure-selector-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.exposure-selector-stack .exposure-selector-row { margin-top: 0; }
.exposure-select-field { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
.exposure-select-field select { width: 100%; min-width: 0; padding: 9px 30px 9px 10px; border: 1px solid #c5c2b9; border-radius: 6px; background-color: #fcfcfb; color: #2c2c2a; font-size: 13px; transition: border-color .15s, box-shadow .15s, background .15s; }
.exposure-select-field select:hover:not(:disabled), .exposure-distances input:hover { border-color: #9f9c93; background-color: #fff; }
.exposure-select-field select:focus, .exposure-distances input:focus { outline: none; border-color: #65635e; background-color: #fff; box-shadow: 0 0 0 3px rgba(95,94,90,.12); }
.exposure-select-field select:disabled, .exposure-distances input:disabled { border-color: #d8d6cf; background-color: #f4f3f0; color: #99968f; cursor: not-allowed; }
.exposure-add-btn { flex: 0 0 auto; min-width: 62px; }
.exposure-chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 28px; margin-top: 7px; }
.exposure-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 7px; border-radius: 999px; background: #efece4; color: #5f5e5a; font-size: 12px; }
.exposure-chip button { border: 0; background: transparent; color: #888; cursor: pointer; font-size: 15px; line-height: 1; }
.exposure-empty { color: #74726c; font-size: 12px; line-height: 1.4; padding: 4px 0; }

@media (max-width: 1050px) {
  .phase-c-layout { grid-template-columns: 1fr; gap: 0; }
}
