/* public/style.css */

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

:root {
  --bg       : #0d0f14;
  --bg2      : #151820;
  --bg3      : #1c2030;
  --bg4      : #242840;
  --border   : rgba(255,255,255,.08);
  --border2  : rgba(255,255,255,.14);
  --text     : #e8eaf2;
  --text2    : #8a90a8;
  --text3    : #555d7a;
  --accent   : #4f8ef7;
  --green    : #2dce89;
  --orange   : #f7931e;
  --red      : #ef4d6d;
  --purple   : #9966ff;
  --teal     : #11cdef;
  --amber    : #ffd045;
  --radius   : 10px;
  --radius-lg: 14px;
}

html, body {
  background : var(--bg);
  color      : var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size  : 14px;
  line-height: 1.6;
  min-height : 100vh;
}

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar      { width: 5px; height: 5px; }
::-webkit-scrollbar-track{ background: var(--bg2); }
::-webkit-scrollbar-thumb{ background: var(--bg4); border-radius: 3px; }

/* ── Layout ──────────────────────────────────── */
.app       { max-width: 1400px; margin: 0 auto; padding: 0 20px 40px; }

/* ── Header ──────────────────────────────────── */
.header {
  display        : flex;
  align-items    : center;
  justify-content: space-between;
  padding        : 18px 0 16px;
  border-bottom  : 1px solid var(--border);
  margin-bottom  : 20px;
  position       : sticky;
  top            : 0;
  background     : var(--bg);
  z-index        : 100;
}
.logo {
  display    : flex;
  align-items: center;
  gap        : 10px;
}
.logo-icon {
  width          : 32px;
  height         : 32px;
  background     : linear-gradient(135deg, var(--accent), var(--purple));
  border-radius  : 8px;
  display        : flex;
  align-items    : center;
  justify-content: center;
  font-weight    : 700;
  font-size      : 12px;
  letter-spacing : 0;
}
.logo-name    { font-size: 17px; font-weight: 700; letter-spacing: -.4px; }
.logo-name em { color: var(--accent); font-style: normal; }
.logo-tag     { font-size: 10px; color: var(--text3); letter-spacing: .5px; text-transform: uppercase; }

.header-right { display: flex; align-items: center; gap: 12px; }

.live-badge {
  display    : flex;
  align-items: center;
  gap        : 6px;
  background : rgba(45,206,137,.1);
  border     : 1px solid rgba(45,206,137,.2);
  border-radius: 20px;
  padding    : 4px 10px;
  font-size  : 11px;
  color      : var(--green);
  font-weight: 500;
}
.live-dot {
  width     : 6px;
  height    : 6px;
  background: var(--green);
  border-radius: 50%;
  animation : blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.status-chip {
  font-size    : 11px;
  color        : var(--text2);
  padding      : 4px 10px;
  background   : var(--bg3);
  border       : 1px solid var(--border);
  border-radius: 20px;
  font-family  : monospace;
  max-width    : 220px;
  white-space  : nowrap;
  overflow     : hidden;
  text-overflow: ellipsis;
}

.btn {
  padding      : 6px 14px;
  background   : transparent;
  border       : 1px solid var(--border2);
  border-radius: 8px;
  color        : var(--text2);
  font-size    : 12px;
  font-family  : inherit;
  cursor       : pointer;
  transition   : all .2s;
}
.btn:hover { background: var(--bg3); border-color: var(--accent); color: var(--accent); }
.btn:active{ transform: scale(.97); }

/* ── Alerte Fallback ─────────────────────────── */
.fallback-alert {
  display      : flex;
  align-items  : center;
  gap          : 10px;
  background   : rgba(247,147,30,.08);
  border       : 1px solid rgba(247,147,30,.2);
  border-radius: var(--radius);
  padding      : 10px 16px;
  font-size    : 12px;
  color        : var(--orange);
  margin-bottom: 16px;
}
.fallback-alert.hidden { display: none; }

/* ── KPI Cards ───────────────────────────────── */
.kpi-grid {
  display              : grid;
  grid-template-columns: repeat(4, 1fr);
  gap                  : 12px;
  margin-bottom        : 20px;
}
.kpi {
  background   : var(--bg2);
  border       : 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding      : 16px 18px;
  position     : relative;
  overflow     : hidden;
  transition   : border-color .3s;
}
.kpi:hover { border-color: var(--border2); }
.kpi::before {
  content       : '';
  position      : absolute;
  top           : 0; left: 0; right: 0;
  height        : 2px;
  background    : var(--kpi-color, var(--accent));
}
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text3); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--kpi-color, var(--text)); line-height: 1; }
.kpi-sub   { font-size: 11px; color: var(--text3); margin-top: 6px; }

/* ── Sources bar ─────────────────────────────── */
.sources-row {
  display              : grid;
  grid-template-columns: repeat(6, 1fr);
  gap                  : 8px;
  margin-bottom        : 20px;
}
.src-pill {
  background   : var(--bg2);
  border       : 1px solid var(--border);
  border-radius: var(--radius);
  padding      : 9px 12px;
  display      : flex;
  flex-direction: column;
  gap          : 4px;
  transition   : border-color .3s;
}
.src-pill.ok      { border-color: rgba(45,206,137,.2); }
.src-pill.error   { border-color: rgba(239,77,109,.2); }
.src-pill.loading { border-color: rgba(79,142,247,.2); }
.src-name  { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); }
.src-count { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.src-state { font-size: 10px; color: var(--text3); }
.src-count.ok     { color: var(--green); }
.src-count.error  { color: var(--red); }
.src-count.demo   { color: var(--orange); }
.src-count.loading{ color: var(--accent); }

/* ── Grid principale ─────────────────────────── */
.main-grid {
  display              : grid;
  grid-template-columns: 1fr 1fr;
  gap                  : 14px;
  margin-bottom        : 14px;
}
.main-grid.three { grid-template-columns: 2fr 1fr 1fr; }
.main-grid.full  { grid-column: 1/-1; }

/* ── Card ────────────────────────────────────── */
.card {
  background   : var(--bg2);
  border       : 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding      : 18px;
  overflow     : hidden;
}
.card-title {
  font-size    : 11px;
  font-weight  : 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color        : var(--text3);
  margin-bottom: 16px;
  display      : flex;
  align-items  : center;
  justify-content: space-between;
}
.card-title .badge-sm {
  font-size    : 9px;
  padding      : 2px 7px;
  background   : var(--bg4);
  border-radius: 20px;
  color        : var(--text3);
  text-transform: none;
  letter-spacing: 0;
}

/* ── Bar Charts ──────────────────────────────── */
.bar-item   { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-label  { font-size: 12px; color: var(--text2); width: 130px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track  { flex: 1; height: 6px; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.bar-fill   { height: 100%; border-radius: 3px; width: 0; transition: width 1.2s cubic-bezier(.4,0,.2,1); }
.bar-val    { font-size: 11px; color: var(--text3); font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* ── Donut Chart canvas ──────────────────────── */
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12px; color: var(--text2); }
.donut-legend-dot  { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.donut-legend-pct  { margin-left: auto; font-size: 11px; color: var(--text3); font-variant-numeric: tabular-nums; }

/* ── Skills Cloud ────────────────────────────── */
.skills-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-chip {
  font-size    : 11px;
  padding      : 4px 10px;
  border-radius: 20px;
  border       : 1px solid;
  font-weight  : 500;
  white-space  : nowrap;
  transition   : transform .15s;
}
.skill-chip:hover { transform: translateY(-1px); }

/* ── Filtres ─────────────────────────────────── */
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-select {
  background   : var(--bg3);
  border       : 1px solid var(--border2);
  border-radius: 8px;
  color        : var(--text);
  font-size    : 12px;
  font-family  : inherit;
  padding      : 6px 10px;
  cursor       : pointer;
  outline      : none;
  transition   : border-color .2s;
}
.filter-select:focus { border-color: var(--accent); }
.filter-input {
  background   : var(--bg3);
  border       : 1px solid var(--border2);
  border-radius: 8px;
  color        : var(--text);
  font-size    : 12px;
  font-family  : inherit;
  padding      : 6px 12px;
  outline      : none;
  flex         : 1;
  min-width    : 180px;
  transition   : border-color .2s;
}
.filter-input::placeholder { color: var(--text3); }
.filter-input:focus { border-color: var(--accent); }
.filter-count { font-size: 11px; color: var(--text3); margin-left: auto; }

/* ── Table offres ────────────────────────────── */
.jobs-table { width: 100%; border-collapse: collapse; }
.jobs-table th {
  font-size    : 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color        : var(--text3);
  font-weight  : 600;
  padding      : 8px;
  border-bottom: 1px solid var(--border);
  text-align   : left;
  position     : sticky;
  top          : 0;
  background   : var(--bg2);
}
.jobs-table td {
  padding      : 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size    : 12px;
  color        : var(--text2);
}
.jobs-table tbody tr:last-child td { border-bottom: none; }
.jobs-table tbody tr:hover td      { background: var(--bg3); }
.job-title-cell { font-weight: 600; color: var(--text); }
.job-title-cell a { color: inherit; text-decoration: none; }
.job-title-cell a:hover { color: var(--accent); }

.badge {
  display      : inline-block;
  font-size    : 10px;
  padding      : 2px 8px;
  border-radius: 4px;
  font-weight  : 600;
  white-space  : nowrap;
}
.badge-cdi   { background: rgba(45,206,137,.12); color: var(--green); }
.badge-cdd   { background: rgba(255,208,69,.1);  color: var(--amber); }
.badge-stage { background: rgba(153,102,255,.12);color: var(--purple);}
.badge-other { background: var(--bg4);            color: var(--text3); }

.sector-chip {
  font-size    : 10px;
  display      : inline-flex;
  align-items  : center;
  gap          : 4px;
}
.sector-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.source-mono { font-family: monospace; font-size: 10px; color: var(--text3); }

/* ── Pied de page ────────────────────────────── */
.footer {
  display        : flex;
  align-items    : center;
  justify-content: space-between;
  margin-top     : 20px;
  padding-top    : 14px;
  border-top     : 1px solid var(--border);
  font-size      : 10px;
  color          : var(--text3);
  font-family    : monospace;
}

/* ── Loader skeleton ─────────────────────────── */
.skeleton {
  background   : linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation    : shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .kpi-grid    { grid-template-columns: repeat(2,1fr); }
  .sources-row { grid-template-columns: repeat(3,1fr); }
  .main-grid   { grid-template-columns: 1fr; }
  .main-grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .kpi-grid    { grid-template-columns: repeat(2,1fr); }
  .sources-row { grid-template-columns: repeat(2,1fr); }
  .logo-tag    { display: none; }
}
