/* =============================================
   FlowCRM — Custom Design Tokens & Atmosphere
   ============================================= */

:root {
  --color-brand:        #13b090;
  --color-brand-dark:   #0c8e75;
  --color-brand-light:  #cbfaed;
  --color-warm:         #eab308;
  --color-warm-light:   #fef9c3;
  --color-surface:      #fafaf9;
  --color-card:         #ffffff;
  --color-text:         #1c1917;
  --color-text-muted:   #78716c;
  --color-border:       #e7e5e4;
  --radius-lg:          1rem;
  --radius-xl:          1.25rem;
  --shadow-card:        0 1px 3px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-card-hover:  0 4px 12px rgba(28, 25, 23, 0.08), 0 2px 4px rgba(28, 25, 23, 0.04);
  --transition-base:    200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----- Background atmosphere ----- */
body {
  background-color: #fafaf9;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(19, 176, 144, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(234, 179, 8, 0.03) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ----- Auth tabs ----- */
.auth-tab {
  position: relative;
}
.auth-tab.active {
  color: var(--color-brand-dark);
  border-bottom-color: var(--color-brand);
}

/* ----- Kanban columns ----- */
.kanban-column {
  min-width: 300px;
  max-width: 340px;
  flex: 0 0 auto;
  background: var(--color-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-base);
}

.kanban-column.drag-over {
  box-shadow: 0 0 0 3px rgba(19, 176, 144, 0.25), var(--shadow-card-hover);
  border-color: var(--color-brand);
}

.kanban-column-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-brand-light);
  color: var(--color-brand-dark);
}

.kanban-column-body {
  flex: 1;
  min-height: 120px;
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ----- Lead cards ----- */
.lead-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  cursor: grab;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  box-shadow: var(--shadow-card);
  position: relative;
}
.lead-card:hover {
  box-shadow: var(--shadow-card-hover);
}
.lead-card:active {
  cursor: grabbing;
}
.lead-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}
.lead-card.drag-placeholder {
  border: 2px dashed var(--color-border);
  background: transparent;
  min-height: 80px;
}

.lead-card-title {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.lead-card-company {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.lead-card-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-brand-dark);
}

.lead-card-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.lead-card:hover .lead-card-actions {
  opacity: 1;
}
.lead-card-btn {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-muted);
  transition: all var(--transition-base);
}
.lead-card-btn:hover {
  background: var(--color-brand-light);
  color: var(--color-brand-dark);
}
.lead-card-btn.delete:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* ----- Status dots ----- */
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  display: inline-block;
}
.status-dot.Novo              { background: #6366f1; }
.status-dot.Contato-Inicial   { background: #3b82f6; }
.status-dot.Proposta           { background: #f59e0b; }
.status-dot.Negociacao         { background: #f97316; }
.status-dot.Fechado            { background: #10b981; }
.status-dot.Perdido            { background: #94a3b8; }

/* ----- Toast animations ----- */
.toast {
  pointer-events: auto;
  animation: toast-in 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast-undo {
  animation: toast-in 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast-out {
  animation: toast-out 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(100%) scale(0.95); }
}

/* ----- Page-load orchestration ----- */
#auth-screen, #app-screen {
  animation: fade-in 400ms ease-out;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----- Scrollbar styling ----- */
.kanban-column-body::-webkit-scrollbar {
  width: 6px;
}
.kanban-column-body::-webkit-scrollbar-track {
  background: transparent;
}
.kanban-column-body::-webkit-scrollbar-thumb {
  background: #d6d3d1;
  border-radius: 3px;
}
.kanban-column-body::-webkit-scrollbar-thumb:hover {
  background: #a8a29e;
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----- Empty state ----- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
  text-align: center;
  font-size: 0.85rem;
  gap: 0.25rem;
}

/* ----- Focus visible ----- */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}
