/* ═══════════════════════════════════════════════════════
   GESTION CANDIDATURES – Feuille de style principale
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:   #1a3a5c;
  --primary-light: #234e7a;
  --accent:    #e8a020;
  --accent-hover: #cf8c18;
  --success:   #1e7e34;
  --danger:    #c0392b;
  --warning:   #e67e22;
  --info:      #2980b9;
  --bg:        #f4f6fa;
  --card:      #ffffff;
  --border:    #dce3ef;
  --text:      #1a2433;
  --text-muted:#6b7a99;
  --shadow:    0 4px 24px rgba(26,58,92,.08);
  --radius:    12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── NAV ─────────────────────────────────────────────── */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 2rem;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.18);
}
.navbar .brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
}
.navbar .brand span.tag {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .5px;
}
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: rgba(255,255,255,.82); font-size: .9rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: #fff; }
.btn-nav {
  background: var(--accent);
  color: #fff !important;
  padding: .45rem 1.1rem;
  border-radius: 6px;
  font-weight: 600;
  transition: background .2s;
}
.btn-nav:hover { background: var(--accent-hover) !important; }

/* ── HERO ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0f2540 100%);
  color: #fff;
  text-align: center;
  padding: 5rem 2rem 4rem;
}
.hero h1 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 800; margin-bottom: 1rem; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.1rem; opacity: .85; max-width: 620px; margin: 0 auto 2.5rem; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.6rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.5); }
.btn-outline:hover { border-color: #fff; background: rgba(255,255,255,.1); }
.btn-blue { background: var(--primary); color: #fff; }
.btn-blue:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #145a23; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #9b2b1e; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #ca6f1e; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #1f6fa3; }
.btn-sm { padding: .38rem 1rem; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ── CARDS & CONTAINERS ──────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 4rem 0; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.8rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

/* ── GRID STATS ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 1rem; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.2rem;
  text-align: center;
  border-top: 4px solid;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card.blue  { border-color: var(--primary); }
.stat-card.amber { border-color: var(--accent); }
.stat-card.green { border-color: var(--success); }
.stat-card.red   { border-color: var(--danger); }
.stat-card.purple{ border-color: #8e44ad; }
.stat-icon { font-size: 2rem; margin-bottom: .5rem; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; margin-top: .25rem; }

/* ── POSTES GRID ─────────────────────────────────────── */
.postes-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 1.4rem; }
.poste-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.6rem;
  border-left: 5px solid var(--accent);
  transition: transform .2s, box-shadow .2s;
}
.poste-card:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(26,58,92,.13); }
.poste-card h3 { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: .5rem; }
.poste-card p { font-size: .85rem; color: var(--text-muted); }

/* ── FORMS ───────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: .88rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.form-control {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .93rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,92,.08); }
.form-control::placeholder { color: #b0baca; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.file-input-wrapper { position: relative; }
.file-input-wrapper input[type=file] { display: none; }
.file-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .88rem;
  color: var(--text-muted);
  transition: border-color .2s;
}
.file-label:hover { border-color: var(--primary); color: var(--primary); }
.file-label.has-file { border-color: var(--success); color: var(--success); background: #f0fff4; }

/* ── TABLE ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
thead th {
  background: var(--primary);
  color: #fff;
  padding: .85rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .3px;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: #f8fafd; }
tbody td { padding: .8rem 1rem; vertical-align: middle; }
.td-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .28rem .7rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending  { background: #fef3cd; color: #856404; }
.badge-retained { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-interview{ background: #cce5ff; color: #004085; }

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  padding: 1.4rem 1.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 1.8rem; }
.modal-footer { padding: 1rem 1.8rem; border-top: 1px solid var(--border); display: flex; gap: .7rem; justify-content: flex-end; }

/* ── TABS ────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .7rem 1.4rem;
  background: none;
  border: none;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── SEARCH/FILTER BAR ───────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.2rem;
}
.filter-bar .form-control { max-width: 220px; }
.filter-bar select.form-control { max-width: 200px; }

/* ── PROGRESS BAR ────────────────────────────────────── */
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width .6s; }

/* ── ALERT ───────────────────────────────────────────── */
.alert {
  padding: .9rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #cce5ff; color: #004085; border: 1px solid #b8daff; }

/* ── EMAIL PREVIEW ───────────────────────────────────── */
.email-preview {
  background: #f8fafd;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  font-size: .88rem;
}
.email-preview .ep-field { margin-bottom: .6rem; }
.email-preview .ep-label { font-weight: 700; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; }
.email-preview .ep-body { margin-top: .8rem; white-space: pre-wrap; line-height: 1.7; border-top: 1px solid var(--border); padding-top: .8rem; }
.email-preview textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: .7rem; font-size: .87rem; font-family: inherit; min-height: 240px; resize: vertical; }

/* ── LOGIN PAGE ──────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #0f2540 100%);
}
.login-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.login-box .logo-area { text-align: center; margin-bottom: 2rem; }
.login-box .logo-area h2 { color: var(--primary); font-size: 1.4rem; font-weight: 800; }
.login-box .logo-area p { color: var(--text-muted); font-size: .88rem; }

/* ── DASHBOARD LAYOUT ────────────────────────────────── */
.dash-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 66px); }
.sidebar {
  background: var(--primary);
  padding: 1.5rem 0;
  position: sticky;
  top: 66px;
  height: calc(100vh - 66px);
  overflow-y: auto;
}
.sidebar-user {
  padding: 0 1.2rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 1rem;
}
.sidebar-user .avatar {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  margin-bottom: .6rem;
}
.sidebar-user .u-name { color: #fff; font-weight: 700; font-size: .92rem; }
.sidebar-user .u-role { color: rgba(255,255,255,.55); font-size: .78rem; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem 1.4rem;
  color: rgba(255,255,255,.7);
  font-size: .88rem;
  font-weight: 500;
  transition: all .2s;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.sidebar nav a .icon { font-size: 1.1rem; width: 20px; text-align: center; }
.dash-main { padding: 2rem 1.8rem; overflow-y: auto; }
.dash-title { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 1.5rem; }

/* ── CHART CONTAINER ─────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-bottom: 1.4rem; }
.chart-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  border: 1px solid var(--border);
}
.chart-box h4 { font-size: .92rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
canvas { max-height: 240px; }

/* ── TIMELINE ────────────────────────────────────────── */
.timeline { padding-left: 1rem; border-left: 3px solid var(--border); }
.timeline-item { position: relative; padding-left: 1.4rem; margin-bottom: 1.2rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
}
.timeline-item .t-date { font-size: .75rem; color: var(--text-muted); }
.timeline-item .t-text { font-size: .88rem; font-weight: 500; }

/* ── FOOTER ──────────────────────────────────────────── */
footer {
  background: var(--primary);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 1.5rem;
  font-size: .83rem;
  margin-top: 3rem;
}

/* ── TOAST ───────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .6rem; }
.toast {
  background: var(--text);
  color: #fff;
  padding: .8rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  animation: toastIn .3s ease;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes toastIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── SPINNER ─────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SCORE STARS ─────────────────────────────────────── */
.score-input { display: flex; gap: .3rem; }
.score-input label { cursor: pointer; font-size: 1.4rem; color: #ddd; transition: color .15s; }
.score-input input { display: none; }
.score-input input:checked ~ label, .score-input label:hover,
.score-input label:hover ~ label { color: var(--accent); }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: .93rem; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 3rem 1.5rem; }
}

/* ── AJOUTS GRILLE DE PRÉSÉLECTION ──────────────────────────────────── */
.alert-info { background:#cce5ff; color:#004085; border:1px solid #b8daff; }

.ep-label {
  font-weight:700;
  color:var(--text-muted);
  font-size:.75rem;
  text-transform:uppercase;
  letter-spacing:.4px;
  margin-right:.4rem;
}
.ep-body {
  margin-top:.8rem;
  border-top:1px solid var(--border);
  padding-top:.8rem;
}
.email-preview {
  background:#f8fafd;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:1.2rem;
  font-size:.88rem;
}

/* Hero */
.hero {
  background:linear-gradient(135deg,var(--primary) 0%,#0f2540 100%);
  color:#fff;
  text-align:center;
  padding:5rem 2rem 4rem;
}
.hero h1 { font-size:clamp(2rem,4vw,3.2rem);font-weight:800;margin-bottom:1rem; }
.hero h1 span { color:var(--accent); }
.hero p { font-size:1.1rem;opacity:.85;max-width:620px;margin:0 auto 2.5rem; }
.hero-btns { display:flex;gap:1rem;justify-content:center;flex-wrap:wrap; }
.btn-outline { background:transparent;color:#fff;border:2px solid rgba(255,255,255,.5); }
.btn-outline:hover { border-color:#fff;background:rgba(255,255,255,.1); }

/* File label */
.file-label.has-file { border-color:var(--success);color:var(--success);background:#f0fff4; }

/* Stat purple */
.stat-card.purple { border-color:#8e44ad; }

/* Badge interview */
.badge-interview { background:#cce5ff;color:#004085; }

/* Spinner */
.spinner {
  width:18px;height:18px;
  border:2px solid rgba(255,255,255,.3);
  border-top-color:#fff;
  border-radius:50%;
  animation:spin .7s linear infinite;
  display:inline-block;vertical-align:middle;margin-right:.4rem;
}
@keyframes spin { to { transform:rotate(360deg); } }
