/* Animação de digitando */
@keyframes typing {
  0% { opacity: .2; }
  20% { opacity: 1; }
  100% { opacity: .2; }
}

.typing span {
  animation: typing 1.4s infinite;
  display: inline-block;
  margin-left: 4px;
}

.typing span:nth-child(1) { animation-delay: 0s; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

body {
  background: linear-gradient(135deg, #1a1a3c 0%, #2d3c7a 100%);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding: 30px;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-container {
  width: 100%;
  max-width: 900px;
  margin: auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 85vh;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-header {
  background: linear-gradient(135deg, #533483 0%, #8956d8 100%);
  color: white;
  padding: 20px;
  text-align: center;
  border-radius: 20px 20px 0 0;
  position: relative;
}

.chat-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
}

.chat-header p {
  margin: 5px 0 0;
  font-size: 16px;
  opacity: 0.9;
}

.dashboard-link {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.dashboard-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Estilos para telas menores (mobile) */
@media (max-width: 768px) {
  .chat-header h1 {
    font-size: 20px; /* Reduz o tamanho do título */
  }

  .dashboard-link {
    font-size: 0; /* Esconde o texto do botão */
    width: 40px;   /* Define uma largura fixa */
    height: 40px;  /* Define uma altura fixa */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Deixa o botão redondo */
  }

  .dashboard-link::before {
    content: '\f0e4'; /* Código do ícone de dashboard do Font Awesome */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 18px; /* Tamanho do ícone */
  }
}

.chat-box {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-track {
  background: transparent;
}

.chat-box::-webkit-scrollbar-thumb {
  background: #8956d8;
  border-radius: 3px;
}

.message {
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 85%;
  line-height: 1.5;
  word-break: break-word;
  transition: all 0.3s ease;
  animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user {
  background: linear-gradient(135deg, #8956d8 0%, #533483 100%);
  color: white;
  align-self: flex-end;
  box-shadow: 0 2px 10px rgba(137, 86, 216, 0.2);
}

.bot {
  background: #f8f9fa;
  color: #333;
  align-self: flex-start;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input {
  display: flex;
  padding: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  gap: 12px;
  background: rgba(255, 255, 255, 0.98);
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid rgba(137, 86, 216, 0.2);
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9);
}

.chat-input input:focus {
  outline: none;
  border-color: #8956d8;
  box-shadow: 0 0 0 3px rgba(137, 86, 216, 0.1);
}

.chat-input button {
  background: linear-gradient(135deg, #533483 0%, #8956d8 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(137, 86, 216, 0.2);
}

.chat-input button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(137, 86, 216, 0.3);
}

.chat-input button:active {
  transform: translateY(1px);
}

.mic-button.recording {
  animation: pulse 1.5s infinite;
  background: #e74c3c;
  color: white;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

.markdown-content h3 {
  margin-top: 0;
  color: #533483;
}

.markdown-content strong {
  color: #8956d8;
}

.markdown-content ul {
  padding-left: 20px;
}

/* Dashboard Styles */
.dashboard-container {
  width: 100%;
  max-width: 1200px;
  margin: 30px auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-header {
  background: linear-gradient(135deg, #6b46c1 0%, #805ad5 100%);
  padding: 2rem;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 20px 20px 0 0;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.title-container {
  text-align: center;
}

.header-content h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin: 0;
  padding: 0;
  color: white;
  text-align: center;
}

.header-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  align-items: center;
}

.control-column {
  display: flex;
  justify-content: center;
  align-items: center;
}

.month-selector {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.month-selector button {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.month-selector button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.month-selector span {
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0 1rem;
  min-width: 150px;
  text-align: center;
}

.back-button {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.back-button span {
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

.last-update {
  color: white;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .dashboard-header {
    padding: 1.5rem 1rem;
  }

  .header-controls {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .control-column {
    justify-content: center;
  }

  .month-selector {
    width: 100%;
    justify-content: center;
  }

  .last-update {
    width: 100%;
    text-align: center;
  }
}

.dashboard-content {
  padding: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.dashboard-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
}

.dashboard-card:hover {
  transform: translateY(-2px);
}

.dashboard-card h2 {
  margin: 0 0 16px;
  color: #533483;
  font-size: 20px;
  font-weight: 600;
}

.summary-section {
  background: white;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.summary-section h2 {
  margin-bottom: 24px;
  color: #2c3e50;
  font-size: 20px;
  font-weight: 600;
}

.financial-summary {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.summary-card {
  background: #f0f7ff;
  padding: 24px;
  border-radius: 8px;
  text-align: center;
}

.saldo-asaas {
  width: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.summary-card .label {
  display: block;
  color: #666;
  font-size: 16px;
  margin-bottom: 12px;
}

.summary-card .value {
  display: block;
  font-size: 28px;
  font-weight: 600;
}

/* Cores dos valores */
#asaas-balance {
  color: #1976d2;  /* Azul */
}

.value.positive {
  color: #27ae60;  /* Verde */
}

.value.negative {
  color: #e74c3c;  /* Vermelho */
}

.value.pending {
  font-style: italic;
}

@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

.flow-list, .upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flow-item, .upcoming-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.flow-date, .upcoming-date {
  font-size: 14px;
  color: #666;
  min-width: 60px;
}

.flow-details, .upcoming-details {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flow-description, .upcoming-description {
  font-weight: 500;
}

.flow-value {
  font-weight: 600;
}

.flow-value.positive {
  color: #28a745;
}

.flow-value.negative {
  color: #dc3545;
}

@media (max-width: 768px) {
  .dashboard-container {
    margin: 0;
    border-radius: 0;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    text-align: center;
    border: 1px solid #ffcdd2;
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #8956d8;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #8956d8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-indicator p {
    color: #533483;
    font-size: 18px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Container principal */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Cabeçalho */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

header h1 {
    color: #2c3e50;
    font-size: 24px;
}

.last-update {
    color: #ffffff;
    font-size: 14px;
}

/* Seções */
section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Resumo Financeiro */
.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.summary-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.summary-item:first-child {
    grid-column: span 3;
    background: #e3f2fd;
}

.summary-item:first-child .value {
    color: #1976d2;
    font-size: 28px;
    font-weight: bold;
}

.summary-item .label {
    display: block;
    color: #666;
    font-size: 16px;
    margin-bottom: 10px;
}

.summary-item .value {
    font-size: 24px;
    font-weight: bold;
}

.summary-item .value.positive {
    color: #27ae60;
}

.summary-item .value.negative {
    color: #e74c3c;
}

.summary-item .value.pending {
    opacity: 0.7;
    font-style: italic;
}

@media (max-width: 768px) {
    .summary {
        grid-template-columns: 1fr;
    }
    
    .summary-item:first-child {
        grid-column: span 1;
    }
}

/* Fluxo Diário */
.flow-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.flow-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.flow-date {
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 16px;
}

.flow-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transaction-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 6px;
    gap: 8px;
    position: relative;
}

.transaction-item.receita {
    background: rgba(39, 174, 96, 0.1);
}

.transaction-item.despesa {
    background: rgba(231, 76, 60, 0.1);
}

.transaction-item.paid::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    color: #27ae60;
    font-weight: bold;
}

.transaction-item.pending::after {
    content: '!';
    position: absolute;
    top: 8px;
    right: 8px;
    color: #e74c3c;
    font-weight: bold;
}

.transaction-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(44, 62, 80, 0.1);
    color: #2c3e50;
    align-self: flex-start;
}

.transaction-item.paid .transaction-status {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.transaction-item.pending .transaction-status {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transaction-description {
    font-weight: 500;
    color: #2c3e50;
}

.transaction-category {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(44, 62, 80, 0.1);
    color: #2c3e50;
}

.transaction-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transaction-method {
    font-size: 12px;
    color: #666;
}

.transaction-value {
    font-weight: 600;
}

.transaction-value.positive {
    color: #27ae60;
}

.transaction-value.negative {
    color: #e74c3c;
}

.transaction-recurring {
    font-size: 12px;
    color: #3498db;
    font-style: italic;
}

/* Gráficos */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.monthly-chart-section {
    margin-top: 20px;
    background: white;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.monthly-chart-container {
    width: 100%;
    height: 400px;
}

.monthly-chart-container h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.chart-container {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-container h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

/* Indicador de Carregamento */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensagens de Erro */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
}

/* Responsividade */
@media (max-width: 768px) {
    .summary {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }
}

.daily-total {
    margin-top: 15px;
}

.daily-total hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 10px 0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-weight: 500;
}

.total-row .total-value {
    font-size: 1.1em;
    font-weight: 600;
}

.total-value.positive {
    color: #27ae60;
}

.total-value.negative {
    color: #e74c3c;
}

@media (max-width: 600px) {
  .dashboard-header h1 {
    font-size: 2rem;
    word-break: break-word;
  }
  .header-controls {
    flex-direction: column;
    gap: 8px;
  }
  .month-selector span {
    font-size: 1rem;
  }
  .last-update {
    font-size: 0.9rem;
    margin-top: 4px;
  }
  .transaction-description {
    font-size: 1rem;
    word-break: break-word;
  }
  .transaction-item {
    margin-bottom: 16px;
    padding: 10px 8px;
  }
  .summary-card {
    font-size: 1rem;
    padding: 12px 6px;
  }
} 