
body {
  font-family: Arial, sans-serif;
  background: #fff;
  color: #333;
  margin: 0;
  padding: 1em;
}

#app {
  max-width: 600px;
  margin: auto;
}

.controls {
  display: flex;
  margin-top: 1em;
  gap: 12px;
}


#record {
  width: 160px;
  flex-shrink: 0;
  padding: 0.8em;
  font-size: 15px;
  background: #1274dd;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#textInput {
  flex: 1;
  padding: 0.8em;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* Shrink the audio player and float it to the corner */
.tiny-audio {
  width: 28px;
  height: 28px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  margin-top: -6px;
  float: right;
  opacity: 0.7;
  background: transparent;
}

/* Hide timeline, just show the button */
.tiny-audio::-webkit-media-controls-panel {
  background: none;
}
.tiny-audio::-webkit-media-controls-timeline,
.tiny-audio::-webkit-media-controls-current-time-display,
.tiny-audio::-webkit-media-controls-time-remaining-display,
.tiny-audio::-webkit-media-controls-volume-slider {
  display: none !important;
}

.chat-container {
  border: 1px solid #ccc;
  padding: 1em;
  height: calc(100vh - 200px);
  overflow-y: auto;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
}

.chat-bubble {
  margin: 18px 0px;
  padding: 0px;
  border-radius: 10px;
  /* max-width: 85%; */
  width: 95%;
}

.chat-bubble.user {
  background: transparent; /* d0f0ff */
  align-self: flex-end;
}

.chat-bubble.assistant {
  background: transparent; /* e8e8e8 */
  align-self: flex-start;
}

/* .chat-bubble .timestamp {
  display: block;
  font-size: 0.75em;
  color: #888;
  margin-top: 4px;
  text-align: right;
} */


.chat-bubble {
  display: flex;
  flex-direction: column;
  margin-bottom: 0px;
}

.chat-bubble .message-text {
  color: #333;
  font-size: 0.84rem;
  line-height: 1.3rem;
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 500;
}
.chat-bubble.user .message-text {
  background: #d0f0ff;
  font-style: italic;
  font-weight: 400;
}
.chat-bubble.assistant .message-text {
  background: #e8e8e8;
  font-weight: 400;
}

.chat-bubble .timestamp {
  font-size: 0.73rem;
  color: #888;
  margin-top: 2px;
  text-align: right;
}

.play-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.73em;
  margin-left: 6px;
  opacity: 0.7;
  transition: opacity 0.2s;
  text-align: right;
  padding: 0px;
}
.play-button:hover {
  opacity: 1;
}

.stop-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.73em;
  margin-left: 6px;
  opacity: 0.7;
  transition: opacity 0.2s;
  color: #d9534f;
  padding: 0px;
}
.stop-button:hover {
  opacity: 1;
}

.chat-bubble.user .play-button {
  text-align: right;
}

.chat-bubble.assistant .play-button {
  text-align: left;
}

.chat-bubble.assistant .stop-button {
  text-align: left;
}

.chat-bubble.user .timestamp {
  text-align: right;
}
.chat-bubble.assistant .timestamp {
  text-align: left;
}

.bubble-tools-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0px;
  margin-top: 6px;
  padding: 0px 6px;
}

.chat-bubble.user .bubble-tools-wrapper {
  justify-content: flex-end;
}
.chat-bubble.assistant .bubble-tools-wrapper {
  justify-content: flex-start;
}

.chat-bubble.user .message-text.thinking,
.chat-bubble.assistant .message-text.thinking {
  color: #666;
  font-style: italic;
  opacity: 0.8;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.chat-bubble.user .message-text,
.chat-bubble.assistant .message-text {
  transition: color 0.3s ease, opacity 0.3s ease;
}


/* MD styling */
.chat-bubble.assistant .message-text p {
  margin: 4px 0;
}

.chat-bubble.assistant .message-text code {
  background: #f2f2f2;
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
}

.chat-bubble.assistant .message-text pre code {
  display: block;
  padding: 8px;
  overflow-x: auto;
}


.session-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  z-index: 1000;
}
.session-panel {
  position: fixed;
  right: -320px;
  top: 0;
  width: 300px;
  height: 100%;
  background: #fff;
  border-left: 1px solid #ccc;
  box-shadow: -2px 0 6px rgba(0,0,0,0.1);
  transition: right 0.3s ease;
  z-index: 999;
  overflow-y: auto;
  padding: 16px;
}
.session-panel.open {
  right: 0;
}
.session-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
  cursor: pointer;
}
.session-item:hover {
  background: #eee;
}

.chat-controls {
  position: relative;
  width: calc(100% - 12px);
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
  margin: 0px 6px 12px 6px;
}

.session-btn {
  background: #222;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.session-btn:hover {
  background: #333;
}

.session-btn.clear {
  background: #b33;
}

.session-btn.clear:hover {
  background: #c44;
}

.control-btn {
  background: #444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.control-btn.danger {
  background: #b33;
}
.control-btn.primary {
  background: #1274dd;
}
.control-btn.secondary {
  background: #ddd;
  color: #333;
}

.session-panel {
  position: fixed;
  right: -320px;
  top: 0;
  height: 100%;
  width: 300px;
  background: #f4f4f4;
  border-left: 2px solid #ccc;
  box-shadow: -3px 0 10px rgba(0, 0, 0, 0.15);
  padding: 15px;
  transition: right 0.3s ease;
  overflow-y: auto;
  z-index: 1000;
}

.session-panel.open {
  right: 0;
}

.session-panel h3 {
  margin-top: 0;
}


.session-item {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: stretch;
}

.session-load-btn {
  flex: 1;
  text-align: left;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-load-btn:hover {
  background: #e9e9e9;
}

.session-delete-btn {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.session-delete-btn:hover {
  background: #fee;
  border-color: #b33;
}


.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.session-header h3 {
  margin: 0;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #ddd;
  color: #333;
}

.control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Image generation loading spinner */
.image-loading {
  display: inline-block;
  margin-left: 8px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(100, 150, 255, 0.3);
  border-top-color: #6496ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.generating-text {
  font-style: italic;
  color: #6496ff;
}
