/* Prisma Watch - AI Assistant Styles */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Background iframe - Prisma Watch site */
#backgroundSite {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 1;
}

:root {
  --mini-video-height: clamp(180px, 28vh, 320px);
}

/* Landscape screens: keep mini window smaller based on width */
@media (min-aspect-ratio: 1/1) {
  :root {
    --mini-video-height: clamp(140px, 24vw, 220px);
  }
}

/* Video widget - supports mini and fullscreen modes */
.video-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: calc(var(--mini-video-height) * 0.9);
  background: rgba(0, 0, 0, 0.9);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 1000;
  backdrop-filter: blur(10px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: move;
  user-select: none;
}

.video-widget.dragging {
  cursor: grabbing;
  transition: none;
}

/* Fullscreen mode */
.video-widget.fullscreen {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  z-index: 2000;
}

.video-widget.fullscreen .video-section {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.video-widget.fullscreen #agentVideo {
  filter: blur(0);
}

.video-widget.fullscreen #agentVideo,
.video-widget.fullscreen #placeholderVideo {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100vh;
  width: auto;
  object-fit: contain;
}
}

/* Blurred background for fullscreen */
.fullscreen-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

.fullscreen-bg.active {
  opacity: 1;
}

.prisma-logo {
  position: fixed;
  top: 0;
  left: 0;
  height: clamp(24px, 8vh, 56px);
  width: auto;
  max-width: clamp(120px, 25vw, 260px);
  object-fit: contain;
  z-index: 2002;
  opacity: 0.95;
  pointer-events: none;
  display: none;
}

body:has(.video-widget.fullscreen) .prisma-logo {
  display: block;
}

.video-section {
  position: relative;
  background: #000;
  aspect-ratio: 3/4;
  overflow: hidden;
}

/* Fullscreen: default crop by height (cover) - moved above */

/* Landscape fullscreen: expand crop sideways (contain + white letterbox) */
@media (min-aspect-ratio: 1/1) {
  .video-widget.fullscreen .video-section {
    background: #fff;
  }

  .video-widget.fullscreen #agentVideo,
  .video-widget.fullscreen #placeholderVideo {
    object-fit: contain;
  }
}

/* Mini mode: size by height, crop by width */
.video-widget:not(.fullscreen) .video-section {
  height: var(--mini-video-height);
  aspect-ratio: auto;
}

#agentVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.5s;
}

#agentVideo.visible {
  opacity: 1;
  z-index: 2;
}

#placeholderVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 14px;
}

.video-overlay.hidden {
  display: none;
}

/* Status bar */
.status-bar {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #fff;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc3545;
}

.status-dot.connected {
  background: #28a745;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* Controls */
.controls {
  padding: 12px;
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}

.mic-hint {
  padding: 6px 12px 10px;
  background: rgba(0, 0, 0, 0.7);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.2px;
}

/* Hide normal controls in fullscreen */
.video-widget.fullscreen .controls {
  display: none;
}

/* Fullscreen call buttons */
.fullscreen-call-buttons {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 24px;
  z-index: 2001;
}

.fullscreen-mic-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 2001;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.95);
  font-size: 12px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.video-widget.fullscreen ~ .fullscreen-call-buttons {
  display: flex;
}

.fullscreen-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.fullscreen-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.fullscreen-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.fullscreen-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fullscreen-btn-join {
  background: rgba(40, 167, 69, 0.9);
  color: white;
}

.fullscreen-btn-leave {
  background: rgba(220, 53, 69, 0.9);
  color: white;
}

.fullscreen-btn-warning {
  background: rgba(255, 193, 7, 0.9);
  color: white;
}

.fullscreen-btn-toggle {
  background: rgba(102, 126, 234, 0.9);
  color: white;
}

.btn {
  flex: 1;
  padding: 12px;
  font-size: 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-text {
  display: inline-block;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.fullscreen-btn.btn-loading::after {
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-primary {
  background: rgba(102, 126, 234, 0.8);
}

.btn-primary:hover:not(:disabled) {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.05);
}

.btn-success {
  background: rgba(40, 167, 69, 0.8);
}

.btn-success:hover:not(:disabled) {
  background: rgba(40, 167, 69, 1);
  transform: scale(1.05);
}

.btn-warning {
  background: rgba(255, 193, 7, 0.8);
}

.btn-warning:hover:not(:disabled) {
  background: rgba(255, 193, 7, 1);
  transform: scale(1.05);
}

.btn-danger {
  background: rgba(220, 53, 69, 0.8);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(220, 53, 69, 1);
  transform: scale(1.05);
}

/* Microphone button styles */
.mic-btn {
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Fullscreen microphone button */
.fullscreen-btn.mic-btn {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.mic-btn.muted {
  background: rgba(220, 53, 69, 0.8) !important;
}

.mic-btn.muted:hover:not(:disabled) {
  background: rgba(220, 53, 69, 1) !important;
}

/* Dev menu */
.dev-menu {
  position: fixed;
  bottom: 240px;
  right: 20px;
  width: 320px;
  background: rgba(30, 30, 30, 0.98);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 3000;
  backdrop-filter: blur(10px);
  display: none;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  cursor: move;
  user-select: none;
}

.dev-menu.visible {
  display: block;
}

.dev-menu.dragging {
  cursor: grabbing;
}

.dev-menu-title {
  color: #00ff00;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 12px;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: move;
}

.dev-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dev-menu-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(102, 126, 234, 0.8);
  color: white;
  text-align: left;
}

.dev-menu-btn:hover {
  background: rgba(102, 126, 234, 1);
  transform: translateX(4px);
}

.dev-menu-btn:active {
  transform: scale(0.98);
}
