/* ===== CSS Variables ===== */
:root {
  /* Colors */
  --primary-color: #2b7a78;
  --primary-hover: #226962;
  --primary-light: #e0f7f5;
  --secondary-color: #f8f9fa;
  --accent-color: #17a2b8;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --error-color: #dc3545;
  --info-color: #17a2b8;

  /* Text Colors */
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --text-white: #ffffff;

  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-dark: #343a40;

  /* Border Colors */
  --border-color: #dee2e6;
  --border-light: #f1f3f4;

  /* Shadows */
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Typography */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-xxl: 1.5rem;
  --font-size-xxxl: 2rem;

  /* Layout */
  --header-height: 60px;
  --input-height: 80px;
  --drawer-width: 280px;
  --modal-max-width: 600px;
}

/* Dark Theme */
[data-theme="dark"] {
  --text-primary: #f8f9fa;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #404040;
  --border-color: #404040;
  --border-light: #2d2d2d;
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

/* ===== Reset & Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  max-height: var(--header-height); /* Não permite expansão */
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--spacing-md);
  max-width: 1200px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.logo-icon i {
  font-size: var(--font-size-lg);
  color: var(--text-white);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: var(--primary-color);
  line-height: 1.2;
}

.logo-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--success-color);
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background-color: var(--success-color); /* Sempre verde (online) */
}

/* Força status sempre online para ambiente local */
#status-dot {
  background-color: var(--success-color) !important;
  animation: pulse 2s infinite;
}

#status-text {
  color: var(--success-color) !important;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ===== Drawer ===== */
.drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: var(--drawer-width);
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  transition: right var(--transition-normal);
  overflow-y: auto;
}

.drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.drawer-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.drawer-content {
  padding: var(--spacing-md);
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  margin-bottom: var(--spacing-xs);
}

.drawer-link:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
}

.drawer-link i {
  width: 20px;
  text-align: center;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  position: relative;
  justify-content: center;
  padding-top: var(--spacing-lg);
}

/* Garante que o body e html não tenham scroll */
body,
html {
  overflow-x: hidden;
  overflow-y: hidden; /* Remove scroll da página inteira */
  height: 100vh; /* Altura fixa da viewport */
  margin: 0;
  padding: 0;
}

/* ===== Chat Container ===== */
.chat-container {
  flex: 1;
  overflow: hidden;
  padding: var(--spacing-lg);
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 140px;
  height: 100%;
  justify-content: center;
}

/* Chat Messages Container */
#chat {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  scroll-behavior: smooth;
  min-height: 0;
  height: 100%;
  max-height: calc(100vh - 280px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  position: relative;
  justify-content: flex-start;
  outline: none; /* Remove outline amarelo no mobile */
  -webkit-tap-highlight-color: transparent; /* Remove highlight no mobile */
}

#chat::-webkit-scrollbar {
  width: 6px;
}

#chat::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

#chat::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

#chat::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-lg);
  max-width: 800px;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
  min-height: 100%;
  width: 100%;
  background: linear-gradient(
    135deg,
    rgba(43, 122, 120, 0.02) 0%,
    rgba(23, 162, 184, 0.02) 100%
  );
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  gap: var(--spacing-lg);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.welcome-message::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 30% 20%,
      rgba(43, 122, 120, 0.05) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 80%,
      rgba(23, 162, 184, 0.05) 0%,
      transparent 50%
    );
  pointer-events: none;
}

.welcome-icon {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  transition: all var(--transition-normal);
  border: 3px solid rgba(255, 255, 255, 0.2);
}

.welcome-icon:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.welcome-icon::before {
  content: "";
  position: absolute;
  inset: -3px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  border-radius: 50%;
  z-index: -1;
  opacity: 0.3;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.5;
  }
}

.welcome-icon i {
  font-size: 3rem;
  color: var(--text-white);
  z-index: 2;
}

.welcome-message h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
  line-height: 1.2;
  z-index: 1;
  position: relative;
}

.welcome-message p {
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.6;
  max-width: 600px;
  z-index: 1;
  position: relative;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-top: 0;
  padding: var(--spacing-lg);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  flex: 1;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  min-height: 100px;
  box-shadow: var(--shadow-sm);
  justify-content: center;
}

.quick-action-btn:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.quick-action-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.quick-action-btn:disabled:hover {
  border-color: var(--border-color);
  background: var(--bg-primary);
  transform: none;
  box-shadow: none;
}

/* Efeito de loading para atalhos */
.quick-action-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.quick-action-btn.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.quick-action-btn i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: var(--spacing-xs);
}

.quick-action-btn span {
  font-weight: 600;
  font-size: var(--font-size-base);
  text-align: center;
  line-height: 1.3;
  color: var(--text-primary);
}

/* ===== Messages ===== */
#chat {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  scroll-behavior: smooth;
  /* Estilo de scrollbar personalizada */
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-secondary);
}

#chat::-webkit-scrollbar {
  width: 6px;
}

#chat::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

#chat::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

#chat::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

.message {
  display: flex;
  margin-bottom: var(--spacing-md);
  animation: fadeInUp 0.3s ease;
  align-items: flex-end;
  gap: var(--spacing-sm);
}

.message.user {
  justify-content: flex-end;
}

.message.bot {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 75%;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  position: relative;
  word-wrap: break-word;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: var(--text-white);
  border-bottom-right-radius: var(--radius-sm);
  margin-left: var(--spacing-lg);
}

.message.bot .message-bubble {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-sm);
  margin-right: var(--spacing-lg);
}

.message.user .message-bubble::before {
  content: "";
  position: absolute;
  right: -8px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 8px solid var(--primary-color);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.message.bot .message-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 8px solid var(--bg-primary);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

/* Temporariamente desabilitado - horários */
/*
.message-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.message.user .message-time {
  text-align: right !important;
  margin-right: 8px;
}

.message.bot .message-time {
  text-align: left;
  margin-left: 8px;
}

.message:hover .message-time {
  opacity: 1;
}
*/

.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  border-bottom-left-radius: var(--radius-sm);
  max-width: 100px;
}

.typing-dots {
  display: flex;
  gap: var(--spacing-xs);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ===== Input Area ===== */
.input-area {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-md);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 120px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.input-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  box-shadow: var(--shadow-sm);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

#message-input {
  width: 100%;
  min-height: 40px;
  max-height: 120px;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: all var(--transition-fast);
  overflow-y: auto;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

#message-input::-webkit-scrollbar {
  width: 4px;
}

#message-input::-webkit-scrollbar-track {
  background: transparent;
}

#message-input::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

#message-input:focus {
  outline: none;
}

.input-container:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.1);
  outline: none;
}

#message-input::placeholder {
  color: var(--text-muted);
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-xs);
}

.char-count {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.input-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.input-btn:hover {
  background: var(--primary-color);
  color: var(--text-white);
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
}

.input-btn:active {
  transform: scale(0.95);
}

.send-btn {
  background: var(--primary-color);
  color: var(--text-white);
  width: 44px;
  height: 44px;
}

.send-btn:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.send-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Indicador de novas mensagens */
.new-messages-indicator {
  position: absolute;
  bottom: 140px; /* Mais espaço para o input fixo */
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-color);
  color: var(--text-white);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 5;
  animation: bounce 2s infinite;
}

.new-messages-indicator:hover {
  background: var(--primary-hover);
  transform: translateX(-50%) scale(1.05);
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-5px);
  }
  60% {
    transform: translateX(-50%) translateY(-3px);
  }
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: var(--modal-max-width);
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  max-height: 60vh;
}

.modal-body p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-body ul {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.modal-body li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  text-align: center;
  color: var(--text-white);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--text-white);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
  margin: 0 auto var(--spacing-md);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.toast {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-md);
  min-width: 300px;
  animation: toastSlideIn 0.3s ease;
  position: relative;
}

.toast.success {
  border-left: 4px solid var(--success-color);
}

.toast.error {
  border-left: 4px solid var(--error-color);
}

.toast.warning {
  border-left: 4px solid var(--warning-color);
}

.toast.info {
  border-left: 4px solid var(--info-color);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Close Button ===== */
.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===== Responsive Design ===== */

/* Desktop - Layout otimizado para telas grandes */
@media (min-width: 769px) {
  .chat-container {
    padding: var(--spacing-xl);
    padding-bottom: 160px;
  }

  #chat {
    max-height: calc(100vh - 320px);
    padding: var(--spacing-xl);
  }

  .welcome-message {
    padding: var(--spacing-xxl) var(--spacing-xl);
    min-height: 100%;
    width: 100%;
  }

  .quick-actions {
    max-width: 900px;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-xxl);
    width: 100%;
    flex: 1;
  }

  .quick-action-btn {
    min-height: 110px;
    padding: var(--spacing-lg);
  }
}

@media (max-width: 768px) {
  :root {
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-xxl: 2rem;
    --header-height: 60px;
  }

  .header-content {
    padding: 0 var(--spacing-sm);
  }

  .logo span {
    display: none;
  }

  .chat-container {
    padding: var(--spacing-md);
    padding-top: var(--spacing-sm);
  }

  /* Mobile layout simplificado */
  .main-content {
    margin-top: 60px !important;
    padding-top: 0 !important;
    justify-content: flex-start !important;
    height: calc(100dvh - 60px) !important;
    min-height: calc(100dvh - 60px) !important;
  }

  .chat-container {
    padding-bottom: 100px !important;
    padding-top: var(--spacing-sm) !important;
    justify-content: flex-start !important;
    height: 100% !important;
  }

  #chat {
    height: calc(var(--vh, 1vh) * 100 - 160px) !important;
    max-height: calc(var(--vh, 1vh) * 100 - 160px) !important;
    min-height: calc(var(--vh, 1vh) * 100 - 160px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: var(--spacing-sm);
  }

  .input-area {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
  }

  .welcome-message {
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    min-height: calc(100vh - 260px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    flex: 1;
    margin: var(--spacing-sm);
    gap: var(--spacing-md);
  }

  .welcome-message h2 {
    font-size: var(--font-size-xxl);
    margin-bottom: 0;
    color: var(--text-primary);
  }

  .welcome-message p {
    font-size: var(--font-size-lg);
    margin-bottom: 0;
    color: var(--text-secondary);
  }

  .quick-actions {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin-top: 0;
  }

  .quick-action-btn {
    padding: var(--spacing-md);
    min-height: 70px;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    box-shadow: var(--shadow-sm);
  }

  .quick-action-btn i {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-xs);
  }

  .quick-action-btn span {
    font-size: var(--font-size-sm);
    font-weight: 600;
  }

  .message-bubble {
    max-width: 85%;
  }

  .input-container {
    gap: var(--spacing-sm);
  }

  .drawer {
    width: 100%;
    right: -100%;
  }

  .modal-content {
    margin: var(--spacing-md);
    max-height: 90vh;
  }

  .toast-container {
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    left: var(--spacing-sm);
  }

  .toast {
    min-width: auto;
  }

  /* Melhorias de scroll no mobile */
  body,
  html {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  .main-content {
    height: calc(100vh - 60px) !important;
    max-height: calc(100vh - 60px) !important;
  }

  #chat {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    touch-action: pan-y;
    overflow-y: auto;
    height: calc(100vh - 160px) !important;
    max-height: calc(100vh - 160px) !important;
    overflow-x: hidden;
    padding: var(--spacing-md);
  }

  .chat-container {
    padding-bottom: 100px;
    height: calc(100vh - 60px) !important;
    max-height: calc(100vh - 60px) !important;
  }

  .input-area {
    padding: var(--spacing-sm);
    height: 100px;
    max-height: 100px;
  }
}

@media (max-width: 480px) {
  :root {
    --header-height: 50px;
  }

  .welcome-icon {
    width: 50px;
    height: 50px;
  }

  .welcome-icon i {
    font-size: var(--font-size-xl);
  }

  .welcome-message {
    padding: var(--spacing-md) var(--spacing-sm);
    min-height: calc(100vh - 210px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    width: 100%;
    flex: 1;
    margin: var(--spacing-xs);
    gap: var(--spacing-sm);
  }

  .welcome-message h2 {
    font-size: var(--font-size-xl);
    margin-bottom: 0;
    color: var(--text-primary);
  }

  .welcome-message p {
    font-size: var(--font-size-base);
    margin-bottom: 0;
    color: var(--text-secondary);
  }

  .quick-actions {
    gap: var(--spacing-sm);
    margin-top: 0;
  }

  .quick-action-btn {
    padding: var(--spacing-sm);
    min-height: 60px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-sm);
  }

  /* Mobile pequeno layout simplificado */
  .main-content {
    margin-top: 50px !important;
    padding-top: 0 !important;
    justify-content: flex-start !important;
    height: calc(100dvh - 50px) !important;
    min-height: calc(100dvh - 50px) !important;
  }

  .chat-container {
    padding-bottom: 90px !important;
    padding-top: var(--spacing-sm) !important;
    justify-content: flex-start !important;
    height: 100% !important;
  }

  #chat {
    height: calc(var(--vh, 1vh) * 100 - 140px) !important;
    max-height: calc(var(--vh, 1vh) * 100 - 140px) !important;
    min-height: calc(var(--vh, 1vh) * 100 - 140px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: var(--spacing-sm);
  }

  .input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--spacing-xs);
    height: 90px;
    max-height: 90px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
  }

  .input-container {
    padding: var(--spacing-xs);
  }

  #message-input {
    font-size: 16px;
    line-height: 1.4;
    max-height: 60px;
  }

  .quick-action-btn i {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xs);
  }

  .quick-action-btn span {
    font-size: var(--font-size-xs);
    font-weight: 600;
  }

  /* Melhorias adicionais para mobile pequeno */
  body,
  html {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  .main-content {
    height: calc(100vh - 50px) !important;
    max-height: calc(100vh - 50px) !important;
  }

  .chat-container {
    padding-bottom: 80px;
    height: calc(100vh - 50px) !important;
    max-height: calc(100vh - 50px) !important;
    overflow: hidden;
  }

  #chat {
    height: calc(100vh - 130px) !important;
    max-height: calc(100vh - 130px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding: var(--spacing-md);
  }

  .input-area {
    padding: var(--spacing-xs);
    height: 80px;
    max-height: 80px;
  }

  .input-container {
    padding: var(--spacing-xs);
  }

  #message-input {
    font-size: 16px;
    line-height: 1.4;
    max-height: 60px;
  }

  .header-btn {
    width: 35px;
    height: 35px;
  }

  .header-content {
    padding: 0 var(--spacing-xs);
  }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== Message Formatting Styles ===== */
.message-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

/* Formatação específica para mensagens do WhatsApp convertidas para web */
.message-content {
  /* Converte \n para quebras de linha */
  white-space: pre-line;
}

/* Estilos para texto em negrito (*texto*) */
.message-content strong,
.message-content b {
  color: var(--text-primary);
  font-weight: 600;
}

/* Estilos para texto em itálico (_texto_) */
.message-content em,
.message-content i {
  font-style: italic;
  color: var(--text-secondary);
}

/* Estilos para texto tachado (~texto~) */
.message-content del,
.message-content s {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Estilos para código (`texto`) */
.message-content code {
  font-family: 'Courier New', monospace;
  background-color: var(--bg-tertiary);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--primary-color);
}

/* Emojis */
.emoji {
  font-size: 1.1em;
  margin: 0 2px;
  display: inline-block;
}

.emoji.success {
  color: #22c55e;
}

.emoji.warning {
  color: #f59e0b;
}

.emoji.error {
  color: #ef4444;
}

.emoji.bot {
  color: var(--primary-color);
}

/* Links */
.phone-link,
.message-content a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 4px;
  background-color: rgba(43, 122, 120, 0.1);
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.phone-link:hover,
.message-content a:hover {
  background-color: rgba(43, 122, 120, 0.2);
  text-decoration: none;
  border-bottom-color: var(--primary-color);
}

/* CPF/CNPJ */
.cpf-cnpj {
  font-family: 'Courier New', monospace;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Moeda */
.currency {
  color: #22c55e;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

/* Data */
.date {
  color: var(--primary-color);
  font-weight: 500;
  background-color: rgba(43, 122, 120, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Listas nas mensagens */
.message-content ul,
.message-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-content li {
  margin: 0.25rem 0;
  line-height: 1.5;
}

/* Quebras de linha */
.message-content br {
  line-height: 1.6;
}

/* Citações */
.message-content blockquote {
  border-left: 3px solid var(--primary-color);
  margin: 0.5rem 0;
  padding-left: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Destaque especial para informações importantes */
.message-content .highlight {
  background-color: rgba(43, 122, 120, 0.1);
  padding: 0.5rem;
  border-radius: 4px;
  border-left: 3px solid var(--primary-color);
  margin: 0.5rem 0;
}

/* Estilos para QR Code e links especiais */
.message-content .qr-link {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  margin: 0.25rem 0;
  transition: all 0.2s ease;
}

.message-content .qr-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(43, 122, 120, 0.3);
  text-decoration: none;
  color: white;
}

/* Remove outline amarelo no mobile */
@media (max-width: 768px) {
  * {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
  }

  input,
  textarea {
    -webkit-user-select: text !important;
    -khtml-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
  }

  *:focus {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #000000;
  }

  [data-theme="dark"] {
    --border-color: #ffffff;
    --text-secondary: #ffffff;
  }
}

/* Print styles */
@media print {
  .header,
  .input-area,
  .drawer,
  .modal,
  .loading-overlay,
  .toast-container {
    display: none !important;
  }

  .main-content {
    margin-top: 0;
  }

  .chat-container {
    padding: 0;
  }
}
