/* ==========================================================================
   KANBAN UX IMPROVEMENTS - Melhorias para muitos cards
   ========================================================================== */

/* Colunas com altura máxima e scroll interno */
.almont-crm-column-body {
  padding: 12px;
  min-height: 160px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  /* Scrollbar elegante */
  scrollbar-width: thin;
  scrollbar-color: rgba(241, 189, 49, 0.5) rgba(255, 255, 255, 0.08);
}

.almont-crm-column-body::-webkit-scrollbar {
  width: 6px;
}

.almont-crm-column-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.almont-crm-column-body::-webkit-scrollbar-thumb {
  background: rgba(241, 189, 49, 0.5);
  border-radius: 3px;
}

.almont-crm-column-body::-webkit-scrollbar-thumb:hover {
  background: rgba(241, 189, 49, 0.7);
}

/* Cards mais compactos quando há muitos */
.almont-crm-card {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.almont-crm-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-color: rgba(241, 189, 49, 0.3);
}

.almont-crm-card:active {
  transform: translateY(0);
  cursor: grabbing;
}

/* Card title mais compacto */
.almont-crm-card-title {
  font-weight: 600;
  font-size: 13px;
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Metadados do card em linha */
.almont-crm-card-meta {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Badge de valor */
.almont-crm-card-value {
  background: linear-gradient(135deg, rgba(241, 189, 49, 0.25), rgba(241, 189, 49, 0.15));
  color: var(--almont-yellow);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.almont-crm-card-value::before {
  content: "R$";
  font-size: 9px;
  opacity: 0.8;
}

/* Badge de vendedor */
.almont-crm-card-owner {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.almont-crm-card-owner::before {
  content: "👤";
  font-size: 10px;
}

/* Card sem vendedor - destaque visual */
.almont-crm-card--no-owner {
  border-left: 3px solid rgba(255, 193, 7, 0.6);
}

.almont-crm-card--no-owner .almont-crm-card-owner {
  background: rgba(255, 193, 7, 0.15);
  color: rgba(255, 193, 7, 0.9);
}

.almont-crm-card--no-owner .almont-crm-card-owner::before {
  content: "⚠️";
}

/* Header da coluna com totais */
.almont-crm-column-header {
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.almont-crm-column-title {
  font-weight: 800;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.3px;
}

/* Contagem com tooltip de valor total */
.almont-crm-column-count {
  background: var(--almont-yellow);
  color: var(--almont-black);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: help;
  position: relative;
}

/* Total da coluna */
.almont-crm-column-total {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
  padding: 6px 12px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  margin-top: 8px;
}

.almont-crm-column-total strong {
  color: var(--almont-yellow);
  font-weight: 700;
}

/* Filtros rápidos no topo */
.almont-crm-board-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.almont-crm-board-filters label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.almont-crm-filter-input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  min-width: 200px;
  transition: all 180ms ease;
}

.almont-crm-filter-input:focus {
  outline: none;
  border-color: var(--almont-yellow);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(241, 189, 49, 0.15);
}

.almont-crm-filter-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Botão de colapsar coluna */
.almont-crm-column-toggle {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 180ms ease;
  margin-right: 8px;
}

.almont-crm-column-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

/* Coluna colapsada */
.almont-crm-column.collapsed {
  width: 60px;
}

.almont-crm-column.collapsed .almont-crm-column-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
}

.almont-crm-column.collapsed .almont-crm-column-body {
  display: none;
}

.almont-crm-column.collapsed .almont-crm-column-header {
  flex-direction: column;
  padding: 14px 8px;
  height: 100%;
  min-height: 200px;
}

/* Loading state para cards */
.almont-crm-card--loading {
  opacity: 0.5;
  pointer-events: none;
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.3; }
}

/* Indicador de mais cards */
.almont-crm-load-more {
  text-align: center;
  padding: 12px;
  margin-top: 8px;
}

.almont-crm-load-more-btn {
  background: rgba(241, 189, 49, 0.15);
  border: 1px dashed rgba(241, 189, 49, 0.4);
  color: var(--almont-yellow);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  width: 100%;
}

.almont-crm-load-more-btn:hover {
  background: rgba(241, 189, 49, 0.25);
  border-color: rgba(241, 189, 49, 0.6);
}

/* Status visual com cores */
.almont-crm-column[data-status="entrada"] .almont-crm-column-header {
  border-bottom-color: rgba(76, 175, 80, 0.5);
}

.almont-crm-column[data-status="entrada"] .almont-crm-column-count {
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
}

.almont-crm-column[data-status="em_atendimento"] .almont-crm-column-header {
  border-bottom-color: rgba(33, 150, 243, 0.5);
}

.almont-crm-column[data-status="em_atendimento"] .almont-crm-column-count {
  background: linear-gradient(135deg, #2196F3, #42A5F5);
}

.almont-crm-column[data-status="proposta"] .almont-crm-column-header {
  border-bottom-color: rgba(255, 152, 0, 0.5);
}

.almont-crm-column[data-status="proposta"] .almont-crm-column-count {
  background: linear-gradient(135deg, #FF9800, #FFB74D);
}

.almont-crm-column[data-status="fechado"] .almont-crm-column-header {
  border-bottom-color: rgba(156, 39, 176, 0.5);
}

.almont-crm-column[data-status="fechado"] .almont-crm-column-count {
  background: linear-gradient(135deg, #9C27B0, #BA68C8);
}

.almont-crm-column[data-status="perdido"] .almont-crm-column-header {
  border-bottom-color: rgba(244, 67, 54, 0.5);
}

.almont-crm-column[data-status="perdido"] .almont-crm-column-count {
  background: linear-gradient(135deg, #F44336, #EF5350);
}

/* Responsivo - Kanban em mobile */
@media (max-width: 768px) {
  .almont-crm-column {
    width: 280px;
  }
  
  .almont-crm-column-body {
    max-height: calc(100vh - 320px);
  }
  
  .almont-crm-card {
    padding: 8px 10px;
  }
  
  .almont-crm-card-title {
    font-size: 12px;
  }
  
  .almont-crm-card-meta {
    font-size: 10px;
  }
}

/* Empty state da coluna */
.almont-crm-column-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

.almont-crm-column-empty::before {
  content: "📋";
  display: block;
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Animação de entrada dos cards */
.almont-crm-card {
  animation: cardSlideIn 200ms ease-out;
}

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

/* Highlight de busca */
.almont-crm-card--highlight {
  border-color: var(--almont-yellow);
  box-shadow: 0 0 0 2px rgba(241, 189, 49, 0.3);
}

/* Quick actions no hover do card */
.almont-crm-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
}

.almont-crm-card:hover .almont-crm-card-actions {
  display: flex;
}

.almont-crm-card-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 150ms ease;
}

.almont-crm-card-action-btn:hover {
  background: var(--almont-yellow);
  color: var(--almont-black);
}

/* Indicador de vendedor original (importação) */
.almont-crm-card-import-note {
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(33, 150, 243, 0.15);
  border-radius: 4px;
  font-size: 10px;
  color: rgba(33, 150, 243, 0.9);
  display: flex;
  align-items: center;
  gap: 4px;
}

.almont-crm-card-import-note::before {
  content: "📋";
  font-size: 10px;
}

/* ==========================================================================
   USER MODAL - Modal do usuário / Troca de senha
   ========================================================================== */

#almont-crm-user-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#almont-crm-user-modal[hidden] {
  display: none !important;
}

#almont-crm-user-modal .almont-crm-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

#almont-crm-user-modal .almont-crm-modal-wrapper {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

#almont-crm-user-modal .almont-crm-modal-content {
  background: linear-gradient(145deg, #2a3a5c, #1e2a42);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#almont-crm-user-modal .almont-crm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#almont-crm-user-modal .almont-crm-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
}

#almont-crm-user-modal .almont-crm-modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

#almont-crm-user-modal .almont-crm-modal-close:hover {
  color: #fff;
}

#almont-crm-user-modal .almont-crm-modal-body {
  padding: 20px;
}

.almont-crm-user-info {
  margin-bottom: 8px;
}

.almont-crm-message {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
}

.almont-crm-message--error {
  background: rgba(244, 67, 54, 0.15);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.almont-crm-message--success {
  background: rgba(76, 175, 80, 0.15);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.almont-crm-field {
  margin-bottom: 12px;
}

.almont-crm-field:last-of-type {
  margin-bottom: 0;
}
