/* Add styles for menu button at the beginning of the file */
.btn-secondary {
  background: transparent !important;
  border: none !important;
  color: white;
  transition: all 0.3s ease;
  padding: 8px;
  box-shadow: none !important;
}

.dropdown-toggle::after {
  display: none;
}

/* Character Dropdown Menu - Streamlined Glass Design */
.dropdown-menu {
  background: rgba(58,65,73, 0.15) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  padding: 8px;
  transform-origin: top;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-width: 200px;
}

.dropdown-menu.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 12px 16px;
  margin: 2px 0;
  border-radius: 15px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: transparent;
  border: none;
  font-weight: 400;
  font-size: 0.95rem;
}

.dropdown-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.08);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  border-radius: 15px;
}

.dropdown-item:hover {
  color: white;
  background: transparent;
  transform: translateX(2px);
}

.dropdown-item:hover::before {
  transform: scaleX(1);
}

.dropdown-item:active {
  transform: translateX(1px) scale(0.98);
}

.dropdown-item i {
  margin-right: 12px;
  width: 18px;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.dropdown-item:hover i {
  opacity: 1;
  transform: scale(1.1);
}

/* Remove top bar styles */
.control-toggles {
  display: none;
}

/* Add a subtle glow effect on hover */
.dropdown-item:hover i {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Add a smooth slide-in animation when menu opens */
/*.dropdown-menu.show {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
*/
/* @keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}*/

/* Add styles for menu button at the beginning of the file */
.body {
  margin: 0;
  padding: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);  /* Lighter background for macOS style */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);   
}

canvas {
  width: 100vw;
  height: 100vh;
  display: block;
  position: relative;
  z-index: 1;
}

/* Enhanced chat loading indicator styles */
.chat-loading {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px;
  color: white;
  margin: 5px 0;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease-out;
}

.chat-loading.show {
  opacity: 1;
  transform: translateY(0);
}

.loading-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ai-thinking-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(58,65,73, 0.15);
  border-radius: 20px;
  border: 1px solid rgba(58,65,73, 0.3);
}

.brain-icon {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brain-pulse {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #3a4149, #3a4149);
  border-radius: 50%;
  animation: brainPulse 2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(58,65,73, 0.4);
}

.brain-waves {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
}

.wave {
  position: absolute;
  border: 2px solid rgba(58,65,73, 0.3);
  border-radius: 50%;
  animation: waveExpand 2s ease-out infinite;
}

.wave-1 {
  width: 100%;
  height: 100%;
  animation-delay: 0s;
}

.wave-2 {
  width: 100%;
  height: 100%;
  animation-delay: 0.7s;
}

.wave-3 {
  width: 100%;
  height: 100%;
  animation-delay: 1.4s;
}

.thinking-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.typing-animation {
  animation: textPulse 2s ease-in-out infinite;
}

.dots-animation {
  display: flex;
  gap: 3px;
}

.dot {
  width: 4px;
  height: 4px;
  background: rgba(58,65,73, 0.8);
  border-radius: 50%;
  animation: dotBounce 1.4s ease-in-out infinite;
}

.dot:nth-child(1) {
  animation-delay: 0s;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

.loading-progress-bar {
  width: 70%;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3a4149, #3a4149, #3a4149);
  background-size: 200% 100%;
  border-radius: 1px;
  animation: progressWave 2s ease-in-out infinite;
}

@keyframes brainPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes waveExpand {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes textPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes dotBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-8px);
    opacity: 1;
  }
  60% {
    transform: translateY(-4px);
    opacity: 0.8;
  }
}

@keyframes progressWave {
  0% {
    background-position: 0% 0%;
    width: 0%;
  }
  50% {
    background-position: 100% 0%;
    width: 70%;
  }
  100% {
    background-position: 200% 0%;
    width: 100%;
  }
}

/* Responsive design for loading indicator */
@media (max-width: 768px) {
  .chat-loading {
    padding: 8px;
    margin: 4px 0;
  }
  
  .ai-thinking-indicator {
    padding: 6px 12px;
    gap: 10px;
  }
  
  .brain-icon {
    width: 28px;
    height: 28px;
  }
  
  .brain-pulse {
    width: 20px;
    height: 20px;
  }
  
  .brain-waves {
    width: 36px;
    height: 36px;
  }
  
  .thinking-text {
    font-size: 13px;
  }
  
  .loading-content-wrapper {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .chat-loading {
    padding: 6px;
    margin: 3px 0;
  }
  
  .ai-thinking-indicator {
    padding: 4px 10px;
    gap: 8px;
  }
  
  .brain-icon {
    width: 24px;
    height: 24px;
  }
  
  .brain-pulse {
    width: 18px;
    height: 18px;
  }
  
  .brain-waves {
    width: 32px;
    height: 32px;
  }
  
  .thinking-text {
    font-size: 12px;
  }
  
  .loading-content-wrapper {
    gap: 6px;
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:  rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1300;
  animation: fadeIn 0.5s ease-out;
}

.loading-content {
  text-align: center;
  color: white;
  background: rgba(58,65,73, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 48px 40px;
  border: 1px solid rgba(58,65,73, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 
              0 0 80px rgba(58,65,73, 0.1);
  min-width: 320px;
  transform: scale(0.95);
  animation: scaleIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.logo-loading-animation {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
  border-radius: 50%;
  animation: logoSpin 2s linear infinite, logoGlow 3s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 20px rgba(58,65,73, 0.4));
}

/* Character Quote Styles for Loading Screen */
.loading-quote-container {
  margin-top: 24px;
  padding: 20px;
  max-width: 500px;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  animation: fadeInUp 0.8s ease-out forwards;
  animation-delay: 0.3s;
}

.loading-quote {
  font-size: 18px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.3px;
}

.loading-quote-author {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}

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

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  .loading-quote-container {
    padding: 15px;
    max-width: 90%;
  }
  
  .loading-quote {
    font-size: 16px;
  }
  
  .loading-quote-author {
    font-size: 12px;
  }
}

@keyframes logoSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes logoGlow {
  from {
    filter: drop-shadow(0 0 20px rgba(58,65,73, 0.4));
  }
  to {
    filter: drop-shadow(0 0 40px rgba(58,65,73, 0.8));
  }
}

.loading-text {
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 16px;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, rgba(58,65,73, 0.8) 0%, rgba(58,65,73, 1) 100%);
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(58,65,73, 0.5);
}

.loading-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(58,65,73, 0.8);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
  animation-delay: 0s;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.error-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}


.control-panel {
  background: rgba(33, 37, 41, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 15px;
  border-radius: 8px;
  color: white;
  transition: opacity 0.3s ease;
}

#camera-controls {
  position: fixed;
  top: 70px;
  left: 20px;
  z-index: 900;
}

#speech-controls {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 900;
  width: 300px;
}

#debug-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 900;
}

.sub-panel {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 15px;
  margin-top: 15px;
}

.camera-info {
  margin-top: 10px;
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

.form-label {
  color: rgba(255,255,255,0.8);
  margin-bottom: 8px;
}

h6 {
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Ensure buttons have proper contrast */
.btn-secondary {
  background-color: rgba(108, 117, 125, 0.8);
  border-color: rgba(108, 117, 125, 0.9);
  color: white;
}

.btn-secondary:hover {
  background-color: rgba(108, 117, 125, 0.9);
  border-color: rgba(108, 117, 125, 1);
}

/* Scrollbar styling for debug panel */
#debug-panel::-webkit-scrollbar {
  width: 8px;
}

#debug-panel::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

#debug-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

#debug-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.alert {
  max-width: 80%;
}

/* Character Panel Styles moved to character-panel.css */

/* New styles for character field organization */
.character-category {
  margin-bottom: 20px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(58,65,73, 0.15);
}

.category-heading {
  font-size: 1.1rem;
  color: var(--gold-light, #3a4149);
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(58,65,73, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Desktop default - 3 characters side by side */
  gap: 15px;
  justify-content: space-between;
  padding: 0 5px;
}

.character-item {
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.character-item:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.15);
}

.character-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 2px solid rgba(255,255,255,0.2);
  object-fit: cover;
}

.character-name {
  color: white;
  font-size: 1rem;
  margin: 5px 0 2px 0;
}

/* Character field text style */
.character-category, .field-section {
  margin-bottom: 20px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(58,65,73, 0.3);
}

.category-heading, .field-title {
  font-size: 1.2rem;
  color: var(--gold, #3a4149);
  margin: 10px 0;
  text-align: left;
  font-weight: 600;
  padding-left: 5px;
}

/* This duplicate definition was removed */

.character-field {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--gold-light, #3a4149);
  text-align: center;
  margin: 0;
  padding: 0;
  opacity: 0.8;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}


/* Chat Container Styles */
.chat-container {
  position: fixed;
  left: 50%; /* Default position */
  bottom: 180px; /* Increased to 250px to raise it even higher above the input field */
  transform: translateX(-50%);
  width: 80vw;
  height: 55vh; /* Further reduced to 40% of screen height */
  min-width: 500px;
  max-width: 1000px;
  min-height: 480px; /* Further reduced to match 40% height */
  background: transparent;
  transition: all 1.5s cubic-bezier(0.215, 0.610, 0.355, 1.000); /* Match camera cinematic timing */
  z-index: 10; /* Lowered z-index so it doesn't interfere with character selection */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s, left 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none; /* Allow clicks to pass through to 3D scene */
}

.chat-container.visible {
  opacity: 1;
  visibility: visible;
}
.exit-chat-btn {
  pointer-events: auto;
}

.chat-message {
  pointer-events: auto;
}
/* Ensure interactive elements within chat container remain clickable
.chat-container .chat-header,
.chat-container .chat-history,
.chat-container .chat-input-container,
.chat-container .exit-chat-btn,
.chat-container .chat-mode-btn,
.chat-container .chat-message,
.chat-container button,
.chat-container input,
.chat-container textarea,
.chat-container a,
.chat-container .chat-controls {
  pointer-events: auto; Re-enable pointer events for interactive elements
}
 */
/* Style for chat container when input is focused - moves with camera */
.chat-container.chat-focused {
  left: 70% !important; /* Move right when camera moves left - changed to 70% as requested */
  bottom: 150px !important; /* Maintain the 250px bottom spacing when active */
  transform: translateX(-50%) !important;
  transition: all 1.5s cubic-bezier(0.215, 0.610, 0.355, 1.000) !important; /* Match camera timing */
  z-index: 999 !important; /* Ensure highest z-index to prevent overlap issues */
}

/* Style for chat container when bio panel is active - moves to the left */
.chat-container.bio-panel-active {
  left: 35% !important; /* Move left when bio panel is open */
  transform: translateX(-50%) !important;
  transition: left 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  z-index: 50 !important; /* Higher than default but lower than bio panel */
}

/* Combined state: both bio panel active and chat focused */
.chat-container.bio-panel-active.chat-focused {
  left: 40% !important; /* Slightly adjusted position when both conditions are met */
  transition: all 1.5s cubic-bezier(0.215, 0.610, 0.355, 1.000) !important;
}

.chat-header {
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;          /* stretch rows full width */
  user-select: none;
  background: transparent;
  /*border-bottom: 1px solid rgba(255,255,255,0.2);*/
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  flex-shrink: 0;
  width: 80vw;
  min-width: 500px;
  max-width: 1000px;
}

.chat-header-top {
  width: 100%;
  display: flex;
  justify-content: flex-end;    
  align-items: center;
  position: relative;
  padding: 15px;
}



/* Phones */
@media (max-width: 768px) {
  .chat-container {
    width: 70vw;            /* narrower on mobile */
    max-width: 75vw;
    min-width: 0;           /* critical: allow shrinking below 500px */
    height: 40vh;           /* a touch taller for usability */
    min-height: 160px;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%); /* keep centered */
    bottom: 180px; 
  }
}

/* Small phones */
@media (max-width: 480px) {
  .chat-container {
    width: 70vw;
    max-width: 75vw;
    height: 40vh;
    bottom: 180px; 
  }
}

.exit-chat-btn {
  width: 32px;
  height: 32px;
  background-color: rgba(58,65,73, 0.5);
  border: 2px solid rgba(58,65,73, 0.7);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.exit-chat-btn:hover {
  background-color: rgba(58,65,73, 0.7);
  border-color: rgba(58,65,73, 0.9);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.exit-chat-btn:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.exit-chat-btn i {
  font-size: 16px;
  color: white;
  position: relative;
  z-index: 1;
}

.exit-chat-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0);
  transition: transform 0.3s ease;
  border-radius: 50%;
  z-index: 0;
}

.exit-chat-btn:hover::before {
  transform: scale(1);
}

.chat-header-buttons {
  width: 100%;
  display: flex;
  justify-content: flex-start;   /* BUTTONS → left */
  gap: 8px;
  margin-top: 8px;
  
}

.chat-mode-btn {
  background: rgba(0, 0, 0, 0.4)!important;
  border: 1px solid rgba(255, 255, 255, 0.2)!important;
  border-radius: 10px;
  padding: 8px 16px;
  color: rgba(255, 255, 255, 1);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 80px;
}

.chat-mode-btn:hover {
  background: rgba(0, 0, 0, 0.6)!important;
  border-color: rgba(255, 255, 255, 0.4)!important;
  color: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
}

.chat-mode-btn.active {
  background: rgba(0, 0, 0, 0.4)!important;
  border: 1px solid rgba(255, 255, 255, 0.2)!important;
  border-radius: 20px;
  padding: 8px 16px;
  color: rgba(255, 255, 255, 1);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center; /* OPTIONAL → forces true center */
  gap: 6px;
  min-width: 80px;
  transform: translateY(0px);
}

.chat-mode-btn.active:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
}

.chat-mode-btn i {
  font-size: 1rem;
}

/* Notification dot styles */
.chat-mode-btn {
  position: relative;
}

.chat-mode-btn .notification-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #ff4444;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  animation: pulse-notification 2s infinite;
  z-index: 10;
  box-shadow: 0 0 4px rgba(255, 68, 68, 0.5);
}

@keyframes pulse-notification {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.chat-mode-btn.active .notification-dot {
  background: #3a4149;
  border-color: #ffffff;
  animation: none;
}

.chat-mode-content {
  display: none;
  flex-grow: 1;
  overflow: hidden;
}

.chat-mode-content.active {
  display: flex;
  flex-direction: column;
}

/* Allow scrolling specifically for image content */
#image-content.chat-mode-content {
  overflow: visible !important;
}

#image-content.chat-mode-content.active {
  overflow: visible !important;
  min-height: 0 !important;
  height: 100% !important;
}

/* Image Viewer Styles - Full Window */
.image-display {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0; /* Allow flexbox to shrink */
  background: transparent;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0;
  margin: 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
  pointer-events: auto;
}

/* Hide scrollbar for WebKit browsers */
.image-display::-webkit-scrollbar {
  display: none;
}

/* Override conflicting modal styles when used in chat */
#image-content .image-viewer-container {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* Internet Explorer 10+ */
}

/* Hide scrollbar for WebKit browsers in chat container */
#image-content .image-viewer-container::-webkit-scrollbar {
  display: none !important;
}

/* Masonry Layout Styles for Chat Image Display */
.image-masonry {
  column-count: 1;
  column-gap: 15px;
  width: 100%;
  height: auto;
  min-height: 100%;
  padding: 15px;
  margin: 0;
  overflow: visible;
  box-sizing: border-box;
  display: block;
}

/* Hide scrollbar for WebKit browsers */
.image-masonry::-webkit-scrollbar {
  display: none;
}

/* Responsive column adjustments */
@media (max-width: 768px) {
  .image-masonry {
    column-count: 1;
    column-gap: 10px;
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .image-masonry {
    column-count: 1;
    column-gap: 0;
    padding: 8px;
  }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
  display: inline-block;
  width: 100%;
}

.image-keyword {
  background: rgba(58,65,73, 0.3);
  color: white;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 10px;
  border-radius: 10px;
  text-transform: capitalize;
}

/* Removed hover effect since images are no longer clickable */

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* Simple no-images message styling */
.no-images-message {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 20px;
}

.no-images-message p {
  font-size: 1rem;
  margin: 0;
  font-weight: normal;
}

.image-display img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* Masonry Layout Styles - Full Window */
.image-grid {
  column-count: auto;
  column-width: 200px;
  column-gap: 8px;
  width: 100%;
  height: 100%;
  padding: 8px;
  margin: 0;
  box-sizing: border-box;
}

.image-grid-item {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
  break-inside: avoid;
  display: inline-block;
  width: 100%;
}

.image-grid-item:hover {
  transform: scale(1.02);
  border-color: rgba(58,65,73, 0.5);
  box-shadow: 0 4px 15px rgba(58,65,73, 0.3);
}

.image-grid-item img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  transition: filter 0.3s ease;
  display: block;
}

.image-grid-item:hover img {
  filter: brightness(1.1);
}

.image-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.image-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 1);
}

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

#image-counter {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  min-width: 60px;
  text-align: center;
}

.image-info {
  padding-top: 10px;
}

.image-info h4 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin-bottom: 5px;
  font-weight: 600;
}

.image-info p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.4;
}

/* Video Display Styles - Clean Minimal Design */
.video-display-container {
  width: 100%;
  height: 100%;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
}

.video-display-container::-webkit-scrollbar {
  display: none;
}

/* Videos wrapper for vertical stacking */
.videos-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0;
  margin: 0;
}

/* Video item wrapper (keyword + video) */
.video-item-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* Keyword header above video - matching image keyword style */
.video-keyword-header {
  width: 100%;
  background: rgba(58,65,73, 0.3);
  color: white;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 5px;
  border-radius: 10px;
  text-transform: capitalize;
}

/* Individual video container with 16:9 aspect ratio */
.video-item-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.video-item-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.chat-top-bar {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  padding: 25px; 
}

.chat-top-bar-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.drag-indicator {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 5px;
}

.drag-line {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  margin: 0 auto;
  transition: background-color 0.2s ease;
}

.chat-top-bar:hover .drag-line {
  background: rgba(255, 255, 255, 0.25);
}

.chat-container.dragging {
  opacity: 0.95;
  transition: none;
}

.chat-controls {
  display: flex;
  gap: 8px;
}

.chat-controls button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 4px 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.chat-controls button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.chat-history {
  flex-grow: 1;
  overflow-y: auto;
  padding: 15px;
  /*background: none;*/
  display: flex;
  flex-direction: column;
}

/* Add a spacer that pushes first message to bottom but allows scrolling */
.chat-history::before {
  content: '';
  flex-grow: 1;
  min-height: 0;
}

/* Message type styling */
.chat-message.error-message {
  background: rgba(255, 0, 0, 0.1);
  border-left: 3px solid #ff5555;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}

.chat-message.success-message {
  background: rgba(0, 200, 0, 0.1);
  border-left: 3px solid #5cd65c;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}

.chat-message.system-message {
  background: rgba(0, 100, 255, 0.1);
  border-left: 3px solid #5c7bd6;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}

/* Microphone permission button styling */
#request-mic-permission {
  background: #4285f4;
  color: white;
  font-weight: 600;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  display: inline-block;
  text-align: center;
}

#request-mic-permission:hover {
  background: #2a75f3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Scrollbar styling */
.chat-history::-webkit-scrollbar {
  width: 6px;
}

.chat-history::-webkit-scrollbar-track {
  background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Subtitle-related styles removed */

/* Animation styles */

.chat-message {
  margin-bottom: 15px;
  width: fit-content;
  word-wrap: break-word;
}

/* ============================
   Standard Chat Font & Layout
   ============================ */
.user-message, .bot-message {
  font-size: 16px;         /* Standard desktop font */
  line-height: 1.45;
  word-wrap: break-word;
}

/* ============================
   USER MESSAGE (Right side)
   ============================ */
.user-message {
  margin-left: auto;
  background: rgba(58,65,73, 1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(58,65,73, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: rgba(0, 0, 0, 1);
  min-width: 40%;
  max-width: 70%;
}

/* ============================
   BOT MESSAGE (Left side)
   ============================ */
.bot-message {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: rgba(0, 0, 0, 1);
  max-width: 85%;
}

/* ============================
   MOBILE / SMARTPHONE VERSION
   ============================ */
@media (max-width: 600px) {
  .user-message, .bot-message {
    font-size: 12px;      /* Slightly smaller for mobile */
    padding: 10px 14px;   /* Tighter spacing */
    max-width: 95%;       /* Use more screen width */
    min-width: 60%;       /* Prevent tiny bubbles */
  }

  .user-message {
    border-radius: 10px;
  }

  .bot-message {
    border-radius: 10px;
  }
}


/* Word highlighting styles */
.highlightable-word {
  transition: all 0.3s ease;
  border-radius: 3px;
  padding: 1px 2px;
}

.word-highlighted {
  background: rgba(58,65,73, 0.4);
  color: rgba(0, 0, 0, 0.9);
  border-radius: 3px;
  padding: 1px 3px;
  box-shadow: 0 1px 2px rgba(58,65,73, 0.3);
  transition: all 0.2s ease;
}

.highlightable-content {
  line-height: 1.6;
}

.chat-input-container {
  padding: 15px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.chat-input-group {
  display: flex;
  gap: 10px;
}

/* Chat input styles moved to inline CSS in template for better organization */

/* Send button styles moved to inline CSS in template for better organization */

#mic-button {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  transition: all 0.3s ease;
}


.floating-mic-container {
  position: fixed;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100; /* Increased to be on the same level as character panel */
  display: flex;
  flex-direction: row;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 5px 15px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1)!important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  width: 80vw;
  max-width: 1000px;
  min-width: 500px;
}

/* Volume Control Styles */
.volume-control-container {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 10px;
}

.volume-toggle-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(58,65,73, 0.5);
  border: 1px solid rgba(58,65,73, 0.3);
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.volume-toggle-button:hover {
  background: rgba(58,65,73, 0.7);
  border-color: rgba(58,65,73, 0.8);
  transform: scale(1.05);
}

.volume-toggle-button i {
  font-size: 14px;
}

.volume-slider-container {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  border-radius: 15px;
  padding: 15px 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 120px;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.volume-slider {
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.chat-buttons-section { position: relative; z-index: 9999; }

.volume-slider::-webkit-slider-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: rgba(58,65,73, 0.9);
  cursor: pointer;
  -webkit-appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  background: rgba(172, 156, 84, 1);
  transform: scale(1.1);
}
#volume-slider-container {
  display: inline-flex !important;
  align-items: center; gap: 8px;
  width: 0; opacity: 0; overflow: hidden;
  transition: width .18s ease, opacity .18s ease;
}
#volume-controller-side:hover #volume-slider-container {
  width: 180px; opacity: 1;
}
.volume-slider::-moz-range-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  border: none;
}

.volume-slider::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: rgba(58,65,73, 0.9);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

/* Dim icon when muted */
#volume-toggle.muted { opacity: 0.6; }

.volume-percentage {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8)1100
  font-weight: 500;
  min-width: 35px;
  text-align: center;
}

.floating-side-buttons {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
}

.left-buttons {
  margin-right: 5px;
}

.right-buttons {
  margin-left: 5px;
}

.floating-side-button {
  background: rgba(33, 37, 41, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.floating-side-button:hover {
  background: rgba(58,65,73, 0.3);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.mic-button-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    transition: transform 0.3s ease-out;
}

/* Microphone active state with pulsing indicator */
.mic-button-container.listening:after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #ff3b30;
    border-radius: 50%;
    top: -5px;
    right: -5px;
    animation: mic-pulse 1.5s infinite;
    z-index: 3;
}

/* Add animation for the microphone button itself when listening */
.mic-button-container.listening {
    animation: mic-grow 0.3s forwards;
}

/* Add animation for the microphone icon when listening */
.mic-button-container.listening .mic-icon {
    animation: mic-breathe 2s infinite ease-in-out;
    color: rgba(58,65,73, 1);
}

/* Add pulse ring animation when listening */
.mic-button-container.listening .mic-pulse-ring {
    animation: pulse-ring 2s infinite ease-out;
    opacity: 1;
    border-color: rgba(58,65,73, 0.8);
}

@keyframes mic-pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
   
  z-index: 1100; }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

@keyframes mic-grow {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.15);
    }
}

@keyframes mic-breathe {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
 1100  }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
        border-color: rgba(58,65,73, 0.8);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1000.4;
        border-color: rgba(58,65,73, 0.6);
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
        border-color: rgba(58,65,73, 0.2);
    }
}

.floating-mic-button {
  background: rgba(0, 0, 0, 0.3);
  border: 2px100lid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: all 0.3s ease;
  position: relative;
}

.floating-mic-button:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.floating-mic-button:hover .mic-icon {
  color: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

/* Microphone Icon Styles */
.mic-icon {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
  z-index: 2;
  position: relative;
}

/* Pulse ring for microphone animation */
.mic-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border: 2px solid rgba(58,65,73, 0.6);
  border-radius: 50%;
  opacity: 0;
  z-index: 1;
}

.floating-mic-status {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.9rem;
  background: rgba(33, 37, 41, 0.8);
  padding: 5px 15px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
  z-index: 1002;
}

/*.stop-audio-button {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(220, 53, 69, 1); 
  border: 3px solid rgba(255, 255, 255, 1);
  border-radius: 20px; 
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  object-fit: cover;
  display: block;
  z-index: 2020;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  mix-blend-mode: screen;
}

.stop-audio-button:hover {
  background: rgb(220, 53, 69);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stop-audio-button i {
  font-size: 1.2em;
}*/

/* Responsive adjustments for character grid at different screen sizes */
/* For tablet screens - 3 characters side by side */
@media (min-width: 768px) and (max-width: 1199px) {
  .character-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .field-section, .character-category {
    margin-bottom: 25px;
  }
}

/* For mobile screens - 2 characters side by side */
@media (max-width: 767px) {
  .character-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .character-image {
    width: 100px;
    height: 100px;
  }
  
  .character-name {
    font-size: 0.9rem;
  }
  
  .field-section, .character-category {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }
}

/* Character panel scrollbars are now hidden - styles moved to character-panel.css */

/* Chat history panel scrollbar styles - hide scrollbar */
.chat-history-panel .history-content::-webkit-scrollbar {
  display: none;
}

.chat-history-panel .history-content {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Chat Position Controls */
#chat-position-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  color: white;
  z-index: 1100;
  width: 300px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#chat-position-controls.collapsed {
  width: 40px;
  height: 40px;
  overflow: hidden;
  padding: 0;
}

.controls-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.controls-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.collapsed .controls-toggle {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

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

.control-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: rgba(66, 133, 244, 0.8);
  border-radius: 50%;
  cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: rgba(66, 133, 244, 0.8);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.control-value {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  width: 40px;
  text-align: right;
}

.presets {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 5px 10px;
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Image Gallery Panel Styles */
#image-gallery-panel {
  position: fixed;
  bottom: 0;
  left: 20px;
  width: 20vw;  /* Set to one-fourth of viewport width */
  min-width: 500px;
  max-width: 20vw;
  height: 40vh;
  max-height: 100vh; /* Apply the same 85% viewport height constraint */
  background: rgba(255, 255, 255, 0.2);  /* Lighter background for macOS style */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.2);
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(calc(100% - 85px)); /* Initially show only the drag area and header, matching character panel */
}

/* Updated Image Gallery Panel Styles */
.image-gallery {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
  height: calc(100% - 40px); /* Account for drag handle */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
}

/* Loading and error states */
.loading-container, .error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  width: 100%;
  color: white;
  text-align: center;
  padding: 20px;
}

/* Gallery title row */
.gallery-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}

.gallery-title {
  color: white;
  margin: 0;
  font-size: 1.25rem;
}

/* Gallery search options */
.gallery-search-options {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
}

.gallery-search-options .input-group {
  margin-bottom: 10px;
}

.gallery-search-options .form-check-label {
  color: white;
  font-size: 0.9rem;
}

.gallery-search-options .badge {
  margin-left: 5px;
  font-size: 0.75rem;
  padding: 3px 6px;
}

.gallery-search-options .form-control {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.gallery-search-options .form-control::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.gallery-search-options .form-control:focus {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.gallery-search-options .btn-primary {
  background: rgba(13, 110, 253, 0.8);
  border: 1px solid rgba(13, 110, 253, 0.5);
}

/* Empty state */
.no-images {
  width: 100%;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

/* Error icon styling */
.error-icon {
  color: #3a4149;
}

/* Custom scrollbar for image gallery */
.image-gallery::-webkit-scrollbar {
  width: 6px;
}

.image-gallery::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin: 4px;
}

.image-gallery::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  transition: background 0.2s ease;
}

.image-gallery::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  height: 450px; 
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  transition: filter 0.3s ease;
}

.image-description {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 32, 36, 0.92);  /* Darker overlay for better readability */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gallery-item:hover .image-description {
  opacity: 1;
}

.image-description p {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.6;
  overflow-y: auto;
  max-height: calc(100% - 60px); /* Leave space for button */
  padding-right: 5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  font-weight: 400;
  letter-spacing: 0.015em;
}

/* Custom scrollbar for description */
.image-description p::-webkit-scrollbar {
  width: 1px;
}

.image-description p::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.image-description p::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

.image-description .btn {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  background: rgba(66, 133, 244, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.image-description .btn:hover {
  background: rgba(66, 133, 244, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.zoom-icon {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 8px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .zoom-icon {
  opacity: 1;
}

.zoom-icon i {
  font-size: 1.2em;
  color: white;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Ensure modal content has dark theme */
#imageModal .modal-content {
  background: rgba(33, 37, 41, 0.2);
  border: 1px solid rgba(255,255,255,0.1);
}

#imageModal .modal-header {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

#imageModal .modal-title {
  color: white;
}

/* Bio Button */
.bio-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1100;
    transition: all 0.3s ease;
    overflow: hidden;
}

.bio-button:hover {
    transform: scale(1.1);
    border-color: var(--gold);
}

.bio-button-active {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(58,65,73, 0.5);
    background: rgba(58,65,73, 0.2);
}

/* Bio Panel Styles moved to bio-panel.css */