/* ================================================================
   DASHBOARD PROSPECTION — style.css
   Light Mode Premium 2026 — inspiré Linear / Vercel / Stripe
   ================================================================ */

/* ── Variables globales ─────────────────────────────────────── */
:root {
  --bg-page:      #fafafa;
  --bg-card:      #ffffff;
  --border:       #e5e7eb;
  --border-hover: #d1d5db;

  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-tertiary:  #9ca3af;

  --violet:  #7c3aed;
  --blue:    #2563eb;
  --emerald: #059669;
  --red:     #dc2626;
  --amber:   #d97706;

  --font: 'Inter', system-ui, -apple-system, sans-serif;

  --radius-card: 16px;
  --radius-sm:   12px;
  --radius-pill: 100px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ── CARTE base ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
  transition: all 0.3s var(--ease);
  padding: 24px;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
  transform: translateY(-1px);
  border-color: var(--border-hover);
}

/* ── BANDEAU D'ERREUR ───────────────────────────────────────── */
.error-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  border-left: 3px solid #dc2626;
  color: #dc2626;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s var(--ease);
}

.error-icon { width: 18px; height: 18px; flex-shrink: 0; }
.error-banner.hidden { display: none; }

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ── ÉCRAN DE LOGIN ─────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-screen.hidden { display: none; }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: loginCardIn 0.5s var(--ease) both;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Logo Daleria dans le login */
.login-logo {
  width: 130px;
  height: auto;
  object-fit: contain;
  margin-bottom: 24px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  text-align: center;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 32px;
  text-align: center;
}

#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input::placeholder { color: var(--text-tertiary); }

.login-input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.login-input.error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1) !important;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  letter-spacing: -0.01em;
}

.login-btn:hover {
  box-shadow: 0 8px 24px rgba(124,58,237,0.3);
  transform: translateY(-1px);
}

.login-btn:active { transform: translateY(0); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-8px); }
  80%       { transform: translateX(8px); }
}

.login-card.shake {
  animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── LAYOUT PRINCIPAL ───────────────────────────────────────── */
.dashboard { min-height: 100vh; }
.dashboard.hidden { display: none; }

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 48px;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.header-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.header-date {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Badge refresh */
.refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.refresh-badge:hover {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.6; }
}

.pulse-dot.flash { animation: dotFlash 0.8s ease-out; }

@keyframes dotFlash {
  0%   { background: var(--emerald); box-shadow: 0 0 0 0 transparent; }
  30%  { background: #34d399;        box-shadow: 0 0 8px 3px rgba(5,150,105,0.3); }
  100% { background: var(--emerald); box-shadow: 0 0 0 0 transparent; }
}

.refresh-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── SECTIONS ───────────────────────────────────────────────── */
section { margin-bottom: 40px; }

.section-header {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.section-accent {
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed, #2563eb);
  border-radius: 2px;
}

/* ── KPI GRILLES ────────────────────────────────────────────── */
.kpi-grid   { display: grid; gap: 16px; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ── CARTES KPI ─────────────────────────────────────────────── */
.kpi-card    { padding: 28px; }
.kpi-card-sm { padding: 24px; }

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.kpi-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--icon-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--icon-color);
}

.kpi-icon-circle svg,
.kpi-icon-circle i {
  width: 20px;
  height: 20px;
}

.kpi-value {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  transition: background-color 0.8s ease;
  border-radius: 8px;
  padding: 2px 4px;
  margin-left: -4px;
  display: inline-block;
}

.kpi-value-sm { font-size: 32px; }

.kpi-value.flash-green { background-color: #ecfdf5; transition: background-color 0s; }
.kpi-value.flash-blue  { background-color: #eff6ff; transition: background-color 0s; }
.kpi-value.flash-red   { background-color: #fef2f2; transition: background-color 0s; }

.kpi-compare {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.kpi-compare .up   { color: var(--emerald); font-weight: 500; }
.kpi-compare .down { color: var(--red);     font-weight: 500; }
.kpi-compare .flat { color: var(--text-tertiary); }

/* ── GRAPHIQUE ──────────────────────────────────────────────── */
.chart-card { padding: 32px; }

/* ── SECTION DOUBLE ─────────────────────────────────────────── */
.split-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

.table-card { padding: 28px; }

.card-title-block { margin-bottom: 20px; }

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── TABLEAUX ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  border-bottom: 1px solid #f3f4f6;
}

.data-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 0 0 12px 0;
  text-align: left;
}

.data-table td {
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  color: var(--text-primary);
}

.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover td { background: #fafafa; }
.data-table tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right !important; }
.col-green  { color: var(--emerald) !important; }
.col-red    { color: var(--red) !important; }

.empty-cell {
  text-align: center;
  color: var(--text-tertiary);
  font-style: italic;
  padding: 20px 0 !important;
}

.stage-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

/* ── TABLEAU PROSPECTS ──────────────────────────────────────── */
.prospects-card { padding: 0; overflow: hidden; }

.prospects-table-wrapper {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
}

.prospects-table-wrapper::-webkit-scrollbar { width: 6px; height: 6px; }
.prospects-table-wrapper::-webkit-scrollbar-track  { background: #f3f4f6; border-radius: 6px; }
.prospects-table-wrapper::-webkit-scrollbar-thumb  { background: #d1d5db; border-radius: 6px; }
.prospects-table-wrapper::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.prospects-table { min-width: 720px; }

.prospects-table thead { position: sticky; top: 0; z-index: 10; }

.prospects-table thead tr {
  background: var(--bg-card);
  border-bottom: 2px solid #f3f4f6;
}

.prospects-table thead th { padding: 16px 24px; }

.prospects-table tbody td {
  padding: 16px 24px;
  vertical-align: middle;
  border-bottom: 1px solid #f3f4f6;
}

.prospects-table tbody tr:last-child td { border-bottom: none; }
.prospects-table tbody tr:hover td { background: #fafafa; }

.td-date       { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.td-heure      { font-size: 13px; color: var(--text-tertiary);  white-space: nowrap; }
.td-entreprise { font-size: 14px; font-weight: 500; color: var(--text-primary); }

.td-phone { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.td-phone a { color: inherit; text-decoration: none; transition: color 0.15s; }
.td-phone a:hover { color: var(--violet); text-decoration: underline; }

.pipeline-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  background: #f3f4f6;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.status-badge.interested    { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.status-badge.inprogress    { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.status-badge.notinterested { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.status-badge.toprocess     { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

.fw-600 { font-weight: 600; }

/* ── FOOTER ─────────────────────────────────────────────────── */
.dashboard-footer {
  text-align: center;
  margin-top: 48px;
  padding: 24px 0 40px;
  border-top: 1px solid #f3f4f6;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 0 !important;
}

/* ── ANIMATIONS D'ENTRÉE ────────────────────────────────────── */
.anim-section {
  opacity: 0;
  transform: translateY(16px);
  animation: sectionIn 0.5s var(--ease) both;
  animation-delay: var(--delay, 0s);
}

.anim-card {
  opacity: 0;
  transform: translateY(12px);
  animation: cardIn 0.45s var(--ease) both;
  animation-delay: calc(var(--delay, 0.08s) + var(--card-delay, 0s));
}

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TRANSITIONS LOGIN → DASHBOARD ─────────────────────────── */
.login-screen.fade-out {
  animation: loginFadeOut 0.3s var(--ease) both;
}

@keyframes loginFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

.dashboard.fade-in {
  animation: dashboardFadeIn 0.5s var(--ease) both;
}

@keyframes dashboardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE — Tablet ≤ 1024px ───────────────────────────── */
@media (max-width: 1024px) {
  .container { padding: 24px; }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .split-section { grid-template-columns: 1fr; }
}

/* ── RESPONSIVE — Mobile < 768px ───────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .header-title { font-size: 24px; }
  .kpi-grid-4,
  .kpi-grid-5   { grid-template-columns: 1fr; }
  .kpi-value    { font-size: 32px; }
  .kpi-value-sm { font-size: 28px; }
  .split-section { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}
