
body {
  font-family: Arial, sans-serif;
  background: #fff;
  color: #333;
  margin: 0;
  padding: 12px;
}

@media(max-width: 767px) {
  body {
    font-family: Arial, sans-serif;
    background: #fff;
    color: #333;
    margin: 0;
    padding: 6px;
  }
}

#app {
  max-width: 768px;
  margin: auto;
}

:root {
  --color-primary: #68B145;
  --color-primary-light: #97df76;
  --color-primary-lighter: #c1e2b3;
  --color-secondary: #196091;
  --color-secondary-light: #3E99D6;
  --color-secondary-lighter: #96CFF5;
  --color-tertiary: #5C3E7E;
  --color-tertiary-light: #8D67B8;
  --color-tertiary-lighter: #B89DDC;
  --color-quaternary: #F07822;
  --color-quaternary-light: #FEB389;
  --color-quaternary-lighter: #FEDAC7;

}

.controls {
  display: flex;
  margin-top: 1em;
  gap: 12px;
}


:root {
  --bottom-offset: 180px;
}

.home-category h3 {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}
.home-category h3 svg {
  margin-top: -3px;
  margin-right: 6px;
  height: 30px;
  width: 30px;
}
.home-category h3 svg path {
  fill:var(--color-secondary-light);
}

#record {
  width: 40%;
  max-width: 160px;
  flex-shrink: 0;
  padding: 0.8em 12px;
  font-size: 15px;
  background: var(--color-secondary-light);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
#record svg path {
  fill: #fff;
  margin-right: 9px;
}

#textInput {
  width: 60%;
  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 - var(--bottom-offset)); /* -200px */
  overflow-y: auto;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
}
@media(max-width: 700px) {
  .chat-container {
    padding: 0.7em;
  }
}

.chat-bubble {
  margin: 18px 0px;
  padding: 0px;
  border-radius: 10px;
  /* max-width: 85%; */
  width: 95%;
}
@media(max-width: 640px) {
  .chat-bubble {
    width: 98%;
  }
}

.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;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.stop-button:hover {
  opacity: 1;
}
.stop-button-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(217, 83, 79, 0.25);
  border-top-color: #d9534f;
  border-radius: 50%;
  animation: stop-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes stop-spin {
  to { transform: rotate(360deg); }
}

.graph-this-btn {
  background: none;
  border: 1px solid var(--color-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72em;
  margin-left: 8px;
  padding: 7px 7px;
  color: var(--color-secondary);
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
}
.graph-this-btn:hover {
  opacity: 1;
  background: var(--color-secondary-light);
  color: #fff;
}

.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: -360px;
  top: 0;
  width: 280px;
  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: 6px 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;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
}

.control-btn.danger {
  background: #b33;
}
.control-btn.primary {
  background: var(--color-secondary-light);
}
.control-btn.secondary {
  background: #ddd;
  color: #333;
}

.control-btn.primary svg path {
  fill: #fff;
}

#app-home.control-btn {
  background: #ddd;
  color: #222;
  border: none;
  border-radius: 6px;
  border: solid 2px var(--color-secondary-light);
  padding: 4px 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
#app-home svg path {
  fill: var(--color-secondary-light);
}


.session-panel {
  position: fixed;
  right: -360px;
  top: 0;
  height: 100%;
  width: 280px;
  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;
}

.user-info-label {
  margin-left: auto;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  align-self: center;
  padding: 0 4px;
}

/* 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;
}


#quickActions {
    padding: 0px 0px 12px 0px;
    margin: 0px 0px 18px 0px;
    border-bottom: 1px solid #ddd;
}

#quickActions h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
}

/* .quick-action-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    margin-bottom: 9px;
    background: #445669;
    border: 1px solid #d0d9f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    transition: background 0.2s;
}

.quick-action-btn:hover {
    background: #4d5f74;
} */

.quick-action-btn {
    /* display: block; */
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    margin-bottom: 7px;
    background: #e0f0f8; /* d0f0ff */
    border: 1px solid #bfc9e2; /* d0d9f0 */
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    transition: background 0.2s;
    display: flex;
    flex-direction: row;
    gap: 9px;
    justify-content: flex-start;
    align-items: center;
}

.quick-action-btn:hover {
    background: #d0f0ff; /* daf1fc */
}


#home-panel {
    display: none;
    flex-direction: column;
    height: calc(100vh - var(--bottom-offset));
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 10px;
}

.home-grid h2 {
    margin: 0 0 24px 0;
    font-size: 1.3rem;
    color: #333;
}

.home-category {
    margin-bottom: 24px;
}

.home-category h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: #555;
    border-bottom: 1px solid #ddd;
    padding-bottom: 6px;
}

.home-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.home-buttons button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 9px 14px;
    background: #e0f0f8;
    border: 1px solid #bfc9e2;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.home-buttons button:hover {
    background: #d0f0ff;
}

.home-buttons button strong {
    font-size: 0.9rem;
    color: #222;
    margin-bottom: 4px;
}

.home-buttons button span {
    font-size: 0.78rem;
    color: #666;
    line-height: 1.3;
}
/* ── Invite followup action card ─────────────────────────── */
.invite-followup-card {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.invite-followup-btn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--color-secondary, #4a90d9);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.invite-followup-yes {
  background: var(--color-secondary, #4a90d9);
  color: #fff;
}
.invite-followup-yes:hover { opacity: 0.85; }
.invite-followup-no {
  background: transparent;
  color: var(--color-secondary, #4a90d9);
}
.invite-followup-no:hover { background: #f0f7ff; }

/* ── Template picker (inline in chat bubble) ─────────────── */
.template-picker-inline {
  margin-top: 12px;
  padding: 14px;
  background: #f8f9fb;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
}
.template-picker-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: #222;
}
.template-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.template-card {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.template-card:hover {
  border-color: var(--color-secondary, #4a90d9);
  box-shadow: 0 2px 8px rgba(74,144,217,0.2);
}
.template-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: contain;
  background: #f5f5f5;
  display: block;
}
.template-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f7ff;
  font-size: 2rem;
  color: #aac;
}
.template-card-name {
  font-size: 0.75rem;
  padding: 6px 8px;
  color: #333;
  line-height: 1.3;
}
.template-picker-cancel {
  display: block;
  margin: 0 auto;
  padding: 6px 20px;
  border: 1px solid #ccc;
  border-radius: 16px;
  background: transparent;
  font-size: 0.82rem;
  cursor: pointer;
  color: #666;
}
.template-picker-cancel:hover { background: #f5f5f5; }

/* ── Product offer picker (inline in chat bubble) ─────────── */
.product-picker-inline {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-option-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  border: 2px solid #d0e8ff;
  border-radius: 8px;
  background: #f0f7ff;
  color: #1a4a7a;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.product-option-btn:hover {
  background: #daeeff;
  border-color: #4a9cd6;
}
