/* Import Google font - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: "Poppins", sans-serif;
}

#avatar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #1d1d1d;
  will-change: transform;
}

#controls {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 20px;
}

button {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.5s ease;
}

button:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.5); 
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.progress-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    transform: none;
    width: 300px;
    text-align: left;
    display: none;
    opacity: 1;
    transition: opacity 0.5s ease;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.progress-container.fade-out {
    opacity: 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(221, 221, 221, 0.15);
    border-radius: 4px;
    margin: 15px 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #2196F3, #00BCD4);
    border-radius: 4px;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%);
    animation: shimmer 1.5s infinite;
}

.progress-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-family: Arial, sans-serif;
    margin-top: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-details {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-top: 8px;
    font-family: monospace;
}

@keyframes shimmer {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}

.mic-container {
  position: fixed;
  bottom: -200px;  /* Start below viewport */
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s ease;
}

.mic-container.active,
.mic-container.visible {
  bottom: 40px;  /* Slide up to this position when active */
  transform: translateX(-50%) translateY(0);
}

#visualizer {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.mic-button {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.mic-button svg {
  width: 40px;
  height: 40px;
  transition: all 0.3s ease;
}

.mic-button:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.2);
}

#loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 10px;
    font-size: 16px;
    font-family: Arial, sans-serif;
    text-align: center;
    z-index: 1000;
}

.response-time-indicator {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.response-time-indicator.visible {
  opacity: 1;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .mic-container {
    bottom: -60px;
    width: 100px;
    height: 100px;
  }

  .mic-container.active {
    bottom: 35px; /* Increased to make room for response time */
  }

  .response-time-indicator {
    bottom: -22px;
    font-size: 12px;
    padding: 3px 6px;
  }

  .mic-button {
    width: 70px;
    height: 70px;
    transform: none;
    padding: 15px; /* Add padding for better touch target */
    touch-action: manipulation;
  }

  .mic-button:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
  }

  .mic-button svg {
    width: 50px;
    height: 50px;
  }

  .progress-container {
    width: 85%;
    max-width: 300px;
    padding: 15px;
    bottom: 20px;
    left: 20px;
  }

  .progress-text {
    font-size: 12px;
  }
}

/* Optimize animations for mobile */
@media (prefers-reduced-motion: reduce) {
  .mic-container,
  .mic-button,
  .progress-fill {
    transition: none;
  }
}

/* Touch-specific optimizations */
@media (hover: none) {
  .mic-button:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Transcription Styles */
#transcription-container {
  position: fixed;
  left: 0;
  bottom: 50px;
  width: 25%;
  
  z-index: 1000;
  padding: 20px;
}

.transcription-list {
  display: flex;
  flex-direction: column-reverse;  /* Reverse the direction to keep new items at bottom */
  gap: 8px;  /* Smaller default gap between items */
  min-height: 0;  /* Allows proper flex behavior */
  flex-grow: 5;
  position: relative;  /* For absolute positioning of sliding items */
}

.transcription-item {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 12px 16px;
  margin-left: 20px;
  max-width: 90%;
  transform-origin: bottom left;
  transition: all 0.3s ease-out;
  will-change: transform, opacity;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  animation: slideIn 0.3s ease-out;
}

.transcription-item.interim {
  color: rgba(204, 204, 204, 0.8);
  background: rgba(0, 0, 0, 0.4);
}

.transcription-item.interim .wave-text {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.transcription-item.interim .wave-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: rgba(204, 204, 204, 0.8);
  border-radius: 50%;
  animation: wave 1.5s ease-in-out infinite;
}

.transcription-item.interim .wave-dot:nth-child(1) { animation-delay: 0s; }
.transcription-item.interim .wave-dot:nth-child(2) { animation-delay: 0.2s; }
.transcription-item.interim .wave-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

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

.transcription-item.slide-up {
  animation: slideUp 0.3s ease-out forwards;
  opacity: 0.7;
}

.transcription-item.slide-up ~ .transcription-item.slide-up {
  opacity: 0.5;
}

.transcription-item.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes slideUp {
  to {
    transform: translateY(calc(-100% - 8px));  /* Match the smaller gap */
    opacity: 0.7;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.transcription-item.final {
  color: #4CAF50;
  background: rgba(0, 0, 0, 0.6);
  font-weight: 500;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  #transcription-container {
    width: 100%;
    top: 20px;
    bottom: auto;
    left: 0;
   
    padding: 10px;
  }

  .transcription-list {
    gap: 8px;
    align-items: center;
  }

  .transcription-item {
    margin-left: 0;
    max-width: 80%;
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* Control Panel Styles */
.control-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.control-panel.collapsed {
    transform: translateX(100%);
}

.control-panel:not(.collapsed) {
    transform: translateX(0);
}

.toggle-panel {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    gap: 4px;
}

.toggle-panel:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background-color: white;
    transition: all 0.3s ease;
    transform-origin: center;
    position: relative;
    margin: 0;
}

.toggle-panel.active-menu .hamburger-line {
    position: absolute;
    margin: 0;
}

.toggle-panel.active-menu .hamburger-line:nth-child(1) {
    transform: rotate(45deg);
}

.toggle-panel.active-menu .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.toggle-panel.active-menu .hamburger-line:nth-child(3) {
    transform: rotate(-45deg);
}

.control-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-panel-header span {
    font-size: 16px;
    font-weight: 500;
}

.control-panel-content {
    padding: 20px;
    overflow-y: auto;
    height: calc(100vh - 60px);
}

.control-group {
    margin-bottom: 25px;
}

.control-group h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.control-item label {
    color: #fff;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.value-display {
    color: #fff;
    font-size: 0.8em;
    text-align: right;
    font-family: monospace;
    opacity: 0.8;
}

.control-item input[type="range"] {
    width: 100%;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.control-item input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-item input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-item input[type="color"] {
  width: 100%;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.control-item input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.control-item input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.control-item input[type="color"]::-moz-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .control-panel {
        width: 100%;
    }
    
    .control-panel.collapsed {
        transform: translateX(100%);
    }
}

/* Add styles from style.css */
.avatar-container {
    text-align: left;
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-gap: 0px;
    padding-left: 0px;
    padding-top: 2px;
    margin-top: 10px;
}

.text-container {
    text-align: left;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-gap: 0px;
    padding-left: 0px;
    padding-top: 8px;
}

.llm-timing-container,
.transcription-timing-container,
.whisperspeech-timing-container {
    text-align: left;
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-gap: 4px;
    padding-left: 0px;
    padding-top: 8px;
    font-size: 12px;
}

.whisperspeech-audio-container {
    text-align: left;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-gap: 4px;
    padding-left: 0px;
    padding-top: 8px;
    font-size: 12px;
}

.control-container {
    text-align: left;
    display: grid;
    grid-template-columns: auto auto 20px auto auto auto 1fr;
    grid-gap: 4px;
    padding-left: 0px;
    font-size: 12px;
}

.avatar {
    border-radius: 50%;
    width: 24px;
    float: left;
}

.avatar-name {
    font-size: 15px;
    padding-left: 4px;
    padding-top: 2px;
}

.audio-container {
    margin-top: 14px;
}

/* Add log lighting button styles */
.log-lighting-button {
    margin: 10px 0;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}

.log-lighting-button:hover {
    background-color: #45a049;
}

/* Chat Container - Left Side Layout */
.chat-interface {
    position: fixed;
    left: 65%;
    top: 100px;
    bottom: 30px;
    width: 450px;
    display: none;
    flex-direction: column;
    gap: 15px;
    z-index: 1002;
}

.chat-interface.visible {
    display: flex;
}

/* Response Text Container Styles - Chat Messages */
.response-text-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.response-text-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.response-text-header span {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-button {
    background: rgba(244, 67, 54, 0.8);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-button:hover {
    background: rgba(244, 67, 54, 1);
    transform: scale(1.05);
}

.response-text-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    color: white;
    font-size: 14px;
    line-height: 1.6;
    font-family: "Poppins", sans-serif;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.response-text-content:empty::before {
    content: "Response will appear here...";
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Message bubble styling */
.message-bubble {
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
}

.message-bubble.user {
    background: linear-gradient(135deg, #2196F3, #00BCD4);
    margin-left: auto;
    text-align: right;
}

.message-bubble.assistant {
    background: rgba(255, 255, 255, 0.1);
    margin-right: auto;
}

/* Scrollbar styling for response text */
.response-text-content::-webkit-scrollbar {
    width: 6px;
}

.response-text-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.response-text-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.response-text-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Text Input Container Styles */
.text-input-container {
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 10;
}

.text-input-container.visible {
    opacity: 1;
    pointer-events: all;
}

.text-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

#text-query-input {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: white;
    font-size: 15px;
    font-family: "Poppins", sans-serif;
    outline: none;
    transition: all 0.3s ease;
    cursor: text;
    pointer-events: auto;
}

#text-query-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#text-query-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(33, 150, 243, 0.5);
}

.send-button {
    background: linear-gradient(135deg, #2196F3, #00BCD4);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    padding: 0;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.5);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile-specific adjustments for text components */
@media (max-width: 768px) {
    .chat-interface {
        left: 20px;
        right: 20px;
        width: auto;
        top: 80px;
        bottom: 20px;
    }
    
    .text-input-wrapper {
        padding: 10px;
    }
    
    #text-query-input {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .send-button {
        width: 40px;
        height: 40px;
    }
    
    .response-text-content {
        font-size: 13px;
        padding: 12px;
    }
    
    .message-bubble {
        max-width: 90%;
    }
}