/* ============================================================
   IGENSIA Intervenants — style.css
   ============================================================ */

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

:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --border: rgba(0, 0, 0, 0.1);
  --border-mid: rgba(0, 0, 0, 0.18);
  --text-primary: #1a1a18;
  --text-secondary: #5a5955;
  --text-tertiary: #9a9894;
  --blue-bg: #e6f1fb;
  --blue-text: #0c447c;
  --blue-mid: #185fa5;
  --green-bg: #e1f5ee;
  --green-text: #0f6e56;
  --amber-bg: #faeeda;
  --amber-text: #854f0b;
  --purple-bg: #eeedfe;
  --purple-text: #3c3489;
  --red-bg: #fcebeb;
  --red-text: #a32d2d;
  --red-border: #f09595;
  /* jury */
  --jury-pro-bg: #fff0e6;
  --jury-pro-text: #8b3a00;
  --jury-pro-border: #f5b98a;
  --jury-pédago-bg: #e8f0fe;
  --jury-pédago-text: #1a3a7c;
  --jury-pédago-border: #93b4f5;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a18;
    --surface: #242422;
    --surface-2: #2e2e2b;
    --border: rgba(255, 255, 255, 0.1);
    --border-mid: rgba(255, 255, 255, 0.18);
    --text-primary: #f0efe9;
    --text-secondary: #a8a7a0;
    --text-tertiary: #686762;
    --blue-bg: #0c2d4f;
    --blue-text: #85b7eb;
    --blue-mid: #378add;
    --green-bg: #073424;
    --green-text: #5dcaa5;
    --amber-bg: #3d2a0a;
    --amber-text: #fac775;
    --purple-bg: #1e1a4a;
    --purple-text: #afa9ec;
    --red-bg: #3d1010;
    --red-text: #f09595;
    --red-border: #791f1f;
    --jury-pro-bg: #3d1e00;
    --jury-pro-text: #fba96a;
    --jury-pro-border: #8b4a12;
    --jury-pédago-bg: #0d1f4a;
    --jury-pédago-text: #93b4f5;
    --jury-pédago-border: #1a3a7c;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ── */
.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Header ── */
.header {
  margin-bottom: 1.75rem;
}
.header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}
.header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
#searchInput:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.12);
}

#sortSelect,
#filterContrat,
#filterJury,
#filterVisite,
#filterAdmissions {
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}
#sortSelect:focus,
#filterContrat:focus,
#filterJury:focus {
  border-color: var(--blue-mid);
}

/* ── Buttons ── */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.1s,
    border-color 0.1s;
}
.btn-outline:hover {
  background: var(--surface-2);
}
.btn-outline:active {
  transform: scale(0.98);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  background: var(--blue-mid);
  color: #e6f1fb;
  cursor: pointer;
  transition: background 0.1s;
}
.btn-primary:hover {
  background: var(--blue-text);
}
.btn-primary:active {
  transform: scale(0.98);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--red-text);
  cursor: pointer;
  transition: background 0.1s;
}
.btn-danger:hover {
  background: var(--red-bg);
}

/* ── Results count ── */
.results-count {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* ── Cards grid ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.1s;
  box-shadow: var(--shadow-sm);
}
.card:hover {
  border-color: var(--border-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card:active {
  transform: scale(0.99);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.card-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}
.card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Badges ── */
.badge-contrat {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-TI {
  background: var(--blue-bg);
  color: var(--blue-text);
}
.badge-CDII {
  background: var(--green-bg);
  color: var(--green-text);
}
.badge-CDJ {
  background: var(--amber-bg);
  color: var(--amber-text);
}
.badge-PERM {
  background: var(--purple-bg);
  color: var(--purple-text);
}

/* ── Jury badge ── */
.badge-jury {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.jury-pro {
  background: var(--jury-pro-bg);
  color: var(--jury-pro-text);
  border: 1px solid var(--jury-pro-border);
}
.jury-pédago {
  background: var(--jury-pédago-bg);
  color: var(--jury-pédago-text);
  border: 1px solid var(--jury-pédago-border);
}

/* Visite entreprise badge */
.badge-visite {
  background: #e6faf0;
  color: #0a6640;
  border: 1px solid #7dd9a8;
}
/* Admissions badge */
.badge-admissions {
  background: #f0e6ff;
  color: #5a0fa8;
  border: 1px solid #c49df5;
}
/* Detail sections */
.detail-visite-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.detail-visite-section h3 {
  margin-bottom: 10px;
}
.detail-admissions-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.detail-admissions-section h3 {
  margin-bottom: 10px;
}
.filiere-visite {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: #e6faf0;
  color: #0a6640;
  font-weight: 500;
}
.filiere-admissions {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: #f0e6ff;
  color: #5a0fa8;
  font-weight: 500;
}

/* ── Competence tags ── */
.comp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.comp-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.comp-tag.highlight {
  background: var(--green-bg);
  color: var(--green-text);
  border-color: transparent;
}
.comp-more {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 3px 4px;
  align-self: center;
}
.comp-more-match {
  font-size: 11px;
  color: var(--green-text);
  background: var(--green-bg);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 3px 8px;
  align-self: center;
  font-weight: 600;
  cursor: default;
}
.no-comp {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ── No results ── */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem;
  color: var(--text-secondary);
  font-size: 14px;
}
.no-results svg {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.35;
}

/* ── Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-md);
  animation: modal-in 0.15s ease;
}
.modal-wide {
  max-width: 660px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ── Detail modal content ── */
.detail-section {
  margin-bottom: 1.25rem;
}
.detail-section h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 5px;
}
.detail-row svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.detail-row a {
  color: var(--blue-mid);
  text-decoration: none;
}
.detail-row a:hover {
  text-decoration: underline;
}

.detail-comps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-comp {
  font-size: 13px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* ── Jury detail section ── */
.detail-jury-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.detail-jury-section h3 {
  margin-bottom: 10px;
}

.jury-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jury-type-badge {
  align-self: flex-start;
  font-size: 12px;
  padding: 3px 10px;
}

.jury-filieres,
.jury-titres {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.jury-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.jury-filiere {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--amber-bg);
  color: var(--amber-text);
  font-weight: 500;
}
.jury-titre {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--purple-bg);
  color: var(--purple-text);
  font-weight: 600;
}

.modal-bottom-actions {
  display: flex;
  gap: 8px;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Form ── */
.form-row {
  margin-bottom: 12px;
}
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.label-hint {
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: 12px;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 11px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.1);
}
.form-row textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Jury form section ── */
.form-jury-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.form-jury-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.form-jury-header svg {
  color: var(--jury-pro-text);
}

.jury-titres-check {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 0;
}
.check-label input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0;
  accent-color: var(--blue-mid);
  cursor: pointer;
}

@media (max-width: 480px) {
  .form-2col {
    grid-template-columns: 1fr;
  }
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Export JSON ── */
.export-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.export-count {
  font-size: 13px;
  color: var(--text-secondary);
}
.json-export {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 12px;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 380px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .app {
    padding: 1.25rem 1rem 3rem;
  }
  .header h1 {
    font-size: 20px;
  }
  .toolbar {
    gap: 8px;
  }
}

#lockScreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.lock-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-md);
}
.lock-box h2 {
  font-size: 18px;
  margin-bottom: 4px;
}
.lock-box p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.lock-error {
  font-size: 13px;
  color: var(--red-text);
  margin-bottom: 10px;
}
