/* components.css — Composants réutilisables (Improved Agency v3.0) */

/* ─── TAB BAR ─────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  gap: 3px;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-3);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px; font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.tab-btn.active {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tab-btn:not(.active):hover {
  color: var(--text-2);
  background: rgba(0,0,0,0.03);
}

/* Tab Pills (scrollable) */
.tab-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}
.tab-pills::-webkit-scrollbar { display: none; }
.tab-pill {
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: var(--bg-2);
  color: var(--text-3);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.tab-pill.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* ─── TOGGLE SWITCH ───────────────────────────────────────── */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--bg-4);
  border-radius: 28px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1.5px solid var(--border);
}
.slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.switch input:checked + .slider {
  background: var(--brand);
  border-color: var(--brand-green-dark);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ─── PROGRESS BAR ────────────────────────────────────────── */
.progress-bar-container {
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-brand);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress-bar-fill.gold { background: var(--gradient-gold); }
.progress-bar-fill.danger { background: var(--danger); }

/* ─── STEP INDICATOR ──────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
}
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  color: var(--text-3);
  transition: all 0.3s;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-dot.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: var(--shadow-brand);
}
.step-dot.done {
  background: rgba(var(--brand-green-rgb), 0.15);
  border-color: var(--brand);
  color: var(--brand);
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  transition: background 0.3s;
  margin: 0 4px;
}
.step-line.done { background: var(--brand); }

/* ─── AMOUNT DISPLAY ──────────────────────────────────────── */
.amount-large {
  font-size: 28px; font-weight: 900;
  color: var(--brand); letter-spacing: -0.03em;
}
.amount-negative { color: var(--danger); }
.amount-positive { color: var(--success); }
.amount-neutral  { color: var(--text-2); }

/* ─── LIST ITEM ───────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}
.list-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.list-item:active { transform: scale(0.97); }

/* ─── CARD INTERACTIVE (UX) ───────────────────────────────── */
.card-interactive {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, opacity 0.2s;
}
.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.card-interactive:active {
  transform: scale(0.96) translateY(0);
}
.list-item-avatar {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  flex-shrink: 0;
}
.list-item-content { flex: 1; min-width: 0; }
.list-item-title {
  font-weight: 700; font-size: 15px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item-sub {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
}
.list-item-right { text-align: right; flex-shrink: 0; }

/* ─── TRANSACTION ITEM ────────────────────────────────────── */
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  animation: fadeUp 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
.tx-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tx-icon-in    { background: var(--success-bg); }
.tx-icon-out   { background: var(--danger-bg); }
.tx-icon-appro { background: var(--warning-bg); }

/* ─── STATUS LINE (invoice) ───────────────────────────────── */
.status-timeline {
  display: flex; align-items: center; gap: 0;
  padding: 16px;
  position: relative;
}
.status-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1;
  position: relative;
}
.status-step-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--border);
  transition: all 0.3s;
}
.status-step.done .status-step-dot   { background: var(--brand); border-color: var(--brand); }
.status-step.current .status-step-dot {
  background: var(--brand-yellow);
  border-color: var(--warning);
  box-shadow: 0 0 0 4px var(--gold-dim);
  animation: pulse-dot 1.5s infinite;
}
.status-step-label {
  font-size: 9px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.4px; text-align: center;
}
.status-step.done .status-step-label    { color: var(--brand); }
.status-step.current .status-step-label { color: var(--warning); }
.status-step-line {
  position: absolute;
  top: 5px; left: 50%; right: -50%;
  height: 2px;
  background: var(--border);
}
.status-step.done .status-step-line { background: var(--brand); }

/* ─── SUMMARY ROW ─────────────────────────────────────────── */
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-label { font-size: 14px; color: var(--text-3); }
.summary-value { font-size: 14px; font-weight: 700; color: var(--text); }
.summary-row.total .summary-label { font-size: 16px; font-weight: 800; color: var(--text); }
.summary-row.total .summary-value { font-size: 20px; font-weight: 900; color: var(--brand); }

/* ─── SCORE RING ──────────────────────────────────────────── */
.score-ring {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-width: 2.5px; border-style: solid;
  flex-shrink: 0;
}
.score-ring-value {
  font-size: 13px; font-weight: 900; line-height: 1;
}
.score-ring-label {
  font-size: 8px; font-weight: 700; text-transform: uppercase;
  opacity: 0.7;
}

/* ─── PIPELINE STAGES ─────────────────────────────────────── */
.pipeline-col {
  min-width: 280px;
  flex: 1;
  background: var(--bg-3);
  border-radius: 16px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
@media (max-width: 768px) {
  .pipeline-col {
    min-width: 100%;
    margin-bottom: 8px;
  }
}
.pipeline-header {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-3);
  padding: 4px 4px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.pipeline-badge {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 10px; font-weight: 800;
  color: var(--text-2);
}
.pipeline-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.pipeline-card:hover  { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.pipeline-card:active { transform: scale(0.97); }

/* ─── OVERDUE BANNER ──────────────────────────────────────── */
.overdue-banner {
  background: var(--danger-bg);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.overdue-banner-icon {
  font-size: 20px; flex-shrink: 0;
}
.overdue-banner-text {
  flex: 1;
  font-size: 13px; font-weight: 600; color: var(--danger);
  line-height: 1.4;
}

/* ─── AI INSIGHT CARD ─────────────────────────────────────── */
.insight-card {
  background: var(--gold-dim);
  border: 1px solid rgba(var(--brand-yellow-rgb), 0.2);
  border-left: 3px solid var(--brand-yellow);
  border-radius: 0 14px 14px 0;
  padding: 14px 16px;
}
.insight-label {
  font-size: 10px; font-weight: 800;
  color: var(--warning);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.insight-text {
  font-size: 13px; color: var(--text-2); line-height: 1.6;
}

/* ─── KPI GRID ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.kpi-card-inner {
  padding: 16px;
  border-radius: 20px;
}
.kpi-label {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.6px;
  opacity: 0.75; margin-bottom: 6px;
}
.kpi-value {
  font-size: 20px; font-weight: 900;
  letter-spacing: -0.03em; line-height: 1;
}
.kpi-sub {
  font-size: 10px; margin-top: 4px; opacity: 0.65;
}

/* ─── SUPPORT / WHATSAPP ──────────────────────────────────── */
.wa-bubble {
  max-width: 85%;
  padding: 10px 14px;
  font-size: 14px; line-height: 1.5;
  color: #111B21;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  position: relative;
  word-break: break-word;
}
.wa-bubble-out {
  background: #D9FDD3;
  border-radius: 12px 0 12px 12px;
  align-self: flex-end;
}
.wa-bubble-in {
  background: white;
  border-radius: 0 12px 12px 12px;
}
.wa-time {
  font-size: 10px; color: #667781; text-align: right; margin-top: 4px;
}

/* ─── SIDEBAR BRAND (desktop) ─────────────────────────────── */
#sidebar-brand {
  display: none;
  align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
@media (min-width: 900px) {
  #sidebar-brand { display: flex !important; }
}
.sidebar-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1.5px solid rgba(var(--brand-green-rgb), 0.2);
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; box-sizing: border-box; }
.sidebar-logo-fallback {
  display: none;
  width: 100%; height: 100%;
  align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: var(--brand);
}
.sidebar-title {
  font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.2;
}
.sidebar-sub {
  font-size: 10px; color: var(--text-3); font-weight: 500;
}
