/* ==============================================
   FUNIL DE VENDAS — Monitora Chat
   Kanban Board Styles (Paleta Monitora)
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Overlay & Container ── */
#monitora-funnel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9990;
  display: none;
  font-family: 'Inter', sans-serif;
}

#monitora-funnel-overlay.active {
  display: flex;
}

#monitora-funnel-board {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #f0f2f5;
  margin-left: 0;
  pointer-events: auto;
}

/* ── Header do Kanban ── */
.funnel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  min-height: 64px;
  flex-shrink: 0;
}

.funnel-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.funnel-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  letter-spacing: -0.02em;
}

.funnel-header-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0aa6a8 0%, #0cc4c6 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(10, 166, 168, 0.3);
}

.funnel-header-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.funnel-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Botões ── */
.funnel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.funnel-btn-primary {
  background: linear-gradient(135deg, #0aa6a8 0%, #0cc4c6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 166, 168, 0.25);
}

.funnel-btn-primary:hover {
  box-shadow: 0 4px 16px rgba(10, 166, 168, 0.4);
  transform: translateY(-1px);
}

.funnel-btn-ghost {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.funnel-btn-ghost:hover {
  background: #f3f4f6;
  color: #374151;
}

.funnel-btn-secondary {
  background: linear-gradient(135deg, #a368fb 0%, #8b54dd 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(163, 104, 251, 0.25);
}

.funnel-btn-secondary:hover {
  box-shadow: 0 4px 16px rgba(163, 104, 251, 0.4);
  transform: translateY(-1px);
}

.funnel-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Columns Container ── */
.funnel-columns-wrapper {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.funnel-columns-wrapper::-webkit-scrollbar {
  height: 8px;
}

.funnel-columns-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.funnel-columns-wrapper::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.funnel-columns-wrapper::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ── Column ── */
.funnel-column {
  min-width: 310px;
  max-width: 310px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
  transition: box-shadow 0.2s ease;
}

.funnel-column:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.funnel-column.drag-over {
  box-shadow: 0 0 0 2px #0aa6a8, 0 4px 16px rgba(10, 166, 168, 0.2);
}

/* ── Column Header ── */
.funnel-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.funnel-column-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.funnel-column-color {
  width: 4px;
  height: 24px;
  border-radius: 2px;
  flex-shrink: 0;
}

.funnel-column-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-column-count {
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.funnel-column-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.funnel-column-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.funnel-column-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.funnel-column-btn.delete-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

.funnel-column-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Cards Container ── */
.funnel-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.funnel-cards::-webkit-scrollbar {
  width: 4px;
}

.funnel-cards::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 2px;
}

.funnel-cards-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  color: #c0c5cd;
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  border: 2px dashed #e5e7eb;
  border-radius: 10px;
  min-height: 60px;
}

/* ── Card ── */
.funnel-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
  animation: cardEnter 0.25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.funnel-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.funnel-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: rotate(2deg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Header */
.funnel-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.funnel-card-avatar-wrapper {
  margin-top: 2px;
}

.funnel-card-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a368fb 0%, #8b54dd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(163, 104, 251, 0.2);
}

.funnel-card-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
}

.funnel-card-title-wrapper {
  flex: 1;
  min-width: 0;
}

.funnel-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1.2;
}

.funnel-card-name:hover {
  color: #0aa6a8;
  text-decoration: underline;
}

.funnel-card-channel-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.funnel-card-channel {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.funnel-card-detail {
  font-size: 0.75rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}

.funnel-card-detail svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* Body */
.funnel-card-body {
  margin-top: 10px;
}

.funnel-card-notes {
  font-size: 0.78rem;
  color: #4b5563;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  background: #f9fafb;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #f3f4f6;
}

/* Footer */
.funnel-card-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dotted #e5e7eb;
}

.funnel-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.funnel-card-agent {
  font-size: 0.72rem;
  color: #10b981;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.funnel-card-agent svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.funnel-card-time {
  font-size: 0.7rem;
  color: #9ca3af;
  font-family: monospace;
}

/* Actions */
.funnel-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  backdrop-filter: blur(2px);
}

.funnel-card:hover .funnel-card-actions {
  opacity: 1;
}

.funnel-card-action-btn {
  width: 22px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.funnel-card-action-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.funnel-card-action-btn.delete:hover {
  background: #fef2f2;
  color: #dc2626;
}

.funnel-card-action-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Column Footer ── */
.funnel-column-footer {
  padding: 10px 12px;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.funnel-add-card-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px dashed #d1d5db;
  background: transparent;
  color: #9ca3af;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
}

.funnel-add-card-btn:hover {
  background: #e6fafa;
  border-color: #0aa6a8;
  color: #0aa6a8;
}

.funnel-add-card-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Add Column Button ── */
.funnel-add-column {
  min-width: 280px;
  max-width: 280px;
  background: transparent;
  border: 2px dashed #d1d5db;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.funnel-add-column:hover {
  border-color: #0aa6a8;
  color: #0aa6a8;
  background: #e6fafa;
}

.funnel-add-column svg {
  width: 28px;
  height: 28px;
}



/* ── Modal ── */
.funnel-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  pointer-events: auto;
}

.funnel-modal {
  background: #fff;
  border-radius: 16px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

.funnel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.funnel-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
}

.funnel-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.funnel-modal-close:hover {
  background: #e5e7eb;
  color: #374151;
}

.funnel-modal-close svg {
  width: 18px;
  height: 18px;
}

.funnel-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.funnel-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.funnel-form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
}

.funnel-form-input,
.funnel-form-textarea {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  color: #1f2937;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.funnel-form-input:focus,
.funnel-form-textarea:focus {
  border-color: #0aa6a8;
  box-shadow: 0 0 0 3px rgba(10, 166, 168, 0.1);
}

.funnel-form-input::placeholder,
.funnel-form-textarea::placeholder {
  color: #c0c5cd;
}

.funnel-form-textarea {
  resize: vertical;
  min-height: 70px;
}

.funnel-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .funnel-column {
    min-width: 260px;
    max-width: 260px;
  }

  .funnel-header {
    padding: 12px 16px;
  }

  .funnel-columns-wrapper {
    padding: 12px 16px;
  }
}
