:root {
  /* Dark Theme Colors - Slate palette */
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;

  /* Accent Colors */
  --purple-600: #9333ea;
  --purple-500: #a855f7;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --red-600: #dc2626;
  --red-500: #ef4444;

  /* UI Properties */
  --rounded-full: 9999px;
  --rounded-2xl: 1rem;
  --rounded-xl: 0.75rem;
  --rounded-lg: 0.5rem;
  --transition: all 0.2s ease;
  --transition-transform: transform 0.2s ease;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--slate-950) 0%, var(--slate-900) 50%, var(--slate-950) 100%);
  color: white;
  min-height: 100vh;
  overflow: hidden;
}

/* =====================
   App Container
   ===================== */
.app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* =====================
   Header
   ===================== */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, var(--purple-600), var(--blue-600));
  border-radius: var(--rounded-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.brand-text h1 {
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--slate-400);
  line-height: 1.2;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(8px);
  border-radius: var(--rounded-full);
  border: 1px solid var(--slate-700);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--green-500);
  border-radius: var(--rounded-full);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 0.875rem;
  color: var(--slate-300);
}

/* =====================
   Avatar Area
   ===================== */
.avatar-area {
  position: absolute;
  inset: 0;
  padding: 6rem 6rem 7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-display {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--slate-800) 0%, var(--slate-900) 50%, var(--slate-950) 100%);
  border-radius: var(--rounded-2xl);
  border: 1px solid var(--slate-700);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.avatar-display canvas {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Speaking Indicator */
.speaking-indicator {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(34, 197, 94, 0.2);
  backdrop-filter: blur(8px);
  border-radius: var(--rounded-full);
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 0.875rem;
  color: var(--green-400);
}

.speaking-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--green-500);
  border-radius: var(--rounded-full);
  animation: pulse-dot 1s infinite;
}

/* =====================
   Camera PiP
   ===================== */
.camera-pip {
  position: absolute;
  bottom: 7rem;
  left: 1.5rem;
  width: 16rem;
  height: 12rem;
  background: var(--slate-900);
  border-radius: var(--rounded-xl);
  border: 2px solid var(--slate-700);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 10;
}

.camera-pip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pip-label {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(4px);
  border-radius: var(--rounded-lg);
  font-size: 0.75rem;
  color: var(--slate-300);
}

/* =====================
   Control Panel
   ===================== */
.control-panel {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.control-panel-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  border-radius: var(--rounded-2xl);
  border: 1px solid var(--slate-700);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.control-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-divider {
  width: 1px;
  height: 3rem;
  background: var(--slate-700);
  margin: 0 0.5rem;
}

/* =====================
   Buttons
   ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--rounded-xl);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: var(--transition-transform);
}

.btn:hover .btn-icon {
  transform: scale(1.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-600), var(--blue-600));
  color: white;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--slate-700);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
  background: var(--slate-600);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red-600);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  padding: 1rem 2rem;
}

.btn-danger:hover {
  background: var(--red-500);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Settings Button */
.btn-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--slate-800);
  border: none;
  border-radius: var(--rounded-xl);
  cursor: pointer;
  transition: var(--transition);
}

.btn-settings svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--slate-300);
  transition: all 0.3s ease;
}

.btn-settings:hover {
  background: var(--slate-700);
}

.btn-settings:hover svg {
  color: white;
  transform: rotate(90deg);
}

/* =====================
   Modal
   ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 48rem;
  max-height: 90vh;
  background: var(--slate-900);
  border-radius: var(--rounded-2xl);
  border: 1px solid var(--slate-700);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: rgba(30, 41, 59, 0.5);
  border-bottom: 1px solid var(--slate-700);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
}

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: transparent;
  border: none;
  border-radius: var(--rounded-lg);
  cursor: pointer;
  transition: var(--transition);
}

.btn-close svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--slate-400);
}

.btn-close:hover {
  background: var(--slate-700);
}

.btn-close:hover svg {
  color: white;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  background: rgba(30, 41, 59, 0.5);
  border-top: 1px solid var(--slate-700);
}

/* =====================
   Form Controls
   ===================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-300);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: var(--rounded-lg);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.form-control::placeholder {
  color: var(--slate-500);
}

textarea.form-control {
  min-height: 8rem;
  resize: vertical;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

/* =====================
   Toggle Switches
   ===================== */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--slate-700);
  border-radius: var(--rounded-full);
  transition: var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1rem;
  height: 1rem;
  background: white;
  border-radius: var(--rounded-full);
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--purple-600);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(1.25rem);
}

.toggle-label {
  font-size: 0.875rem;
  color: var(--slate-300);
  transition: var(--transition);
}

.toggle-wrapper:hover .toggle-label {
  color: white;
}

/* =====================
   Messages Log
   ===================== */
.messages-log {
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: var(--rounded-lg);
  padding: 1rem;
  min-height: 16rem;
  max-height: 16rem;
  overflow-y: auto;
}

.messages-empty {
  font-size: 0.875rem;
  color: var(--slate-500);
  text-align: center;
  padding: 2rem;
}

.message {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--slate-700);
  border-radius: var(--rounded-lg);
  animation: fadeIn 0.3s ease-out;
}

.message:last-child {
  margin-bottom: 0;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.message-role {
  font-size: 0.75rem;
  font-weight: 600;
}

.message-role.user {
  color: var(--purple-500);
}

.message-role.assistant {
  color: var(--blue-500);
}

.message-role.system {
  color: var(--slate-500);
}

.message-time {
  font-size: 0.75rem;
  color: var(--slate-500);
}

.message-content {
  font-size: 0.875rem;
  color: var(--slate-300);
}

/* Streaming message indicator (Teams-like typing effect) */
.message.streaming {
  border-color: var(--blue-500);
  border-style: solid;
}

.message.streaming .message-content::after {
  content: ' ...';
  animation: pulse 1s ease-in-out infinite;
  color: var(--blue-400);
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================
   Process/Thinking Display
   ===================== */
.process-container {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--slate-600);
}

.process-container.thinking {
  border-color: var(--purple-500);
  border-style: dashed;
}

.message-role.process {
  color: var(--purple-500);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.message-role.complete {
  color: var(--green-500);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.thinking-icon {
  display: inline-block;
  animation: thinking-bounce 1s ease-in-out infinite;
}

@keyframes thinking-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.complete-icon {
  display: inline-block;
}

.total-timing {
  font-size: 0.75rem;
  color: var(--green-400);
  font-weight: 600;
  margin-left: auto;
  padding-left: 1rem;
}

.process-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.process-step {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--slate-700);
  border-radius: var(--rounded-lg);
  overflow: hidden;
}

.process-step.model-output {
  border-left: 3px solid var(--blue-500);
}

.process-step.function-call {
  border-left: 3px solid var(--purple-500);
}

.process-step.function-result {
  border-left: 3px solid var(--green-500);
}

.process-step-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid var(--slate-700);
}

.step-icon {
  font-size: 0.875rem;
}

.step-title {
  font-size: 0.75rem;
  color: var(--slate-300);
}

.step-title strong {
  color: white;
  font-weight: 600;
}

.step-timing {
  font-size: 0.7rem;
  color: var(--slate-500);
  margin-left: auto;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.process-step-content {
  padding: 0.5rem 0.75rem;
  max-height: 12rem;
  overflow-y: auto;
}

.process-json {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--slate-300);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* JSON syntax highlighting */
.json-key {
  color: var(--purple-400);
}

.json-string {
  color: var(--green-400);
}

.json-number {
  color: var(--blue-400);
}

.json-boolean {
  color: #f59e0b; /* amber */
}

.json-null {
  color: var(--slate-500);
  font-style: italic;
}

/* =====================
   Video Buttons Container
   ===================== */
.video-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* =====================
   Conversation Panel (Right Side)
   ===================== */
.conversation-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--slate-700);
  box-shadow: -25px 0 50px -12px rgba(0, 0, 0, 0.5);
  z-index: 25;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.conversation-panel.open {
  transform: translateX(0);
}

.conversation-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--slate-700);
  background: rgba(30, 41, 59, 0.5);
}

.conversation-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.conversation-panel-title svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--purple-500);
}

.conversation-panel-title h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
}

.conversation-panel .messages-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: unset;
  max-height: unset;
}

/* Avatar area adjustment when conversation panel is open */
.avatar-area.conversation-open {
  right: 24rem;
  transition: right 0.3s ease;
}

/* =====================
   OpenAI Branding
   ===================== */
.logo.openai {
  background: linear-gradient(135deg, #10a37f, #1a7f5a);
  box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

/* =====================
   Navigator Branding (Mall Navigator)
   ===================== */
.logo.navigator {
  background: linear-gradient(135deg, #e91e63, #9c27b0);
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
  font-size: 1.5rem;
  line-height: 1;
}

/* =====================
   Utility Classes
   ===================== */
.hidden {
  display: none !important;
}

/* =====================
   Scrollbar
   ===================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--slate-800);
}

::-webkit-scrollbar-thumb {
  background: var(--slate-600);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--slate-500);
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }

  .avatar-area {
    padding: 4rem 1rem 8rem;
  }

  .camera-pip {
    width: 10rem;
    height: 7.5rem;
    bottom: 8rem;
    left: 1rem;
  }

  .control-panel-inner {
    padding: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .control-buttons {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .control-divider {
    display: none;
  }

  .btn-settings {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }

  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
}

@media (max-width: 480px) {
  .brand-text h1 {
    font-size: 1rem;
  }

  .brand-text p {
    font-size: 0.625rem;
  }

  .status-indicator {
    padding: 0.375rem 0.75rem;
  }

  .status-text {
    font-size: 0.75rem;
  }
}
