/* ==============================================================================
   BPV-XR AI Assistant Floating Widget & OPC Digital Office Floor Styles
   Tham chiếu thẩm mỹ trực quan từ ast_trolyaicanhan (linh-chat + opc-floor)
   đồng bộ giao diện Dark Glassmorphism BPV-XR
   ============================================================================== */

/* ==============================================================================
   1. FLOATING AI CONSULTANT WIDGET (Ms. Duyên / Phương Thảo / Đức Minh)
   ============================================================================== */
#bpv-ai-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 990;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2.5px solid #38bdf8;
  padding: 0;
  background: #0f172a;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(6, 182, 212, 0.38);
  transition: transform 0.22s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#bpv-ai-launcher:hover {
  transform: scale(1.07);
}

#bpv-ai-launcher svg {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

#bpv-ai-launcher .ai-online-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #060a13;
}

#bpv-ai-launcher .ai-ping-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.7);
  animation: bpvAiPing 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes bpvAiPing {
  0% { transform: scale(0.95); opacity: 0.9; }
  80%, 100% { transform: scale(1.28); opacity: 0; }
}

#bpv-ai-tooltip {
  position: fixed;
  right: 96px;
  bottom: 30px;
  z-index: 989;
  background: rgba(13, 20, 36, 0.96);
  color: #f8fafc;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 14px;
  padding: 9px 28px 9px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  max-width: 245px;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#bpv-ai-tooltip.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

#bpv-ai-tooltip small {
  display: block;
  font-weight: 400;
  color: #94a3b8;
  font-size: 0.74rem;
  margin-top: 2px;
}

#bpv-ai-tooltip .tip-close {
  position: absolute;
  right: 8px;
  top: 6px;
  color: #94a3b8;
  font-style: normal;
  font-size: 13px;
}

#bpv-ai-window {
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 991;
  width: 392px;
  max-width: calc(100vw - 24px);
  height: min(620px, calc(100vh - 122px));
  display: flex;
  flex-direction: column;
  background: #0b1222;
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: all 0.22s ease;
}

#bpv-ai-window.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.ai-win-header {
  padding: 13px 14px;
  background: linear-gradient(135deg, rgba(0, 86, 179, 0.38), rgba(6, 182, 212, 0.22));
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-agent-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #22d3ee;
  overflow: hidden;
  flex-shrink: 0;
  background: #f8fafc;
}

.ai-win-header.talking .ai-avatar-box {
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.85);
  border-color: #22c55e;
}

.ai-role-switcher {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(6, 10, 19, 0.72);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.ai-role-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-role-btn.active {
  background: linear-gradient(135deg, #0056b3, #06b6d4);
  border-color: transparent;
  color: #ffffff;
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-msg.bot {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.88);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom-left-radius: 4px;
}

.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0056b3, #06b6d4);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-msg.bot a {
  color: #67e8f9;
  text-decoration: underline;
}

.ai-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}

.ai-quick-chips button {
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: rgba(15, 23, 42, 0.8);
  color: #bae6fd;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.74rem;
  cursor: pointer;
}

.ai-quick-chips button:hover {
  border-color: #22d3ee;
  background: rgba(6, 182, 212, 0.2);
}

.ai-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(6, 10, 19, 0.85);
}

.ai-input-row input {
  flex: 1;
  min-width: 0;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #0f172a;
  color: #f8fafc;
  padding: 9px 12px;
  font-size: 0.86rem;
}

.ai-input-row input:focus {
  outline: none;
  border-color: #22d3ee;
}

.ai-footer-note {
  font-size: 0.7rem;
  color: #64748b;
  text-align: center;
  padding: 0 12px 8px;
  background: rgba(6, 10, 19, 0.85);
}

/* ==============================================================================
   2. SƠ ĐỒ VĂN PHÒNG SỐ OPC (office.html)
   ============================================================================== */
.opc-floor-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 460px;
  background: radial-gradient(circle at 50% 50%, #101b32, #070c18);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.opc-room {
  position: absolute;
  border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--rc) 50%, transparent);
  background: color-mix(in srgb, var(--rc) 7%, rgba(13, 20, 36, 0.72));
  padding: 8px 11px;
}

.opc-room-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.opc-room-label i {
  font-style: normal;
  font-weight: 500;
  color: #94a3b8;
  font-size: 0.7rem;
}

.opc-avatar-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease, left 0.7s ease, top 0.7s ease;
}

.opc-avatar-node:hover {
  transform: translate(-50%, -54%) scale(1.08);
  z-index: 20;
}

.opc-av-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2.5px solid var(--rc, #22d3ee);
  background: #f8fafc;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  position: relative;
}

.opc-avatar-node.off .opc-av-circle {
  filter: grayscale(0.9) opacity(0.55);
}

.opc-av-tag {
  background: rgba(8, 13, 25, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  text-align: center;
}

.opc-av-tag small {
  display: block;
  font-weight: 500;
  font-size: 0.63rem;
  color: #94a3b8;
}

.opc-task-pill {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

@media (max-width: 760px) {
  #bpv-ai-window {
    right: 12px;
    bottom: 88px;
    height: calc(100vh - 108px);
  }
  #bpv-ai-launcher {
    right: 14px;
    bottom: 14px;
    width: 58px;
    height: 58px;
  }
  #bpv-ai-tooltip {
    display: none;
  }
  .opc-floor-wrap {
    aspect-ratio: auto;
    min-height: 560px;
  }
}

/* Light Mode cho Floating AI Chat Widget */
html[data-theme="light"] #bpv-ai-tooltip {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

html[data-theme="light"] #bpv-ai-window {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
}

html[data-theme="light"] .ai-role-switcher {
  background: #f1f5f9;
}

html[data-theme="light"] .ai-role-btn {
  background: #ffffff;
  color: #334155;
}

html[data-theme="light"] .ai-msg.bot {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

html[data-theme="light"] .ai-quick-chips button {
  background: #f8fafc;
  color: #0369a1;
}

html[data-theme="light"] .ai-input-row {
  background: #f8fafc;
}

html[data-theme="light"] .ai-input-row input {
  background: #ffffff;
  color: #0f172a;
}
