/* ================================
   Churn Dashboard Styles
   ================================ */

/* KPI Grid */
.churn-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.churn-kpi-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
}

.churn-kpi-primary {
  border-left: 4px solid #4f46e5;
}

.churn-kpi-target {
  border-left: 4px solid #10b981;
}

.churn-kpi-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.churn-kpi-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1f2937;
  line-height: 1.2;
}

.churn-kpi-unit {
  font-size: 0.4em;
  font-weight: 600;
  color: #9ca3af;
}

.churn-kpi-sub {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* Card */
.churn-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
}

.churn-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
}

/* Row layout */
.churn-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Chart */
.churn-chart {
  position: relative;
  padding: 1rem 0;
}

.churn-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  justify-content: space-around;
  min-height: 120px;
  padding-bottom: 2rem;
}

.churn-chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.churn-chart-bar {
  width: 48px;
  border-radius: 6px 6px 0 0;
  position: relative;
  min-height: 20px;
  transition: height 0.3s ease;
}

.churn-chart-bar-pending {
  background: #e5e7eb !important;
  border: 2px dashed #d1d5db;
}

.churn-chart-bar-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.churn-chart-month {
  font-size: 0.75rem;
  color: #6b7280;
}

.churn-chart-target-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed #10b981;
}

.churn-chart-target-line span {
  position: absolute;
  right: 0;
  top: -20px;
  font-size: 0.7rem;
  color: #10b981;
  font-weight: 600;
}

/* Health Segments */
.churn-health-segments {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.churn-health-segment {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.churn-health-segment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.churn-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.churn-health-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  flex: 1;
}

.churn-health-count {
  font-size: 0.8rem;
  color: #6b7280;
}

.churn-health-bar-bg {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

.churn-health-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.churn-health-pct {
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: right;
}

.churn-health-total {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: #6b7280;
  text-align: center;
}

/* Revenue Grid */
.churn-revenue-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.churn-revenue-item {
  text-align: center;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
}

.churn-revenue-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.churn-revenue-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.churn-revenue-sub {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* Strategy Cards */
.churn-strategies {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.churn-strategy-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.churn-strategy-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.churn-strategy-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.churn-strategy-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.churn-strategy-icon-onboarding { background: #4f46e5; }
.churn-strategy-icon-engagement { background: #0891b2; }
.churn-strategy-icon-cs { background: #059669; }
.churn-strategy-icon-product { background: #7c3aed; }
.churn-strategy-icon-pricing { background: #d97706; }

.churn-strategy-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.375rem;
}

.churn-strategy-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.churn-strategy-status,
.churn-strategy-impact,
.churn-strategy-reduction {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
}

.churn-strategy-status-completed { background: #dcfce7; color: #166534; }
.churn-strategy-status-in_progress { background: #dbeafe; color: #1e40af; }
.churn-strategy-status-pending { background: #f3f4f6; color: #6b7280; }

.churn-strategy-impact-high { background: #fef3c7; color: #92400e; }
.churn-strategy-impact-medium { background: #e0f2fe; color: #075985; }
.churn-strategy-impact-low { background: #f3f4f6; color: #6b7280; }

.churn-strategy-reduction {
  background: #ecfdf5;
  color: #065f46;
}

/* Action Items */
.churn-strategy-actions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.churn-action-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.churn-action-item:last-child {
  border-bottom: none;
}

.churn-action-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.churn-action-check-completed { color: #10b981; }
.churn-action-check-in_progress { color: #3b82f6; }
.churn-action-check-pending { color: #d1d5db; }

.churn-action-text {
  font-size: 0.85rem;
  color: #374151;
}

.churn-action-text-completed {
  color: #9ca3af;
  text-decoration: line-through;
}

/* Progress Bar */
.churn-strategy-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f3f4f6;
}

.churn-progress-bar-bg {
  flex: 1;
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
}

.churn-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.churn-progress-text {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

/* Summary Card */
.churn-summary-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: #bbf7d0;
}

.churn-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.churn-summary-item {
  text-align: center;
}

.churn-summary-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.churn-summary-value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* AI Analysis Section */
.churn-ai-section {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #c7d2fe;
}

.churn-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.churn-ai-actions {
  display: flex;
  gap: 0.5rem;
}

.churn-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.churn-btn-primary {
  background: #4f46e5;
  color: white;
}

.churn-btn-primary:hover {
  background: #4338ca;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.churn-btn-secondary {
  background: white;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
}

.churn-btn-secondary:hover {
  background: #eef2ff;
}

.churn-ai-result {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.churn-ai-summary {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

.churn-ai-risk-customer {
  padding: 0.75rem;
  background: #fef2f2;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid #fecaca;
}

.churn-ai-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 50px;
  margin: 2px;
}

.churn-ai-tag-risk {
  background: #fee2e2;
  color: #991b1b;
}

.churn-ai-tag-action {
  background: #dcfce7;
  color: #166534;
}

.churn-ai-error {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
}

/* Filters */
.churn-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.churn-filter-group {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.churn-filter-chip {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 50px;
  text-decoration: none;
  color: #6b7280;
  background: white;
  border: 1px solid #d1d5db;
  transition: background 0.15s, color 0.15s;
}

.churn-filter-chip:hover {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}

.churn-filter-chip.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Customer List */
.churn-customer-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.churn-customer-card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.churn-customer-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.churn-customer-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.churn-customer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.churn-customer-info {
  flex: 1;
  min-width: 0;
}

.churn-customer-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.churn-customer-meta {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.churn-customer-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
}

.churn-customer-badge-plan {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.churn-customer-badge-industry {
  background: #f3f4f6;
  color: #6b7280;
}

.churn-customer-score {
  text-align: right;
  flex-shrink: 0;
}

.churn-customer-score-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.churn-customer-score-label {
  font-size: 0.65rem;
  color: #9ca3af;
}

.churn-customer-health-bar {
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.churn-customer-health-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.churn-customer-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.churn-customer-detail {
  text-align: center;
}

.churn-customer-detail-label {
  font-size: 0.65rem;
  color: #9ca3af;
  display: block;
  margin-bottom: 0.125rem;
}

.churn-customer-detail-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 900px) {
  .churn-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .churn-row {
    flex-direction: column;
  }

  .churn-strategies {
    grid-template-columns: 1fr;
  }

  .churn-revenue-grid {
    grid-template-columns: 1fr;
  }

  .churn-summary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .churn-customer-list {
    grid-template-columns: 1fr;
  }

  .churn-ai-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .churn-filters {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .churn-kpi-grid {
    grid-template-columns: 1fr;
  }

  .churn-kpi-value {
    font-size: 2rem;
  }

  .churn-chart-bar {
    width: 32px;
  }

  .churn-chart-bars {
    gap: 0.5rem;
  }

  .churn-customer-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .churn-customer-score-value {
    font-size: 1.25rem;
  }
}
