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


body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e0f2ff, #f1f5f9);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  color: #0f172a;
}


html, body {
  height: 100%;
}

.fullheight {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.app {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  width: 100%;
  max-width: 720px;
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-bar {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.96);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.app-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(120deg, #ffd500, #ffd500);
  color: white;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-circle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
}

.app-header h1 {
  font-size: 20px;
  line-height: 1.1;
}

.app-header p {
  font-size: 12px;
  opacity: 0.9;
}

.chat-container {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-row {
  display: flex;
  margin-bottom: 4px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  display: flex;
  align-items: flex-start;
}


.message-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  background: #0ea5e9;
  color: white;
  border-bottom-right-radius: 4px;
}

.message-row.assistant .message-bubble {
  background: #e2e8f0;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}

.meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.message-row.assistant .meta {
  margin-left: 4px;
}

.message-row.user .meta {
  margin-right: 4px;
  text-align: right;
}

.input-bar {
  padding: 10px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.96);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#user-input {
  flex: 1;
  border: 1px solid #cbd5f5;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  resize: none;
  max-height: 96px;
  outline: none;
  background: white;
}

#user-input:focus {
  border-color: #ffd500;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.35);
}

#send-button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  background: #ffd500;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.1s ease;
  white-space: nowrap;
}

#send-button:disabled {
  opacity: 0.6;
  cursor: default;
}

#send-button:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

@media (max-width: 600px) {
  .app {
    border-radius: 18px;
  }

  .chat-container {
    padding: 12px 12px;
  }

  .input-bar {
    padding: 8px 10px;
  }
}
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 32px;
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #64748b;
  opacity: 0.4;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

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

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

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.avatar-circle {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
}

.avatar-circle .avatar-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
}

.message-controls {
  margin: 4px 0 0 40px; /* slight indent so it lines up under the bubble */
}

.speak-button {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: #e2e8f0;
  color: #0f172a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speak-button:hover {
  background: #cbd5f5;
}

.message-bubble {
  position: relative; /* needed for positioning the play icon */
  padding-right: 32px; /* room for the button */
}



.meta-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
  gap: 8px;
  padding-right: 4px;
}

.play-audio-btn-inline {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.play-icon {
  width: 18px;
  height: 18px;
}
/* 
.play-audio-btn-inline {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 15px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.play-audio-btn-inline:hover {
  opacity: 1;
} */