﻿/*
 * Estilos base do painel admin.
 * Mantém customizações leves fora do HTML para facilitar manutenção.
 */

/* Toast notification */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 90vw;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
  max-width: 400px;
  word-break: break-word;
}
.toast--success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.toast--error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast--info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* WhatsApp button */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #25d366;
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-whatsapp:hover { background: #1da851; }
.btn-whatsapp:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-whatsapp--sent { background: #0ea5a2; }
.btn-whatsapp--sent:hover { background: #0f766e; }
.btn-whatsapp--no-phone {
  background: #e2e8f0;
  color: #64748b;
  cursor: default;
}

/* Feito button */
.btn-done {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #059669;
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-done:hover { background: #047857; }
.btn-done:disabled { opacity: 0.5; cursor: not-allowed; }

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.task-action-btn {
  min-height: 2rem;
}

.chart-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 0.5rem;
}

.chart-row__label {
  font-size: 0.75rem;
  color: #334155;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chart-row__bar-wrap {
  width: 100%;
  height: 0.65rem;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
}

.chart-row__bar {
  height: 100%;
  background: #2563eb;
}

.chart-row__bar--success {
  background: #059669;
}

.chart-row__bar--error {
  background: #dc2626;
}

.chart-row__value {
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f172a;
}

/* Urgency badge */
.badge-urgency {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-urgency--past { background: #e2e8f0; color: #64748b; }
.badge-urgency--critical { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-urgency--warning { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.badge-urgency--attention { background: #fefce8; color: #a16207; border: 1px solid #fef08a; }
.badge-urgency--ok { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }

/* Lead response badge */
.badge-replied,
.badge-no-reply {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-replied { background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; }
.badge-no-reply { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }

/* AI confidence score badge */
.badge-score {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-score--high { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-score--medium { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-score--low { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Funnel chart */
.funnel-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.funnel-row {
  display: grid;
  grid-template-columns: 140px 1fr 44px;
  align-items: center;
  gap: 0.5rem;
}
.funnel-row__label {
  font-size: 0.75rem;
  color: #334155;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.funnel-row__bar-wrap {
  width: 100%;
  height: 1.25rem;
  background: #f1f5f9;
  border-radius: 0.375rem;
  overflow: hidden;
  position: relative;
}
.funnel-row__bar {
  height: 100%;
  border-radius: 0.375rem;
  transition: width 0.4s ease;
}
.funnel-row__value {
  text-align: right;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
}

#messagePreviewDialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}


@media (max-width: 768px) {
  #tasksGoalsBox {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 60;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  }

  #tasksGoalsBox.tasks-goals--collapsed #tasksGoalsContent {
    display: none;
  }

  #view-tasks {
    padding-bottom: 7rem;
  }

  table thead {
    display: none;
  }
  #tasksTable tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem;
    width: 100%;
  }
  #tasksTable td {
    display: block;
    border-bottom: 0;
    padding: 0.4rem 0.35rem;
    text-align: left;
    min-width: 0;
  }
  #tasksTable td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-align: left;
    margin: 0 0 0.2rem 0;
  }

  #tasksTable td[data-label="Ações"] {
    display: block;
    text-align: left;
    grid-column: 1 / -1;
    border-top: 1px solid #f1f5f9;
    margin-top: 0.15rem;
    padding-top: 0.6rem;
  }

  #tasksTable td[data-label="Vencimento"] { order: 1; }
  #tasksTable td[data-label="Nome"] { order: 2; }
  #tasksTable td[data-label="Data do Evento"] { order: 3; }
  #tasksTable td[data-label="Contato"] {
    order: 4;
  }
  #tasksTable td[data-label="Grupo"] { order: 5; }
  #tasksTable td[data-label="Perfil"] { order: 6; }
  #tasksTable td[data-label="Canal"] { order: 7; }
  #tasksTable td[data-label="Status"] { order: 8; }
  #tasksTable td[data-label="Tema"] { order: 9; }
  #tasksTable td[data-label="Ações"] { order: 10; }

  #tasksTable td[data-label="Data do Evento"],
  #tasksTable td[data-label="Contato"] {
    white-space: nowrap;
  }

  #tasksTable td[data-label="Ações"]::before {
    display: block;
    margin: 0 0 0.5rem 0;
  }

  #tasksTable tr.task-comment-row {
    display: block;
    padding-top: 0;
  }

  #tasksTable tr.task-comment-row td {
    padding: 0.25rem 0.35rem 0.5rem;
  }

  .task-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .task-action-btn,
  .task-actions .btn-whatsapp,
  .task-actions .btn-done {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
    font-size: 0.9rem;
    padding: 0.65rem 0.5rem;
  }

  .task-action-empty {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border-radius: 0.5rem;
    background: #f1f5f9;
  }
}

@media (max-width: 480px) {
  .chart-row {
    grid-template-columns: 80px 1fr 36px;
    gap: 0.35rem;
  }
}

