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

:root {
  --background: 0 0% 3.9%;
  --foreground: 0 0% 93%;
  --card: 0 0% 7.8%;
  --card-foreground: 0 0% 93%;
  --popover: 0 0% 7.8%;
  --popover-foreground: 0 0% 93%;
  --primary: 214 95% 60%;
  --primary-foreground: 0 0% 100%;
  --secondary: 0 0% 12.9%;
  --secondary-foreground: 0 0% 93%;
  --muted: 0 0% 12.9%;
  --muted-foreground: 0 0% 60%;
  --accent: 214 95% 60%;
  --accent-hover: 214 90% 50%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 84% 50%;
  --destructive-foreground: 0 0% 100%;
  --border: 0 0% 14.9%;
  --input: 0 0% 14.9%;
  --ring: 214 95% 60%;
  --radius: 0.5rem;
  --user-bg: 214 60% 20%;
  --user-border: 214 95% 60%;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  height: 100vh;
  position: relative;
}

.chat-window__header {
  padding: 0.75rem 1.5rem;
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border));
  text-align: center;
  flex-shrink: 0;
}

.chat-window__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-window__header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  letter-spacing: -0.02em;
}

.chat-window__header p {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.15rem;
  animation: neonBlink 2s ease-in-out infinite;
}

@keyframes neonBlink {
  0%, 100% { color: hsl(30 100% 50% / 0.6); text-shadow: 0 0 4px hsl(30 100% 50% / 0.3); }
  50% { color: hsl(30 100% 50% / 1); text-shadow: 0 0 12px hsl(30 100% 50% / 0.7), 0 0 24px hsl(30 100% 50% / 0.4), 0 0 40px hsl(30 100% 50% / 0.2); }
}

.chat-window__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-window__auto {
  padding: 0.25rem 0.6rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chat-window__auto--off:hover {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

.chat-window__auto--on {
  border-color: hsl(142 70% 45%);
  background: hsl(142 70% 45% / 0.15);
  color: hsl(142 70% 50%);
}

.chat-window__auto--on:hover {
  background: hsl(142 70% 45% / 0.25);
  border-color: hsl(142 70% 45%);
}

.auto-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(142 70% 50%);
  animation: autoPulse 1.5s ease-in-out infinite;
}

@keyframes autoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.chat-window__clear {
  padding: 0.25rem 0.6rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.chat-window__clear:hover {
  border-color: hsl(var(--destructive) / 0.3);
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

.chat-window__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-window__messages::-webkit-scrollbar {
  width: 6px;
}

.chat-window__messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-window__messages::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 3px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 1s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

.message--fade-out {
  animation: fadeOut 1s ease forwards;
}

.chat-window__messages--fading {
  overflow: hidden;
}

.message--user {
  align-self: flex-end;
}

.message--bot {
  align-self: flex-start;
}

.message__bubble {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.message--user .message__bubble {
  background: hsl(var(--user-bg));
  border: 1px solid hsl(var(--user-border));
  border-bottom-right-radius: 3px;
}

.message--bot .message__bubble {
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-bottom-left-radius: 3px;
}

.message__bubble--loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dot-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: hsl(var(--primary));
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.message--with-list {
  max-width: 100% !important;
  align-self: stretch !important;
}

.message--with-list .news-card {
  width: 100%;
}

.news-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.news-card:hover {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 1px hsla(var(--primary), 0.15);
}

.news-card__title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: hsl(var(--foreground));
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.news-card__snippet {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.news-card__btn {
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  padding: 0.35rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s;
}

.news-card__btn:hover,
.news-card__btn:focus-visible {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
  outline: none;
}

.input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--card));
  border-top: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.input-bar__field {
  flex: 1;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-bar__field:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.25);
}

.input-bar__field:disabled {
  opacity: 0.5;
}

.input-bar__field::placeholder {
  color: hsl(var(--muted-foreground));
  opacity: 0.5;
}

.input-bar__btn {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.input-bar__btn:hover,
.input-bar__btn:focus-visible {
  background: hsl(var(--accent-hover));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.3);
  outline: none;
}

.input-bar__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: hsl(0 0% 0% / 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.article-modal {
  width: 50%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px hsl(0 0% 0% / 0.5);
  animation: fadeIn 0.15s ease;
}

.article-modal::-webkit-scrollbar {
  width: 5px;
}

.article-modal::-webkit-scrollbar-track {
  background: transparent;
}

.article-modal::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 3px;
}

.article-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.article-modal__title {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  line-height: 1.3;
  flex: 1;
  padding-right: 0.5rem;
  letter-spacing: -0.01em;
}

.article-modal__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.article-modal__close:hover {
  background: hsl(var(--destructive) / 0.15);
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.3);
}

.article-modal__meta {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.article-modal__body {
  padding: 0.5rem 1rem 1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: hsl(var(--foreground));
}

.article-modal__body p {
  margin-bottom: 0.75rem;
}

.article-modal__body p:last-child {
  margin-bottom: 0;
}

.article-modal__desc {
  padding: 0.5rem 1rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

.qty-modal {
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px hsl(0 0% 0% / 0.5);
  animation: fadeIn 0.2s ease;
}

.qty-modal__label {
  font-size: 1.05rem;
  color: hsl(var(--foreground));
  margin-bottom: 1.5rem;
  line-height: 1.4;
  font-weight: 500;
}

.qty-modal__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.qty-modal__btn {
  width: 50px;
  height: 50px;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.qty-modal__btn:hover {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}

.qty-modal__btn--active {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.qty-modal__go {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.qty-modal__go:hover {
  background: hsl(var(--accent-hover));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.3);
}

.lgpd-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: hsl(0 0% 5% / 0.97);
  border-top: 1px solid hsl(var(--border));
  padding: 0.75rem 1rem;
  animation: lgpdSlideUp 0.3s ease;
}

@keyframes lgpdSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.lgpd-banner__content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.lgpd-banner__text {
  flex: 1;
  font-size: 0.78rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  min-width: 200px;
}

.lgpd-banner__link {
  color: hsl(var(--primary));
  text-decoration: underline;
  font-weight: 500;
}

.lgpd-banner__link:hover {
  color: hsl(var(--accent-hover));
}

.lgpd-banner__btn {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--primary));
  background: transparent;
  color: hsl(var(--primary));
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.lgpd-banner__btn:hover {
  background: hsl(var(--primary) / 0.15);
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

@media (max-width: 600px) {
  .message {
    max-width: 95%;
  }

  .chat-window__header h1 {
    font-size: 1.1rem;
  }

  .article-modal {
    width: 90%;
  }

  .qty-modal {
    padding: 1.5rem;
  }

  .qty-modal__btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .lgpd-banner__content {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .lgpd-banner__btn {
    width: 100%;
  }
}
