/* Desk Assignment – Floor Plan Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #1a1a2e;
  color: #fff;
  min-height: 100vh;
}
#toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #16213e;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
#toolbar h1 {
  font-size: 16px;
  font-weight: 600;
  margin-right: auto;
}

#container {
  margin-top: 52px;
  position: relative;
  overflow: auto;
  width: 100%;
  height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#floorplan-wrapper {
  position: relative;
  display: inline-block;
}
#floorplan {
  display: block;
  max-width: 1307px;
  max-height: 80vh;
  width: 100%;
  height: auto;
  margin: 0 auto;
}
.desk-sticker {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 10;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  text-align: center;
  line-height: 1;
}
.desk-sticker.available {
  background: #22c55e;
}
.desk-sticker.available:hover {
  transform: translate(-50%, -50%) scale(1.35);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
  z-index: 20;
}
.desk-sticker.occupied {
  background: #e94560;
}
.desk-sticker.occupied:hover {
  transform: translate(-50%, -50%) scale(1.35);
  box-shadow: 0 0 12px rgba(233, 69, 96, 0.7);
  z-index: 20;
}
.desk-sticker.collision {
  background: #f97316;
  border-color: #fbbf24;
}
.desk-sticker.collision:hover {
  transform: translate(-50%, -50%) scale(1.35);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.7);
  z-index: 20;
}
.desk-sticker.collision::before {
  content: "⚠";
}
.desk-sticker.locked {
  opacity: 0.75;
  cursor: not-allowed;
  border-style: dashed;
}
.desk-sticker.locked:hover {
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.desk-sticker.locked .tooltip::before {
  content: "🔒 ";
}
.desk-sticker .tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #16213e;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desk-sticker .tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #16213e;
}
.desk-sticker:hover .tooltip {
  opacity: 1;
}

#modalOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#modalOverlay.visible {
  display: flex;
}
#modal {
  background: #16213e;
  border-radius: 12px;
  padding: 24px 28px;
  min-width: 440px;
  max-width: 520px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #fff;
  position: relative;
}
#modal h2 {
  font-size: 16px;
  margin-bottom: 4px;
  font-weight: 600;
}
#modalDesc {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 14px;
  line-height: 1.4;
}
#modalPrefLabel {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  display: block;
}
#modalNames {
  list-style: none;
  margin-bottom: 14px;
}
#modalNames:empty {
  display: none;
}
#modalNames li {
  padding: 6px 10px;
  background: #0f3460;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#modalNames li.withdrawn {
  opacity: 0.5;
}
#modalNames li.withdrawn .modal-name-text {
  text-decoration: line-through;
}
#modalNames li .withdrawn-badge {
  font-size: 11px;
  color: #fbbf24;
  font-style: italic;
  white-space: nowrap;
}
#modalNames li .withdraw-btn {
  padding: 2px 8px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
#modalNames li .withdraw-btn:hover {
  background: #c73650;
}
#modalInputRow {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
#modalNameInput {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid #0f3460;
  border-radius: 6px;
  background: #1a1a2e;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#modalNameInput:focus {
  border-color: #e94560;
}
#modalPrefSelect {
  padding: 8px 10px;
  border: 2px solid #0f3460;
  border-radius: 6px;
  background: #1a1a2e;
  color: #fff;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
#modalPrefSelect:focus {
  border-color: #e94560;
}
#modalAddBtn {
  padding: 8px 16px;
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
#modalAddBtn:hover {
  background: #16a34a;
}
#modalCloseBtn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modalCloseBtn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  #toolbar {
    padding: 8px 12px;
  }
  #toolbar h1 {
    font-size: 14px;
  }
  #container {
    margin-top: 44px;
    height: calc(100vh - 44px);
    align-items: flex-start;
  }
  .desk-sticker {
    width: 20px;
    height: 20px;
    font-size: 7px;
    border-width: 1.5px;
  }
  .desk-sticker .tooltip {
    font-size: 10px;
    padding: 4px 8px;
    bottom: calc(100% + 4px);
  }
  .desk-sticker .tooltip::after {
    border-width: 4px;
  }
  #modal {
    min-width: unset;
    max-width: 95vw;
    padding: 16px 16px;
    margin: 0 8px;
  }
  #modalInputRow {
    flex-wrap: wrap;
  }
  #modalNameInput {
    font-size: 16px; /* prevent iOS zoom */
  }
}

@media (max-width: 480px) {
  .desk-sticker {
    width: 14px;
    height: 14px;
    font-size: 5px;
    border-width: 1px;
  }
  .desk-sticker .tooltip {
    font-size: 9px;
    padding: 3px 6px;
  }
}
