/* SPM Strategies CRM - Custom Styles */
/* Tailwind handles most styling; this file covers interactions and kanban layout */

/* ===== KANBAN LAYOUT ===== */

/* Mobile: horizontal scroll with snap */
.kanban-scroll {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-padding: 1rem;
}

.kanban-column {
  min-width: 85vw;
  max-width: 85vw;
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* Desktop: fixed-width grid columns */
@media (min-width: 768px) {
  .kanban-scroll {
    scroll-snap-type: none;
  }

  .kanban-column {
    min-width: 0;
    max-width: none;
  }
}

/* Kanban scrollbar */
.kanban-scroll::-webkit-scrollbar {
  height: 6px;
}

.kanban-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.kanban-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.kanban-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Column card list scroll */
.kanban-cards {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.kanban-cards::-webkit-scrollbar-track {
  background: transparent;
}

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

/* ===== LEAD CARDS ===== */

.lead-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.lead-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.lead-card:active {
  transform: scale(0.98);
}

/* Stale indicator - red left border */
.lead-card.stale {
  border-left: 4px solid #ef4444;
}

/* ===== TAB BAR ===== */

.tab-btn {
  transition: color 0.15s ease;
  position: relative;
}

.tab-btn.active {
  color: #2563eb;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: #2563eb;
  border-radius: 1px;
}

@media (min-width: 768px) {
  .tab-btn {
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
  }

  .tab-btn.active::after {
    left: 0;
    right: 0;
    bottom: -1px;
  }
}

/* ===== MODAL ===== */

/* Overlay fade */
#lead-modal-overlay.show {
  opacity: 1;
}

/* Bottom sheet slide up (mobile) */
#lead-modal-sheet.show {
  transform: translateY(0);
}

/* Desktop: scale in */
@media (min-width: 768px) {
  #lead-modal-sheet.show {
    transform: scale(1);
    opacity: 1;
  }

  #lead-modal-sheet {
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
}

/* ===== STAGE PROGRESS BAR ===== */

.stage-progress {
  display: flex;
  gap: 3px;
}

.stage-dot {
  height: 4px;
  border-radius: 2px;
  flex: 1;
  background: #e2e8f0;
  transition: background 0.2s ease;
}

.stage-dot.filled {
  background: var(--stage-color, #3b82f6);
}

/* ===== TIMELINE ===== */

.timeline-item {
  position: relative;
  padding-left: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.timeline-item.note::before {
  background: #3b82f6;
}

.timeline-item.touchpoint::before {
  background: #10b981;
}

.timeline-item.stage-change::before {
  background: #f59e0b;
}

/* Timeline connector line */
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 1rem;
  bottom: -0.75rem;
  width: 1px;
  background: #e2e8f0;
}

/* Email timeline entries */
.timeline-item.email {
  border-left: 3px solid transparent;
  padding-left: calc(1.5rem - 3px);
  margin-left: 0;
}

.timeline-item.email::before {
  display: none;
}

.timeline-item.email-sent {
  border-left-color: #10b981;
}

.timeline-item.email-engagement {
  border-left-color: #3b82f6;
}

/* Gmail message entries */
.timeline-item.gmail {
  border-left: 3px solid transparent;
  padding-left: calc(1.5rem - 3px);
  margin-left: 0;
}

.timeline-item.gmail::before {
  display: none;
}

.timeline-item.gmail-sent {
  border-left-color: #10b981;
}

.timeline-item.gmail-received {
  border-left-color: #3b82f6;
}

/* Email accordion */
.email-accordion-header {
  transition: color 0.15s ease;
}

.email-accordion-header:hover {
  color: #1e40af;
}

.email-accordion-body {
  transition: max-height 0.2s ease;
}

/* ===== METRICS ===== */

.metric-bar {
  transition: width 0.5s ease;
}

.funnel-row {
  transition: background 0.15s ease;
}

.funnel-row:hover {
  background: #f8fafc;
}

/* ===== UTILITY ===== */

/* Refresh spin animation */
.spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Pulse for loading states */
.pulse-bg {
  animation: pulse-bg 1.5s ease-in-out infinite;
}

@keyframes pulse-bg {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Priority badges */
.priority-high {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.priority-medium {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.priority-low {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* Brand badges */
.brand-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Safe area padding for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #tab-bar {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
