/**
 * BIM MEP Virtual Office - 3D Stage, Pill Name Tags & Floating Camera Toolbar Styles
 * Inspired by khanh020905/my-office (Dark Control-Room & Chibi Studio Aesthetic)
 */

/* View Toggle Bar (Compatibility + My Office Segmented Switcher) */
.view-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.view-mode-toggle {
  display: inline-flex;
  background: #131922;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #8D97AA;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-btn:hover {
  color: #E8ECF4;
}

.view-btn.active {
  background: #263040;
  color: #E8ECF4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* 3D Canvas Container & Stage */
.office3d-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  background: radial-gradient(110% 90% at 50% 30%, #2A3555, #0E1424 70%);
  overflow: hidden;
  transition: background 0.6s ease;
}

.office3d-wrapper.hidden {
  display: none !important;
}

#plan-wrapper.hidden {
  display: none !important;
}

.office3d-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.office3d-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

/* Internal 3D Toolbar (Hidden visually when Main Bottom Floating Dock is active, kept for test DOM) */
.office3d-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: none;
  gap: 6px;
  z-index: 15;
}

.office3d-btn {
  background: rgba(15, 20, 28, 0.86);
  color: #E8ECF4;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

/* CSS2D Labels & My Office Pill Name Tags (GPU Compositor Optimized - No transform transition or blur on CSS2D root!) */
.css2d-label {
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  will-change: transform;
}

.css2d-label:hover {
  z-index: 100;
}

.css2d-label:hover .agent-badge-card {
  border-color: rgba(240, 138, 62, 0.75);
  background: #172131;
}

.agent-badge-card {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(14, 19, 27, 0.95);
  color: #EEF1F7;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  position: relative;
}

.avatar-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--badge-color, #3DDC84);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.badge-lvl {
  display: none;
}

.badge-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #EEF1F7;
  line-height: 1;
}

.badge-role {
  display: none;
}

/* Status Pill inside 3D Tag */
.status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.1;
}

.status-pill.idle {
  background: rgba(255, 255, 255, 0.08);
  color: #8D97AA;
}

.status-pill.todo {
  background: rgba(106, 174, 255, 0.18);
  color: #A9CCFF;
}

.status-pill.doing {
  background: #2FB36C;
  color: #06150C;
  animation: badge-pulse 1.5s infinite ease-in-out;
}

.status-pill.review {
  background: #F2B544;
  color: #1E1405;
  animation: review-bounce 1s infinite alternate;
}

.status-pill.error {
  background: #FF5F5F;
  color: #ffffff;
}

/* Speech Bubble Task Title above Tag (My Office .bubble style) */
.badge-task-title {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 19, 27, 0.94);
  color: #EEF1F7;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(61, 220, 132, 0.78);
  max-width: 215px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

@keyframes badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

@keyframes review-bounce {
  from { transform: translateY(0px); }
  to { transform: translateY(-3px); }
}

/* Meeting Room 3D Tag */
.meeting-3d-tag {
  pointer-events: auto;
  cursor: pointer;
  background: rgba(14, 19, 27, 0.88);
  color: #EEF1F7;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.meeting-3d-tag:hover {
  border-color: #EF8A5F;
  color: #F5A07A;
}

/* Hover Tooltip */
.office3d-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(14, 19, 27, 0.95);
  color: #E8ECF4;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 250px;
}

.office3d-tooltip.visible {
  opacity: 1;
}
