/* ============================================================
   VR AI Agent — Styles
   ============================================================ */

/* ── Agent Toggle Button ── */
#vr-agent-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border: 2px solid rgba(124, 58, 237, 0.6);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: vr-agent-pulse 2s ease-in-out infinite;
}
#vr-agent-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(124, 58, 237, 0.6);
}
#vr-agent-btn.active {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border-color: rgba(220, 38, 38, 0.6);
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
  animation: none;
}
@keyframes vr-agent-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(124, 58, 237, 0.7); }
}

/* ── Login Button (always visible) ── */
#vr-agent-login-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99998;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  border: none;
  border-radius: 25px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
#vr-agent-login-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.5);
}
#vr-agent-login-btn.logged-in {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
}

/* ── Main Agent Panel ── */
#vr-agent-panel {
  position: fixed;
  bottom: 90px;
  right: 12px;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 120px);
  background: rgba(10, 10, 25, 0.97);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 16px;
  z-index: 99998;
  display: none;
  flex-direction: column;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
}
#vr-agent-panel.open {
  display: flex;
}

/* Panel header */
.vr-agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(124, 58, 237, 0.12);
  border-bottom: 1px solid rgba(124, 58, 237, 0.2);
}
.vr-agent-header .title {
  font-size: 14px;
  font-weight: 700;
  color: #c4b5fd;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vr-agent-header .zone-badge {
  font-size: 11px;
  background: rgba(124, 58, 237, 0.25);
  color: #a78bfa;
  padding: 2px 8px;
  border-radius: 10px;
}
.vr-agent-header .close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.vr-agent-header .close-btn:hover { color: #fff; }

/* Chat area */
.vr-agent-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  min-height: 180px;
  max-height: 350px;
  scroll-behavior: smooth;
}
.vr-agent-chat::-webkit-scrollbar { width: 4px; }
.vr-agent-chat::-webkit-scrollbar-track { background: transparent; }
.vr-agent-chat::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.3); border-radius: 4px; }

/* Chat messages */
.vr-agent-msg {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 95%;
  word-wrap: break-word;
}
.vr-agent-msg.agent {
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.2);
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}
.vr-agent-msg.user {
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: #bfdbfe;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.vr-agent-msg .msg-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: block;
}
.vr-agent-msg.agent .msg-label { color: #a78bfa; }
.vr-agent-msg.user .msg-label { color: #60a5fa; }

/* Auto-prompts */
.vr-agent-prompts {
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.vr-agent-prompt-btn {
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: #c4b5fd;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.vr-agent-prompt-btn:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: rgba(124, 58, 237, 0.5);
  color: #fff;
}

/* Input area */
.vr-agent-input-area {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.3);
}
.vr-agent-input-area input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.vr-agent-input-area input:focus {
  border-color: rgba(124, 58, 237, 0.6);
}
.vr-agent-input-area input::placeholder { color: #666; }

.vr-agent-mic-btn,
.vr-agent-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.vr-agent-mic-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.vr-agent-mic-btn:hover {
  background: rgba(239, 68, 68, 0.35);
}
.vr-agent-mic-btn.listening {
  background: rgba(239, 68, 68, 0.5);
  color: #fff;
  animation: vr-mic-pulse 1s ease-in-out infinite;
  border-color: #ef4444;
}
@keyframes vr-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.vr-agent-send-btn {
  background: rgba(124, 58, 237, 0.3);
  color: #c4b5fd;
  border: 1px solid rgba(124, 58, 237, 0.3);
}
.vr-agent-send-btn:hover {
  background: rgba(124, 58, 237, 0.5);
  color: #fff;
}

/* Status indicator */
.vr-agent-status {
  font-size: 10px;
  color: #666;
  padding: 2px 14px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vr-agent-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
}
.vr-agent-status .dot.listening { background: #ef4444; animation: vr-dot-blink 0.8s infinite; }
.vr-agent-status .dot.speaking { background: #22c55e; animation: vr-dot-blink 0.5s infinite; }
.vr-agent-status .dot.thinking { background: #f59e0b; animation: vr-dot-blink 0.3s infinite; }
.vr-agent-status .dot.idle { background: #666; }
@keyframes vr-dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Login overlay */
#vr-agent-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
#vr-agent-login-overlay.open { display: flex; }

.vr-agent-login-box {
  background: rgba(15, 12, 41, 0.98);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 20px;
  padding: 32px 28px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.vr-agent-login-box h2 {
  color: #c4b5fd;
  font-size: 20px;
  margin: 0 0 6px;
  text-align: center;
}
.vr-agent-login-box .subtitle {
  color: #888;
  font-size: 12px;
  text-align: center;
  margin-bottom: 20px;
}
.vr-agent-login-box input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.vr-agent-login-box input::placeholder { color: #666; }
.vr-agent-login-box .login-submit {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 10px;
}
.vr-agent-login-box .login-submit:hover { filter: brightness(1.15); }
.vr-agent-login-box .login-cancel {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #888;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.vr-agent-login-box .login-error {
  color: #ef4444;
  font-size: 12px;
  text-align: center;
  min-height: 16px;
  margin-bottom: 8px;
}

/* First-time welcome banner */
#vr-agent-welcome {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99997;
  background: rgba(10, 10, 25, 0.95);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 16px;
  padding: 18px 24px;
  max-width: 460px;
  width: 90vw;
  display: none;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  animation: vr-welcome-in 0.4s ease-out;
}
#vr-agent-welcome.show { display: block; }
@keyframes vr-welcome-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#vr-agent-welcome h3 {
  color: #c4b5fd;
  margin: 0 0 8px;
  font-size: 16px;
}
#vr-agent-welcome p {
  color: #a0a0b0;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 14px;
}
#vr-agent-welcome .welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#vr-agent-welcome .welcome-btn {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s;
}
#vr-agent-welcome .welcome-btn.primary {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
}
#vr-agent-welcome .welcome-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
#vr-agent-welcome .welcome-btn:hover { filter: brightness(1.2); }
#vr-agent-welcome .dismiss-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
}

/* ── Focus Mode Toggle Button (in panel header) ── */
.vr-agent-focus-btn {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #67e8f9;
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  margin-right: 4px;
  line-height: 1;
}
.vr-agent-focus-btn:hover {
  background: rgba(6, 182, 212, 0.3);
  border-color: rgba(6, 182, 212, 0.6);
  color: #fff;
}
.vr-agent-focus-btn.active {
  background: rgba(6, 182, 212, 0.35);
  border-color: #06b6d4;
  color: #fff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* ── View Mode Switcher (in panel below header) ── */
.vr-agent-viewmode-bar {
  display: flex;
  gap: 4px;
  padding: 6px 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}
.vr-agent-viewmode-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #888;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
  white-space: nowrap;
}
.vr-agent-viewmode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #bbb;
}
.vr-agent-viewmode-btn.active {
  color: #fff;
  border-color: rgba(124, 58, 237, 0.5);
}
.vr-agent-viewmode-btn.active[data-mode="full"] {
  background: rgba(107, 114, 128, 0.25);
  border-color: rgba(107, 114, 128, 0.5);
}
.vr-agent-viewmode-btn.active[data-mode="simple"] {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}
.vr-agent-viewmode-btn.active[data-mode="focus"] {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.5);
  color: #67e8f9;
}
.vr-agent-viewmode-btn .mode-icon {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

/* ── Focus Mode: Hide busy UI elements ── */
body.vr-focus-mode #help-overlay,
body.vr-focus-mode #loading,
body.vr-focus-mode #instructions,
body.vr-focus-mode #vr-shortcuts-overlay,
body.vr-focus-mode #vr-log-overlay,
body.vr-focus-mode #mobile-ui,
body.vr-focus-mode #vr-mode-toggle,
body.vr-focus-mode #vr-mode-indicator,
body.vr-focus-mode #vr-mode-selector,
body.vr-focus-mode #movie-hud,
body.vr-focus-mode #stock-ui,
body.vr-focus-mode #weather-info-ui,
body.vr-focus-mode #alerts-panel,
body.vr-focus-mode #stats-panels,
body.vr-focus-mode #tutorial-hud,
body.vr-focus-mode .nav-menu-overlay,
body.vr-focus-mode #vr-nav-menu,
body.vr-focus-mode .vr-hud-panel,
body.vr-focus-mode .hud-overlay,
body.vr-focus-mode .toast-container,
body.vr-focus-mode .zone-tooltip,
body.vr-focus-mode #vr-agent-welcome,
body.vr-focus-mode #vr-agent-login-btn,
body.vr-focus-mode .vr-chat-toggle,
body.vr-focus-mode #vr-chat-drawer,
body.vr-focus-mode .touch-zone-panel,
body.vr-focus-mode .category-bar,
body.vr-focus-mode .search-bar-container,
body.vr-focus-mode .event-pagination,
body.vr-focus-mode .news-ticker,
body.vr-focus-mode .forecast-cards,
body.vr-focus-mode .clothing-advice,
body.vr-focus-mode .feels-like-panel {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Keep only essential elements in focus mode */
body.vr-focus-mode #vr-agent-btn,
body.vr-focus-mode #vr-agent-panel {
  display: flex;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
body.vr-focus-mode #vr-agent-btn {
  display: flex !important;
}

/* Focus mode subtle border glow on agent button */
body.vr-focus-mode #vr-agent-btn {
  border-color: rgba(6, 182, 212, 0.6);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}

/* Focus mode notification badge */
.vr-focus-badge {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #67e8f9;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  z-index: 99996;
  pointer-events: none;
  animation: vr-focus-fade 3s ease forwards;
}
@keyframes vr-focus-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Mobile-specific adjustments */
@media (max-width: 600px) {
  #vr-agent-panel {
    bottom: 80px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 60vh;
  }
  #vr-agent-btn {
    bottom: 12px;
    right: 12px;
    width: 50px;
    height: 50px;
    font-size: 22px;
  }
  #vr-agent-login-btn {
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    font-size: 12px;
  }
  .vr-agent-chat {
    min-height: 120px;
    max-height: 200px;
  }
  #vr-agent-welcome {
    top: 50px;
    max-width: 320px;
  }
}

/* Inline link within agent messages */
.vr-agent-msg a {
  color: #60a5fa;
  text-decoration: underline;
}
.vr-agent-msg a:hover { color: #93bbfd; }

/* Bullet list in agent messages */
.vr-agent-msg ul {
  margin: 6px 0;
  padding-left: 18px;
}
.vr-agent-msg li {
  margin-bottom: 3px;
}

/* Bold text */
.vr-agent-msg strong { color: #fff; }
