/* ============================================================
   HOME CHAT SECTION — scoped under .home-chat-section
   ============================================================ */

.home-chat-section {
  --hcs-bg: #0a0a0a;
  --hcs-bg-secondary: #141414;
  --hcs-bg-sidebar: #0f0f0f;
  --hcs-bg-input: #1a1a1a;
  --hcs-text: #ececec;
  --hcs-text-secondary: #a0a0a0;
  --hcs-text-muted: #666;
  --hcs-border: #1f1f1f;
  --hcs-hover: #1a1a1a;
  --hcs-accent: #ef233c;
  --hcs-accent-dark: #b01a33;

  position: relative;
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: var(--hcs-bg);
  overflow: hidden;
}

.home-chat-section .hcs-section-header {
  text-align: center;
  padding: 48px 24px 0;
}

.home-chat-section .hcs-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 9999px;
  border: 1px solid rgba(239,35,60,0.2);
  background: rgba(239,35,60,0.08);
  padding: 6px 14px;
  margin-bottom: 16px;
}

.home-chat-section .hcs-section-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--hcs-accent);
  animation: hcsPulse 2s ease-in-out infinite;
}

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

.home-chat-section .hcs-section-badge span:last-child {
  color: var(--hcs-accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.home-chat-section .hcs-section-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 8px;
}

.home-chat-section .hcs-section-subtitle {
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  color: rgba(255,255,255,0.5);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ========== WRAPPER ========== */
.home-chat-section .hcs-wrapper {
  display: flex;
  height: 85vh;
  min-height: 550px;
  max-height: 800px;
  margin: 24px 0 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: 1px solid var(--hcs-border);
  border-bottom: 1px solid var(--hcs-border);
  overflow: hidden;
  background: var(--hcs-bg);
}

/* ========== SIDEBAR ========== */
.home-chat-section .hcs-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--hcs-bg-sidebar);
  border-right: 1px solid var(--hcs-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-chat-section .hcs-sidebar-top {
  padding: 16px;
  display: flex;
  align-items: center;
}

.home-chat-section .hcs-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-chat-section .hcs-sidebar-logo img {
  width: 28px; height: 28px; object-fit: contain;
}

.home-chat-section .hcs-logo-text {
  font-weight: 700;
  font-size: 17px;
  color: var(--hcs-text);
}

/* Menu */
.home-chat-section .hcs-sidebar-menu {
  padding: 4px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.home-chat-section .hcs-menu-divider {
  height: 1px;
  background: var(--hcs-border);
  margin: 6px 0;
}

.home-chat-section .hcs-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--hcs-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: transparent;
  text-decoration: none;
  width: 100%;
  text-align: left;
}

.home-chat-section .hcs-menu-item:hover {
  background: var(--hcs-hover);
  color: var(--hcs-text);
}

.home-chat-section .hcs-menu-item.hcs-new-chat {
  color: var(--hcs-accent);
}
.home-chat-section .hcs-menu-item.hcs-new-chat:hover {
  background: rgba(239,35,60,0.08);
}

.home-chat-section .hcs-menu-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.home-chat-section .hcs-menu-item:hover svg {
  opacity: 1;
}

/* Sessions */
.home-chat-section .hcs-sidebar-section-title {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--hcs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.home-chat-section .hcs-sidebar-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.home-chat-section .hcs-sidebar-sessions::-webkit-scrollbar { width: 4px; }
.home-chat-section .hcs-sidebar-sessions::-webkit-scrollbar-track { background: transparent; }
.home-chat-section .hcs-sidebar-sessions::-webkit-scrollbar-thumb { background: var(--hcs-border); border-radius: 2px; }

.home-chat-section .hcs-session-group-title {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--hcs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.home-chat-section .hcs-session-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--hcs-text-secondary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.home-chat-section .hcs-session-item:hover { background: var(--hcs-hover); }
.home-chat-section .hcs-session-item.active { background: var(--hcs-hover); color: var(--hcs-text); }

.home-chat-section .hcs-session-item svg { flex-shrink: 0; opacity: 0.5; }

.home-chat-section .hcs-session-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== MAIN ========== */
.home-chat-section .hcs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--hcs-bg);
  position: relative;
}

/* Header (mobile only) */
.home-chat-section .hcs-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hcs-border);
  background: var(--hcs-bg);
}

.home-chat-section .hcs-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--hcs-text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.home-chat-section .hcs-hamburger:hover { background: var(--hcs-hover); }

.home-chat-section .hcs-header-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.home-chat-section .hcs-header-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--hcs-text);
}

.home-chat-section .hcs-header-sub {
  font-size: 13px;
  color: var(--hcs-text-muted);
}

/* ========== CHAT AREA ========== */
.home-chat-section .hcs-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
}

.home-chat-section .hcs-chat-area::-webkit-scrollbar { width: 5px; }
.home-chat-section .hcs-chat-area::-webkit-scrollbar-track { background: transparent; }
.home-chat-section .hcs-chat-area::-webkit-scrollbar-thumb { background: var(--hcs-border); border-radius: 3px; }

.home-chat-section .hcs-chat-container {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Welcome */
.home-chat-section .hcs-welcome {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  padding: 24px 32px;
  text-align: left;
  position: relative;
}

.home-chat-section .hcs-welcome-inner {
  max-width: 560px;
  width: 100%;
}

.home-chat-section .hcs-welcome-row {
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}

.home-chat-section .hcs-welcome-logo {
  flex-shrink: 0;
  width: 72px; height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-chat-section .hcs-welcome-logo img {
  width: 72px; height: auto; object-fit: contain;
}

.home-chat-section .hcs-welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
  line-height: 1.3;
}

.home-chat-section .hcs-welcome-cats {
  font-size: 12px;
  color: var(--hcs-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Bot — relativo ao input, sempre ao lado direito */
.home-chat-section .hcs-bot-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  padding-bottom: 8px;
  gap: 4px;
}

.home-chat-section .hcs-bot-bubble {
  background: #1e1e22;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px 18px;
  max-width: 240px;
  margin-bottom: 8px;
  margin-right: 10px;
  animation: hcsBubbleAppear 0.6s ease-out;
  position: relative;
  pointer-events: auto;
}

.home-chat-section .hcs-bot-bubble p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #d0d0d0;
}

.home-chat-section .hcs-bot-bubble::after {
  content: "";
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 14px 8px 0 8px;
  border-style: solid;
  border-color: #1e1e22 transparent transparent transparent;
}

@keyframes hcsBubbleAppear {
  0% { opacity: 0; transform: scale(0.85) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.home-chat-section .hcs-bot-float {
  animation: hcsBotFloat 3s ease-in-out infinite;
  pointer-events: auto;
}

.home-chat-section .hcs-bot-img {
  width: 120px; height: auto;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.3));
  transition: transform 0.3s;
}
.home-chat-section .hcs-bot-img:hover { transform: scale(1.05); }

@keyframes hcsBotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

/* ========== MESSAGES ========== */
.home-chat-section .hcs-message {
  margin-bottom: 14px;
  display: flex;
  line-height: 1.6;
}

.home-chat-section .hcs-message-assistant { justify-content: flex-start; }
.home-chat-section .hcs-message-user { justify-content: flex-end; }

.home-chat-section .hcs-message-content {
  max-width: 80%;
  min-width: 0;
}


.home-chat-section .hcs-message-text {
  font-size: 14px;
  word-wrap: break-word;
  padding: 10px 14px;
  border-radius: 16px;
}

.home-chat-section .hcs-message-text p:last-child { margin-bottom: 0; }

.home-chat-section .hcs-message-assistant .hcs-message-text {
  background: var(--hcs-bg-secondary);
  color: var(--hcs-text);
  border-bottom-left-radius: 4px;
}

.home-chat-section .hcs-message-user .hcs-message-text {
  background: var(--hcs-accent-dark);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* TTS button */
.home-chat-section .hcs-tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  color: var(--hcs-text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}
.home-chat-section .hcs-tts-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
  color: var(--hcs-accent);
}
.home-chat-section .hcs-tts-btn.playing {
  color: var(--hcs-accent);
  animation: hcsTtsPulse 1.5s ease-in-out infinite;
}
.home-chat-section .hcs-tts-btn.loading {
  color: var(--hcs-accent);
  animation: hcsSpin 1s linear infinite;
}
.home-chat-section .hcs-tts-btn:disabled { opacity: 0.3; cursor: default; }

@keyframes hcsTtsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes hcsSpin {
  to { transform: rotate(360deg); }
}

/* Typing */
.home-chat-section .hcs-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.home-chat-section .hcs-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--hcs-text-muted);
  animation: hcsTyping 1.4s infinite ease-in-out;
}
.home-chat-section .hcs-typing span:nth-child(2) { animation-delay: 0.2s; }
.home-chat-section .hcs-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hcsTyping {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ========== INPUT AREA ========== */
.home-chat-section .hcs-input-area {
  padding: 8px 24px 16px;
  background: var(--hcs-bg);
  position: relative;
  z-index: 10;
}

.home-chat-section .hcs-input-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
}

.home-chat-section .hcs-input-container {
  flex: 1;
  min-width: 0;
}

.home-chat-section .hcs-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--hcs-bg-input);
  border: 1px solid var(--hcs-border);
  border-radius: 14px;
  padding: 10px 14px;
  transition: border-color 0.2s;
}
.home-chat-section .hcs-input-wrapper:focus-within {
  border-color: rgba(239,35,60,0.3);
}

.home-chat-section .hcs-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--hcs-text);
  resize: none;
  outline: none;
  min-height: 70px;
  max-height: 180px;
  line-height: 22px;
  font-family: inherit;
  padding: 4px 0;
}
.home-chat-section .hcs-input::placeholder { color: var(--hcs-text-muted); }

.home-chat-section .hcs-mic-btn {
  width: 34px; height: 34px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hcs-text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
}
.home-chat-section .hcs-mic-btn:hover { background: rgba(255,255,255,0.06); color: var(--hcs-accent); }
.home-chat-section .hcs-mic-btn.listening {
  color: var(--hcs-accent);
  animation: hcsMicPulse 1s ease-in-out infinite;
}
@keyframes hcsMicPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.home-chat-section .hcs-send-btn {
  width: 34px; height: 34px;
  border: none;
  background: var(--hcs-accent-dark);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: opacity 0.2s, background 0.2s;
  flex-shrink: 0;
}
.home-chat-section .hcs-send-btn:hover:not(:disabled) { background: var(--hcs-accent); }
.home-chat-section .hcs-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.home-chat-section .hcs-input-footer {
  margin-top: 6px;
  font-size: 11px;
  color: var(--hcs-text-muted);
  text-align: center;
}

/* ========== MOBILE OVERLAY ========== */
.home-chat-section .hcs-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .home-chat-section .hcs-wrapper {
    margin: 16px 0 0;
    height: 80vh;
    min-height: 480px;
  }

  .home-chat-section .hcs-sidebar {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
    box-shadow: none;
  }
  .home-chat-section .hcs-sidebar.hcs-sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .home-chat-section .hcs-overlay {
    display: block;
  }

  .home-chat-section .hcs-header {
    display: flex;
  }

  .home-chat-section .hcs-chat-container {
    padding: 0 16px;
  }

  .home-chat-section .hcs-input-area {
    padding: 8px 12px 14px;
  }

  .home-chat-section .hcs-welcome-row {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .home-chat-section .hcs-section-header {
    padding: 32px 16px 0;
  }

  .home-chat-section .hcs-input-row {
    flex-direction: column;
    align-items: stretch;
  }
  .home-chat-section .hcs-bot-area {
    flex-direction: row;
    justify-content: center;
    padding-bottom: 0;
    padding-top: 8px;
  }
  .home-chat-section .hcs-bot-img { width: 60px; }
  .home-chat-section .hcs-bot-bubble { display: none; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .home-chat-section .hcs-sidebar { width: 220px; }
}
