/* ──────────────────────────────────────────────
   Dashboard Contact - Widget Zoho CRM v2
   6 sections repliables, optimisé opérateur
   ────────────────────────────────────────────── */

:root {
  --green: #22c55e;
  --green-bg: #f0fdf4;
  --orange: #f59e0b;
  --orange-bg: #fffbeb;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --gray: #9ca3af;
  --gray-bg: #f9fafb;
  --blue: #3b82f6;
  --blue-bg: #eff6ff;
  --dark: #1f2937;
  --mid: #6b7280;
  --light: #e5e7eb;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--dark);
  background: var(--gray-bg);
  padding: 12px;
}

/* Layout principal — colonne unique */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
}

/* ── Header compact ── */
.dash-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.dash-header .company-name {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.dash-header .header-meta {
  font-size: 11px;
  color: var(--mid);
  text-align: right;
}

.dash-header .header-meta span { display: block; }

/* ── Sections repliables ── */
.section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  transition: background 0.15s;
}

.section-header:hover { background: var(--gray-bg); }

.section-header .section-icon { font-size: 15px; flex-shrink: 0; }

.section-header .section-title { flex: 1; }

.section-header .section-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--mid);
  background: var(--gray-bg);
  padding: 1px 7px;
  border-radius: 10px;
}

.section-header .chevron {
  font-size: 10px;
  color: var(--mid);
  transition: transform 0.2s;
}

.section.collapsed .chevron { transform: rotate(-90deg); }

.section-body {
  padding: 0 14px 12px;
}

.section.collapsed .section-body { display: none; }

/* ── Telephones ── */
.phone-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--blue-bg);
  border-radius: 6px;
  font-size: 12px;
}

.phone-context-company {
  font-weight: 700;
  color: var(--dark);
}

.phone-context-ask {
  color: var(--mid);
}

.phone-context-ask strong {
  color: var(--blue);
}

.phone-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--gray-bg);
}

.phone-row:last-child { margin-bottom: 0; }

.phone-number {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  flex: 1;
  color: var(--dark);
}

.phone-fiabilite {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-onoff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-onoff:hover { background: #374151; }

.btn-zoho-voice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-zoho-voice:hover { background: #2563eb; }

/* ── Emails avec barre de progression ── */
.email-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--gray-bg);
}

.email-row:last-child { margin-bottom: 0; }

.email-address {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  flex-shrink: 0;
  color: var(--dark);
}

.email-address a {
  color: var(--dark);
  text-decoration: none;
}

.email-address a:hover { color: var(--blue); }

.progress-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--light);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.fill-green { background: var(--green); }
.fill-orange { background: var(--orange); }
.fill-red { background: var(--red); }
.fill-gray { background: var(--gray); }

.progress-score {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 24px;
}

.progress-label {
  font-size: 11px;
  color: var(--mid);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Sources chips cliquables ── */
.sources-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
  transition: all 0.15s;
}

.source-tag:hover {
  background: #dbeafe;
  border-color: var(--blue);
}

/* ── Dirigeants ── */
.director-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--gray-bg);
}

.director-row:last-child { margin-bottom: 0; }

.director-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-bg), #dbeafe);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.director-info { flex: 1; }
.director-name { font-weight: 600; font-size: 13px; }
.director-role { font-size: 11px; color: var(--mid); margin-top: 1px; }

.director-meta {
  text-align: right;
  flex-shrink: 0;
}

.director-age {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
}

.director-since {
  font-size: 10px;
  color: var(--mid);
}

/* ── Reseaux sociaux ── */
.social-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: opacity 0.15s, transform 0.1s;
}

.social-btn:hover { opacity: 0.85; }
.social-btn:active { transform: scale(0.96); }

.social-btn.facebook { background: #1877F2; }
.social-btn.linkedin { background: #0A66C2; }
.social-btn.twitter { background: #000000; }
.social-btn.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

.social-btn.disabled {
  background: var(--light) !important;
  color: var(--gray);
  pointer-events: none;
  opacity: 0.6;
}

/* ── OSINT ── */
.osint-credits {
  font-size: 11px;
  color: var(--mid);
  margin-bottom: 8px;
}

.osint-credits strong { color: var(--dark); }

.osint-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.osint-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--green-bg);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.osint-chip.reliable {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 600;
}

.osint-query-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--mid);
  margin-top: 8px;
  margin-bottom: 4px;
}

.osint-query-label:first-child { margin-top: 0; }

/* ── Actions bar ── */
.actions-bar {
  display: flex;
  gap: 8px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #2563eb; }

.btn-secondary {
  background: var(--gray-bg);
  color: var(--dark);
  border: 1px solid var(--light);
}

.btn-secondary:hover { background: var(--light); }

.btn-primary:disabled {
  background: var(--light);
  color: var(--mid);
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Status empty */
.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--mid);
}

.empty-state .empty-icon { font-size: 32px; margin-bottom: 10px; }

/* Horaires */
.horaires {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mid);
  padding: 6px 10px;
  background: var(--orange-bg);
  border-radius: 6px;
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 550px) {
  .phone-row { flex-wrap: wrap; }
  .email-row { flex-wrap: wrap; }
  .progress-bar-wrap { width: 100%; }
}
