.gais-wrapper {
  --gais-radius: 16px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  height: 640px;
  margin: 24px auto;
  background: var(--gais-bg);
  color: var(--gais-text);
  border-radius: var(--gais-radius);
  overflow: hidden;
  font-family: "Google Sans", Roboto, Arial, sans-serif;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  border: 1px solid rgba(128,128,128,0.15);
}

.gais-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--gais-panel);
  border-bottom: 1px solid rgba(128,128,128,0.15);
}

.gais-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gais-logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gais-accent);
  flex-shrink: 0;
}

.gais-title {
  font-size: 16px;
  font-weight: 500;
}

.gais-new-chat {
  background: transparent;
  border: 1px solid var(--gais-accent);
  color: var(--gais-accent);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.gais-new-chat:hover {
  background: rgba(138,180,248,0.12);
}

.gais-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gais-empty-state {
  margin: auto 0;
  text-align: center;
  padding: 20px;
}
.gais-empty-icon {
  font-size: 30px;
  color: var(--gais-accent);
  margin-bottom: 8px;
}
.gais-empty-title {
  font-size: 22px;
  font-weight: 500;
  margin: 4px 0;
}
.gais-empty-sub {
  opacity: 0.7;
  font-size: 14px;
  margin-bottom: 18px;
}

.gais-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.gais-chip {
  background: var(--gais-panel);
  color: var(--gais-text);
  border: 1px solid rgba(128,128,128,0.25);
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.gais-chip:hover {
  border-color: var(--gais-accent);
}

.gais-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.gais-msg.user {
  align-self: flex-end;
  background: var(--gais-user-bubble);
  color: var(--gais-text);
  border-bottom-right-radius: 4px;
}
.gais-msg.bot {
  align-self: flex-start;
  background: transparent;
  border: 1px solid rgba(128,128,128,0.2);
  border-bottom-left-radius: 4px;
}
.gais-msg.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 16px;
}
.gais-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gais-accent);
  animation: gais-bounce 1s infinite ease-in-out;
}
.gais-dot:nth-child(2) { animation-delay: 0.15s; }
.gais-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes gais-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.gais-input-row {
  padding: 12px 18px 16px;
  background: var(--gais-bg);
}

.gais-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--gais-panel);
  border-radius: 26px;
  padding: 8px 8px 8px 18px;
  border: 1px solid rgba(128,128,128,0.2);
}

.gais-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--gais-text);
  font-size: 14.5px;
  max-height: 120px;
  padding: 6px 0;
  font-family: inherit;
}

.gais-send-btn {
  background: var(--gais-accent);
  color: var(--gais-bg);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.gais-send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.gais-disclaimer {
  text-align: center;
  font-size: 11px;
  opacity: 0.55;
  margin: 8px 0 0;
}

/* Light theme tweaks */
.gais-theme-light .gais-msg.bot {
  border-color: rgba(0,0,0,0.1);
}
.gais-theme-light .gais-chip {
  border-color: rgba(0,0,0,0.15);
}

@media (max-width: 600px) {
  .gais-wrapper {
    height: 80vh;
    border-radius: 0;
    margin: 0;
  }
}

/* ===== Attach button + menu ===== */
.gais-attach-wrap {
  position: relative;
  flex-shrink: 0;
}

.gais-icon-btn {
  background: transparent;
  border: none;
  color: var(--gais-text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.75;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.gais-icon-btn:hover {
  opacity: 1;
  background: rgba(128,128,128,0.15);
}

.gais-attach-menu {
  position: absolute;
  bottom: 44px;
  left: 0;
  background: var(--gais-panel);
  border: 1px solid rgba(128,128,128,0.25);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  min-width: 200px;
  padding: 6px;
  z-index: 20;
}

.gais-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--gais-text);
  font-size: 14px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.gais-menu-item:hover {
  background: rgba(128,128,128,0.15);
}
.gais-menu-icon {
  margin-right: 6px;
}

.gais-toggle-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(128,128,128,0.25);
  opacity: 0.8;
}
.gais-toggle-pill.on {
  background: var(--gais-accent);
  color: var(--gais-bg);
  opacity: 1;
}
.gais-think-toggle-item.active,
.gais-search-toggle-item.active {
  background: rgba(138,180,248,0.12);
}

.gais-think-banner {
  font-size: 12px;
  text-align: center;
  opacity: 0.8;
  margin: 6px 0 0;
  color: var(--gais-accent);
}

/* ===== Mic button ===== */
#gais-mic-btn.recording {
  color: #ff4d4f;
  opacity: 1;
  animation: gais-mic-pulse 1s infinite;
}
@keyframes gais-mic-pulse {
  0%, 100% { background: rgba(255,77,79,0.12); }
  50% { background: rgba(255,77,79,0.28); }
}

/* ===== Attachment preview (before sending) ===== */
.gais-attachment-preview {
  display: flex;
  margin-bottom: 8px;
}
.gais-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gais-panel);
  border: 1px solid rgba(128,128,128,0.25);
  border-radius: 10px;
  padding: 6px 10px;
  max-width: 260px;
}
.gais-attachment-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
}
.gais-attachment-icon {
  font-size: 16px;
}
.gais-attachment-name {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.gais-attachment-remove {
  background: transparent;
  border: none;
  color: var(--gais-text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 2px;
}
.gais-attachment-remove:hover {
  opacity: 1;
}

/* ===== Attachments inside sent messages ===== */
.gais-msg-image {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  display: block;
  margin-bottom: 6px;
}
.gais-msg-file {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 4px;
}

/* ===== Search grounding sources ===== */
.gais-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(128,128,128,0.25);
}
.gais-sources-label {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.gais-sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gais-source-chip {
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(128,128,128,0.15);
  color: var(--gais-accent);
  text-decoration: none;
  border: 1px solid rgba(128,128,128,0.25);
}
.gais-source-chip:hover {
  background: rgba(138,180,248,0.15);
  text-decoration: underline;
}
