/* Koley Jessen Brand Colors */
:root {
  --kj-blue:       #0065A4;
  --kj-teal:       #00B2B2;
  --kj-lgray:      #BBBCBC;
  --kj-orange:     #ECA154;
  --kj-lblue:      #62B5E5;
  --kj-softblue:   #9BB8D3;
  --kj-dgray:      #666666;
  --kj-white:      #FFFFFF;
  --kj-bg:         #F5F7FA;
  --kj-border:     #DDE3EA;

  --seat-open:     #00B2B2;
  --seat-occupied: #0065A4;
  --seat-hoteling: #ECA154;
  --seat-conf:     #9BB8D3;
  --seat-other:    #BBBCBC;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--kj-bg);
  color: #222;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
#header {
  background: var(--kj-blue);
  color: white;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  z-index: 100;
}
#header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
#header .kj-logo-sq {
  width: 18px; height: 18px;
  background: var(--kj-orange);
  display: inline-block;
  margin-right: -4px;
}

/* Search bar */
#search-wrap {
  flex: 1;
  max-width: 420px;
  position: relative;
}
#search-input {
  width: 100%;
  padding: 7px 12px 7px 36px;
  border: none;
  border-radius: 20px;
  font-size: .9rem;
  outline: none;
  background: rgba(255,255,255,.15);
  color: white;
}
#search-input::placeholder { color: rgba(255,255,255,.65); }
#search-input:focus { background: rgba(255,255,255,.25); }
#search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  opacity: .7; pointer-events: none;
}
#search-results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  max-height: 380px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
}
#search-results.open { display: block; }
.search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--kj-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-item:hover { background: var(--kj-bg); }
.search-item:last-child { border-bottom: none; }
.si-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--kj-lblue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  flex-shrink: 0;
}
.si-info { flex: 1; min-width: 0; }
.si-name { font-weight: 600; font-size: .875rem; color: #111; }
.si-meta { font-size: .75rem; color: var(--kj-dgray); }

/* Floor tabs */
#floor-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}
.floor-tab {
  background: rgba(255,255,255,.15);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .8rem;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
}
.floor-tab:hover { background: rgba(255,255,255,.25); }
.floor-tab.active { background: white; color: var(--kj-blue); }

/* Editor toggle */
#editor-toggle-btn {
  background: none;
  border: 1.5px solid rgba(255,255,255,.5);
  color: white;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
}
#editor-toggle-btn.active {
  background: var(--kj-orange);
  border-color: var(--kj-orange);
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Map area ────────────────────────────────────────────────────────────────── */
#map-container {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #e8ecf0;
}
#map-wrap {
  position: relative;
  display: inline-block;
  cursor: default;
}
#map-wrap.editor-active { cursor: crosshair; }
#floor-img {
  display: block;
  max-width: none;
  user-select: none;
}
#seats-svg {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  overflow: visible;
}
#seats-svg.editor-active { pointer-events: all; }

.seat-marker {
  cursor: pointer;
  transition: r .1s;
}
.seat-marker circle { transition: r .1s, fill .15s; }
.seat-marker:hover circle { r: 12; }
.seat-marker text {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 9px;
  fill: white;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}
.seat-open     circle { fill: var(--seat-open); }
.seat-occupied circle { fill: var(--seat-occupied); }
.seat-hoteling circle { fill: var(--seat-hoteling); }
.seat-conf     circle { fill: var(--seat-conf); }
.seat-other    circle { fill: var(--seat-other); }

.room-label {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 10px;
  fill: var(--kj-dgray);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
  font-weight: 600;
}

/* Highlight pulse for search result */
@keyframes pulse {
  0%   { r: 10; opacity: 1; }
  50%  { r: 18; opacity: .5; }
  100% { r: 10; opacity: 1; }
}
.seat-highlight circle {
  animation: pulse .6s ease-in-out 3;
  fill: var(--kj-orange) !important;
}

/* ── Legend ──────────────────────────────────────────────────────────────────── */
#legend {
  position: absolute;
  bottom: 14px; right: 14px;
  background: rgba(255,255,255,.92);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}
.legend-item {
  display: flex; align-items: center; gap: 7px;
}
.legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
#sidebar {
  width: 300px;
  background: white;
  border-left: 1px solid var(--kj-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width .2s;
}
#sidebar.collapsed { width: 0; }

#sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--kj-border);
  font-weight: 700;
  font-size: .85rem;
  color: var(--kj-blue);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#sidebar-close {
  background: none; border: none; cursor: pointer;
  color: var(--kj-dgray); font-size: 1.1rem; line-height: 1;
}
#sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

/* Person card */
.person-card-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--kj-lblue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
  margin: 0 auto 10px;
}
.person-card-name {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--kj-blue);
}
.person-card-title {
  text-align: center;
  font-size: .8rem;
  color: var(--kj-dgray);
  margin-bottom: 14px;
}
.pc-row {
  display: flex; align-items: flex-start;
  gap: 8px;
  font-size: .82rem;
  margin-bottom: 8px;
  color: #333;
}
.pc-row strong { min-width: 60px; color: var(--kj-dgray); font-weight: 600; }
.pc-row a { color: var(--kj-blue); text-decoration: none; }
.pc-row a:hover { text-decoration: underline; }

/* Seat info (empty seat) */
.seat-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.badge-open     { background: #e0f7f7; color: #007a7a; }
.badge-hoteling { background: #fdf3e7; color: #b5600a; }
.badge-occupied { background: #e3eef8; color: var(--kj-blue); }
.badge-conf     { background: #edf2f8; color: #4a6a8a; }

/* Editor panel */
#editor-panel {
  padding: 12px 16px;
  border-top: 1px solid var(--kj-border);
  background: #fafbfc;
  font-size: .82rem;
}
#editor-panel h3 {
  font-size: .8rem;
  color: var(--kj-dgray);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ep-btn {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--kj-border);
  background: white;
  cursor: pointer;
  font-size: .8rem;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.ep-btn:hover { border-color: var(--kj-blue); background: var(--kj-bg); }
.ep-btn.danger:hover { border-color: #c0392b; color: #c0392b; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  max-width: 95vw;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
}
.modal h2 {
  font-size: 1rem;
  color: var(--kj-blue);
  margin-bottom: 16px;
}
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--kj-dgray);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--kj-border);
  border-radius: 6px;
  font-size: .85rem;
  outline: none;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--kj-blue); }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px;
}
.btn {
  padding: 7px 16px;
  border-radius: 6px;
  border: none;
  font-size: .85rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary { background: var(--kj-blue); color: white; }
.btn-primary:hover { background: #0052852; }
.btn-secondary { background: var(--kj-bg); color: #333; border: 1.5px solid var(--kj-border); }
.btn-danger { background: #c0392b; color: white; }

/* Floor label */
#floor-label {
  position: absolute;
  top: 14px; left: 14px;
  background: rgba(255,255,255,.9);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--kj-blue);
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

/* Unassigned panel */
#unassigned-list {
  margin-top: 6px;
}
.unassigned-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--kj-border);
  font-size: .8rem;
}
.unassigned-item:last-child { border-bottom: none; }
.ua-name { flex: 1; }
.ua-assign-btn {
  background: var(--kj-teal);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: .75rem;
  cursor: pointer;
}

/* Zoom controls */
#zoom-controls {
  position: absolute;
  bottom: 14px; left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.zoom-btn {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--kj-border);
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.zoom-btn:hover { background: white; }

/* Token modal */
#token-modal input {
  font-family: monospace;
  letter-spacing: .05em;
}

/* Responsive */
@media (max-width: 768px) {
  #sidebar { width: 260px; }
  #floor-tabs { display: none; }
}

/* No image placeholder */
.no-image-placeholder {
  width: 800px; height: 520px;
  background: #dde3ea;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--kj-dgray);
  font-size: .9rem;
}
.no-image-placeholder .big-icon { font-size: 3rem; }
