/* ============================================================
   FORM — TFE submission form
   Shared between admin add/edit pages and the student partage form.
   Depends on variables.css (loaded via common.css).
   ============================================================ */

/* ── Field rows & layout ────────────────────────────────────────────────── */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-form > div:not(.admin-form-footer):not(.student-help-block) {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: start;
  border-top: 1px solid var(--border-primary);
  padding: var(--space-xs) 0;
  gap: var(--space-s);
}

.admin-form > div:not(.admin-form-footer):last-of-type {
  border-bottom: 1px solid var(--border-primary);
}

.admin-form > div:not(.admin-form-footer) > label,
.admin-form > div:not(.admin-form-footer) > span.admin-row-label {
  font-size: var(--step--1);
  padding-top: var(--space-2xs);
  font-weight: 400;
}

/* ── Inputs, selects, textareas ──────────────────────────────────────────── */
.admin-form
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
    [type="hidden"]
  ):not([type="submit"]),
.admin-form select,
.admin-form textarea,
.admin-inline-form input[type="text"],
.admin-inline-form input[type="number"],
.admin-inline-form select {
  width: 100%;
}

.admin-form textarea {
  min-height: 100px;
}

/* ── Required-field indicators ──────────────────────────────────────────── */
.admin-form
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
    [type="hidden"]
  ):not([type="submit"]):required,
.admin-form select:required,
.admin-form textarea:required {
  border-style: dashed;
}

.admin-form
  div:has(
    input:required:not([type="checkbox"]):not([type="radio"]):not(
      [type="file"]
    ):not([type="hidden"])
  )
  > label,
.admin-form div:has(select:required) > label,
.admin-form div:has(textarea:required) > label {
  font-weight: 600;
}

/* Asterisk on required field labels */
.asterisk {
  color: var(--error, #c00);
}

/* "* Champs obligatoires" note */
.required-note {
  font-size: var(--step--2);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}
.required-note .asterisk {
  color: var(--error, #c00);
}

/* ── File inputs ────────────────────────────────────────────────────────── */
.admin-file-input {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.admin-file-input input[type="file"] {
  font-size: var(--step--1);
  background: transparent;
  border: 1px dashed var(--border-primary);
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}

.admin-file-input input[type="file"]:hover {
  border-color: var(--accent-primary);
}

.admin-file-hint {
  display: block;
  margin-top: var(--space-2xs);
}

/* small base styles live in common.css */

/* ── Checkbox groups (languages, formats) ───────────────────────────────── */
.admin-body fieldset.admin-checkbox-group,
.student-body fieldset.admin-checkbox-group {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
}

.admin-body fieldset.admin-checkbox-group > ul,
.student-body fieldset.admin-checkbox-group > ul {
  list-style: none;
  margin: 0;
  padding-top: var(--space-3xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.admin-body fieldset.admin-checkbox-group > ul > li,
.student-body fieldset.admin-checkbox-group > ul > li {
  display: contents;
}

.admin-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--step--1);
  cursor: pointer;
}

/* ── Fieldsets & legends ────────────────────────────────────────────────── */
/* Base fieldset/legend styles live in common.css */
.admin-body fieldset,
.student-body fieldset {
  margin: var(--space-2xs) 0 var(--space-s);
}

/* ── Form group (checkbox inline inside .admin-form) ────────────────────── */
.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

/* ── Jury fieldset ──────────────────────────────────────────────────────── */

/* ── Website-URL inline fieldset (shown/hidden via HTMX) ────────────────── */
/* The fieldset is shown/hidden via outerHTML swap — no CSS needed */

/* ── Jury fieldset (continued) ──────────────────────────────────────────── */
.admin-body fieldset fieldset.admin-jury-lecteurs,
.student-body fieldset fieldset.admin-jury-lecteurs {
  border: none;
  padding: 0;
  margin: var(--space-xs) 0 0;
  background: transparent;
}

.admin-body fieldset fieldset.admin-jury-lecteurs > legend,
.student-body fieldset fieldset.admin-jury-lecteurs > legend {
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0;
  margin-bottom: var(--space-2xs);
}

.admin-jury-row {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.admin-jury-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.admin-jury-entry {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.admin-jury-ext {
  white-space: nowrap;
}

.admin-btn-remove {
  /* deprecated alias for .btn--sm .btn--ghost; kept for backward-compat */
}

.admin-btn-remove:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ── Add / edit page header ─────────────────────────────────────────────── */
.thesis-add-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-m);
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-xs);
}

.thesis-add-header h1 {
  margin: 0;
}

.thesis-add-subtitle {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--text-secondary);
}

.thesis-add-subtitle a {
  font-family: var(--font-display);
  color: var(--accent-primary);
}

.mode-toggle {
  font-size: var(--step--1);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: var(--space-3xs) var(--space-xs);
  transition: color 0.15s, border-color 0.15s;
}

.mode-toggle:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.mode-toggle--back {
  color: var(--accent-blue);
  border-color: var(--blue-muted-border, var(--border-primary));
}

/* ── Submit / form footer ───────────────────────────────────────────────── */
.form-footer {
  margin-top: var(--space-l);
  margin-bottom: var(--space-l);
  display: flex;
  gap: var(--space-s);
  align-items: center;
}

.form-footer button {
  /* deprecated alias for .btn--primary; kept for backward-compat */
}

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash-error,
.flash-warning,
.flash-success {
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--radius);
  font-size: var(--step--1);
  margin-bottom: var(--space-s);
  border-left: 3px solid;
}

.flash-error {
  background: var(--accent-muted);
  border-color: var(--error);
  color: var(--text-primary);
}

.flash-success {
  background: var(--success-muted-bg);
  border-color: var(--success);
  color: var(--text-primary);
}

.flash-warning {
  background: var(--warning-muted-bg, rgba(251, 202, 81, 0.12));
  border-color: var(--warning-muted-border, rgba(251, 202, 81, 0.35));
  color: var(--text-primary);
  white-space: pre-line;
}

/* ── Share link badge ───────────────────────────────────────────────────── */
.share-badge {
  display: inline-block;
  padding: var(--space-3xs) var(--space-xs);
  background: var(--blue-muted-bg);
  border: 1px solid var(--blue-muted-border, var(--border-primary));
  border-radius: var(--radius);
  font-size: var(--step--2);
  margin-bottom: var(--space-xs);
}

/* ── Licence / degrees-of-openness block ────────────────────────────────── */
.licence-explanation {
  background: var(--bg-secondary);
  border-left: 4px solid var(--border-secondary, var(--border-primary));
  padding: var(--space-m);
  margin: 0;
}

.licence-info h3 {
  margin-top: var(--space-m);
}

.licence-degree {
  margin: var(--space-s) 0;
  padding: var(--space-s);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
}

.licence-degree h4 {
  margin: 0 0 var(--space-2xs);
  font-weight: 600;
}

.licence-note {
  color: var(--text-secondary);
  font-size: var(--step--2);
  margin-top: var(--space-2xs);
}

.licence-generalites {
  margin-top: var(--space-m);
}

.licence-generalites h3 {
  margin-bottom: var(--space-xs);
}

/* ── Student-mode layout ────────────────────────────────────────────────── */

/* Standalone page (no admin header/footer): restore scrollability that
   common.css removes via overflow:hidden on html,body. */
.student-body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow-y: auto;
}

.student-body main {
  padding: var(--space-l) var(--space-l) var(--space-2xl);
  width: 100%;
  position: relative;
}

/* Fixed top gradient, mirror of body's bottom gradient */
.student-body main::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 8vh;
  background: linear-gradient(
    180deg,
    rgba(149, 87, 181, 1) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* ── Share-link error page ──────────────────────────────────────────────── */
.share-error {
  max-width: 500px;
  margin: 5rem auto;
  padding: var(--space-xl);
  text-align: center;
  background: var(--bg-primary);
  border: 2px solid var(--error);
  border-radius: var(--radius);
}

.share-error h1 {
  color: var(--error);
  margin-bottom: var(--space-s);
}

.share-error p {
  font-size: var(--step-0);
  color: var(--text-secondary);
  margin-bottom: var(--space-m);
}

.share-error a {
  display: inline-block;
  padding: var(--space-2xs) var(--space-m);
  background: var(--text-primary);
  color: var(--bg-primary);
  text-decoration: none;
  border-radius: var(--radius);
  transition: opacity 0.15s;
}

.share-error a:hover {
  opacity: 0.8;
}

/* ── Password gate page ─────────────────────────────────────────────────── */
.password-gate {
  max-width: 400px;
  margin: 4rem auto;
  padding: var(--space-l);
  text-align: center;
}

.password-gate h1 {
  margin-bottom: var(--space-m);
}

.password-gate input[type="password"] {
  width: 100%;
  margin: var(--space-2xs) 0 var(--space-s);
}

.password-gate button {
  /* deprecated alias for .btn--primary; kept for backward-compat */
}

.password-error {
  color: var(--error);
  margin-bottom: var(--space-s);
  font-size: var(--step--1);
}

/* ── Live file-input preview (.file-preview-list) ──────────────────────── */
.file-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-2xs);
}

.file-preview-list:empty {
  display: none;
}

.fp-item {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-3xs) var(--space-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  min-width: 0;
  max-width: 260px;
}

.fp-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.fp-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}

.fp-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fp-name {
  font-size: var(--step--2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  display: block;
}

.fp-size {
  font-size: var(--step--2);
  color: var(--text-tertiary);
}

/* ── Inline file validation messages (HTMX) ──────────────────────────────── */

.file-validation-msg {
  margin-top: var(--space-3xs);
  font-size: var(--step--2);
  line-height: 1.5;
}

.fv-ok {
  color: var(--success, #2d6a4f);
}

.fv-error {
  color: var(--danger, #c1121f);
}

/* ── TFE file upload (FilePond) ────────────────────────────────────────── */

.admin-files-fieldgroup {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

/* FilePond overrides to match xamxam theme */
.filepond--root {
  font-family: var(--font-body, inherit);
  margin-bottom: 0;
}

/* Drop area panel */
.filepond--panel-root {
  background: var(--bg-secondary);
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius);
}

/* Drop label text */
.filepond--drop-label {
  color: var(--text-secondary);
  font-size: var(--step--1);
}

/* "Browse" link */
.filepond--label-action {
  color: var(--accent-primary);
  text-decoration-color: var(--accent-primary);
}

/* File item — keep white for contrast against drop area */
.filepond--item-panel {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
}

/* File item text — dark on white */
.filepond--file {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--accent-primary);
}

.filepond--file .filepond--file-status {
  color: var(--text-secondary);
}

.filepond--file-info-main {
  color: var(--text-primary);
}

.filepond--file-info-sub {
  color: var(--text-tertiary);
}

/* Action buttons — dark background, white icons */
.filepond--file-action-button {
  cursor: pointer;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.45);
}

.filepond--file-action-button:hover,
.filepond--file-action-button:focus {
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.65);
  box-shadow: 0 0 0 0.125em rgba(0, 0, 0, 0.2);
}

/* Progress indicator */
.filepond--progress-indicator {
  color: #ffffff;
}

/* Drag-over highlight */
.filepond--hopper[data-hopper-state="drag-over"] .filepond--panel-root {
  border-color: var(--accent-primary);
  background: var(--accent-muted);
}

/* Error state */
[data-filepond-item-state*="error"] .filepond--item-panel,
[data-filepond-item-state*="invalid"] .filepond--item-panel {
  background-color: var(--error-muted-bg);
  border-color: var(--error);
}

/* Processing complete */
[data-filepond-item-state="processing-complete"] .filepond--item-panel {
  background-color: var(--bg-primary);
}

/* ── Existing-files list (edit form) ─────────────────────────────────────── */

.admin-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.admin-file-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-3xs) var(--space-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  min-width: 0;
}

.admin-file-icon-col {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1.8rem;
  text-align: center;
}

.admin-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.admin-file-name {
  font-size: var(--step--1);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

a.admin-file-name {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.admin-file-name:hover {
  color: var(--accent-primary);
}

.admin-file-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-wrap: wrap;
}

.admin-file-type-badge {
  font-size: var(--step--2);
  padding: 1px 5px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  color: var(--text-secondary);
  white-space: nowrap;
}

.admin-file-size {
  font-size: var(--step--2);
  color: var(--text-tertiary);
}

.admin-file-delete {
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Recap file list (admin & partage recapitulatif) ────────────────────── */
.recap-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.recap-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-xs) var(--space-s);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
}

.recap-file-thumb-link {
  flex-shrink: 0;
}

.recap-file-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.recap-file-icon {
  font-size: 2rem;
  line-height: 1;
  width: 64px;
  text-align: center;
  flex-shrink: 0;
}

.recap-file-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-s);
  min-width: 0;
}

.recap-file-name {
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

a.recap-file-name {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.recap-file-name:hover {
  color: var(--accent-primary);
}

.recap-file-type-badge {
  font-size: var(--step--2);
  padding: 1px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  color: var(--text-secondary);
  white-space: nowrap;
}

.recap-file-size,
.recap-file-date {
  font-size: var(--step--2);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ── Partage recap page ─────────────────────────────────────────────────── */
.partage-recap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-l);
  padding-bottom: var(--space-3xl);
  margin-bottom: var(--space-2xl);
}

.partage-recap .thanks-success {
  text-align: center;
}

.recap-validate-notice {
  text-align: center;
  font-size: var(--step--1);
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
  border-radius: 8px;
  padding: var(--space-s) var(--space-m);
  max-width: 560px;
}

.recap-validate-notice p {
  margin: 0;
}

.recap-validate-notice a {
  color: var(--accent-primary);
  font-weight: 600;
}

.recap-section {
  border-top: 1px solid var(--border-primary);
  padding-top: var(--space-m);
  width: 100%;
  max-width: 620px;
  /* margin-bottom: var(--space-l); */
  padding-bottom: var(--space-xl);
}

.recap-section h2 {
  font-weight: 600;
  margin: 0 0 var(--space-s);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.recap-dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-2xs) var(--space-s);
  margin: 0;
}

.recap-dl dt {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 2px;
}

.recap-dl dd {
  font-size: var(--step--1);
  margin: 0;
  color: var(--text-primary);
}

/* ── Thanks page ────────────────────────────────────────────────────────── */
.thanks-student-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.thanks-success,
.thanks-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-m);
  max-width: 520px;
}

.thanks-success h1,
.thanks-error h1 {
  margin: 0;
  letter-spacing: 0.06em;
}

.thanks-message {
  font-size: var(--step-0);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.6;
}

.thanks-error p {
  font-size: var(--step-0);
  color: var(--text-secondary);
  margin: 0;
}

.btn-new-form {
  /* deprecated alias for .btn--primary .btn--lg; kept for backward-compat */
}

/* ── Form help blocks ────────────────────────────────────────────────────── */

.student-help-block {
  background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 6px 6px 0;
  padding: var(--space-m);
  margin: var(--space-s) 0;
  font-size: var(--step--1);
  color: var(--text-primary);
  line-height: 1.6;
}

.student-help-block > *:first-child {
  margin-top: 0;
}
.student-help-block > *:last-child {
  margin-bottom: 0;
}

.student-help-block p {
  margin: 0 0 var(--space-xs);
}
.student-help-block ul,
.student-help-block ol {
  margin: 0 0 var(--space-xs);
  padding-left: var(--space-m);
}
.student-help-block li {
  margin-bottom: var(--space-3xs);
}
.student-help-block a {
  color: var(--accent-primary);
}

/* ── E-mail retry page ───────────────────────────────────────────────────── */

.partage-retry-email {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  max-width: 600px;
  margin: 0 auto;
}

.retry-email-section {
  border-top: 1px solid var(--border-primary);
  padding-top: var(--space-m);
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.retry-email-section h2 {
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.retry-smtp-detail {
  display: block;
  margin-top: var(--space-2xs);
  font-size: var(--step--2);
  color: var(--text-secondary);
  word-break: break-all;
}

.retry-email-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.retry-email-form .field-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.retry-email-form label {
  font-size: var(--step--1);
  font-weight: 600;
}

.retry-email-form input[type="email"] {
  font-size: var(--step-0);
  width: 100%;
}

.retry-email-form input.input-error {
  border-color: var(--error, #c00);
}

.retry-email-actions {
  display: flex;
  gap: var(--space-s);
  flex-wrap: wrap;
}

.btn-primary {
  /* deprecated alias for .btn--primary; kept for backward-compat */
}

.btn-secondary {
  /* deprecated alias for .btn--secondary; kept for backward-compat */
}

/* ── Tag search (mots-clés interactive component) ──────────────────────── */

/* The outer container may be placed inside a fieldset or as a direct child
   of .admin-form. Use a generic vertical layout that works in both contexts. */
[id$="-search-container"] {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

[id$="-search-container"] > .admin-row-label {
  font-size: var(--step--1);
  padding-top: 0;
  font-weight: 400;
}

.tag-search-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  position: relative;
}

/* Hint text above input */
.tag-search-hint {
  display: block;
  font-size: var(--step--2);
  color: var(--text-secondary);
  margin-bottom: var(--space-3xs);
}

/* Counter (e.g. "3/10") */
.tag-search-counter {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--step--2);
}

.tag-search-count {
  font-weight: 600;
  color: var(--accent-primary);
  background: var(--accent-muted, rgba(149, 87, 181, 0.1));
  padding: 1px var(--space-2xs);
  border-radius: var(--radius);
}

.tag-search-max-msg {
  color: var(--text-tertiary);
  font-style: italic;
}

/* Pill row — spacing around selected tags area */
.tag-search-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  min-height: 0;
  padding: var(--space-2xs) 0;
}

.tag-search-pills:empty {
  padding: 0;
  display: none;
}

/* Individual pill */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 2px 2px 2px var(--space-2xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  font-size: var(--step--1);
  line-height: 1.4;
  white-space: nowrap;
  transition: border-color 0.15s;
}

.tag-pill:hover {
  border-color: var(--accent-primary);
}

.tag-pill-name {
  color: var(--text-primary);
}

/* Round remove button */
.tag-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.tag-pill-remove:hover {
  background: var(--error);
  color: #fff;
}

.tag-pill-remove svg {
  width: 14px;
  height: 14px;
}

/* Search input */
.tag-search-input-wrap {
  display: flex;
}

.tag-search-input {
  width: 100%;
  font-size: var(--step--1);
  font-family: inherit;
}

/* Suggestions dropdown — absolute positioned to hover above content */
.tag-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  overflow-y: auto;
  display: none;
  margin-top: 2px;
}

.tag-search-suggestions:not(:empty) {
  display: block;
}

.tag-search-empty {
  padding: var(--space-2xs) var(--space-xs);
  font-size: var(--step--2);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Individual suggestion item */
.tag-search-item {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  width: 100%;
  padding: var(--space-2xs) var(--space-xs);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-primary);
  font-family: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  transition: background 0.1s;
}

.tag-search-item:last-child {
  border-bottom: none;
}

.tag-search-item:hover,
.tag-search-item:focus,
.tag-search-item--highlight {
  background: var(--bg-secondary);
  outline: none;
}

.tag-search-item--highlight {
  background: var(--accent-muted, rgba(149, 87, 181, 0.1));
}

.tag-search-item-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-search-item-count {
  font-size: var(--step--2);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.tag-search-item--create {
  color: var(--accent-primary);
  font-weight: 500;
  border-bottom-style: dashed;
}

.tag-search-item--create:hover,
.tag-search-item--create.tag-search-item--highlight {
  background: var(--accent-muted, rgba(149, 87, 181, 0.08));
}

/* ── File preview list (couverture, note d'intention, annexes) ───────────── */

.file-preview-list {
  list-style: none;
  margin: var(--space-3xs) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.fp-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-3xs) var(--space-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  min-width: 0;
  max-width: 100%;
}

.fp-thumb {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.fp-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
}

.fp-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.fp-name {
  font-size: var(--step--1);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fp-size {
  font-size: var(--step--2);
  color: var(--text-tertiary);
}
