/* =========================================================================
   ESPACE ÉTUDIANT & PUBLICATION
   Tableau de bord, mes mémoires, formulaire de publication / modification,
   signalement.
   ========================================================================= */

.ws-main { min-width: 0; }
.ws-stats { margin-bottom: 20px; }
.ws-stat-unit { font-size: 1rem; font-weight: 600; color: var(--ink-3); margin-left: 2px; letter-spacing: 0; }
.ws-panel { margin-top: 20px; }
.ws-panel .panel-head { margin-bottom: 10px; }

/* ---------- Lignes de mémoire (tableau de bord) ---------- */
.ws-memories { list-style: none; margin: 0; padding: 0; }

.ws-memory {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid var(--line-soft);
}

.ws-memory:first-child { border-top: 0; }
.ws-memory-cover .cover, .ws-card-cover .cover { width: 100%; }
.ws-memory-top { gap: 10px; margin-bottom: 6px; font-size: .85rem; }

.ws-memory-title {
    margin: 0 0 4px;
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 1.12rem;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.ws-memory-title a { color: var(--ink); }
.ws-memory-title a:hover { color: var(--green); }

.ws-memory-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

/* Menu « plus d'actions » */
.ws-more { position: relative; }
.ws-more > summary { list-style: none; }
.ws-more > summary::-webkit-details-marker { display: none; }
.ws-more[open] > summary { background: var(--line-soft); color: var(--ink); }

.ws-more-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 180px;
    padding: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-3);
}

.ws-more-menu form { margin: 0; padding: 0; border: 0; background: none; }

.ws-more-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.ws-more-menu button:hover { background: var(--canvas); }
.ws-more-menu button .icon { width: 17px; height: 17px; color: var(--ink-3); }
.ws-more-menu .is-danger, .ws-more-menu .is-danger .icon { color: var(--danger); }

/* ---------- Avancement : rédaction → validation → en ligne ---------- */
.ws-progress {
    display: flex;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    max-width: 420px;
}

.ws-progress li {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: .74rem;
    color: var(--ink-3);
}

.ws-progress li::before {
    content: "";
    height: 4px;
    border-radius: 4px;
    background: var(--line);
}

.ws-progress li.is-done::before { background: var(--green); }
.ws-progress li.is-current { color: var(--ink); font-weight: 600; }
.ws-progress.is-warn li.is-current::before { background: #E8B400; }
.ws-progress.is-blocked li.is-current::before { background: var(--danger); }
.ws-progress.is-blocked li.is-current { color: var(--danger); }

/* ---------- Graphique des lectures ---------- */
.ws-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 200px;
    padding: 24px 4px 0;
    border-bottom: 1px solid var(--line);
}

.ws-bar {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: relative;
}

.ws-bar-fill {
    display: block;
    width: 100%;
    max-width: 34px;
    height: var(--h);
    min-height: 3px;
    border-radius: 6px 6px 2px 2px;
    background: var(--green);
    opacity: .85;
    transition: opacity .15s ease;
}

.ws-bar:hover .ws-bar-fill, .ws-bar:last-child .ws-bar-fill { opacity: 1; }

.ws-bar-value {
    font-size: .72rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.ws-bar-label {
    position: absolute;
    bottom: -22px;
    font-size: .7rem;
    color: var(--ink-3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ws-table-toggle { margin-top: 36px; }

.ws-table-toggle > summary {
    list-style: none;
    display: inline-flex;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    color: var(--indigo);
    margin-bottom: 14px;
}

.ws-table-toggle > summary::-webkit-details-marker { display: none; }
.ws-table-toggle > summary::after { content: " +"; }
.ws-table-toggle[open] > summary::after { content: " −"; }
.ws-table-toggle .table-wrap { box-shadow: none; }

/* ---------- Mes mémoires ---------- */
.ws-tally {
    display: flex;
    gap: 10px;
    margin: 0 0 20px;
    flex-wrap: wrap;
}

.ws-tally div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
}

.ws-tally dt { font-size: .86rem; color: var(--ink-2); }
.ws-tally dd { margin: 0; order: -1; font-weight: 700; font-variant-numeric: tabular-nums; }

.ws-cards { display: grid; gap: 16px; }

.ws-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 22px;
    margin: 0 !important;
}

.ws-card .ws-memory-title { font-size: 1.3rem; margin-bottom: 2px; }
.ws-moderation { margin-top: 16px; }
.ws-moderation strong { display: block; margin-bottom: 2px; }

.ws-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.ws-card-actions:empty { display: none; }

.ws-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: .9rem;
    color: var(--warning);
}

/* ---------- Formulaire de publication ---------- */
.pub-hero {
    padding: 32px 0 30px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.pub-hero h1 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(2.1rem, 1.5rem + 2.2vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -.03em;
    margin-bottom: 10px;
    max-width: 18ch;
}

.pub-hero .lead { margin: 0; }
.pub-hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.pub-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: start;
}

.pub-main { min-width: 0; }
.pub-form { margin: 0; }
.pub-form .form-section { scroll-margin-top: calc(var(--nav-h) + 20px); }
.pub-moderation { margin-bottom: 20px; }
.pub-moderation strong { display: block; margin-bottom: 2px; }

.pub-aside {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pub-aside .panel { padding: 20px; margin: 0; }
.pub-aside .panel-title { font-size: 1rem; }

.pub-steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.pub-steps a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--ink-2);
    font-weight: 550;
    font-size: .92rem;
}

.pub-steps a:hover { background: var(--canvas); color: var(--ink); }
.pub-steps .step-num { width: 26px; height: 26px; border-radius: 8px; font-size: .78rem; background: var(--line-soft); color: var(--ink-2); }
.pub-steps a:hover .step-num { background: var(--ink); color: #fff; }

.pub-next { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pub-next li { display: flex; gap: 12px; align-items: flex-start; }
.pub-next .icon { width: 20px; height: 20px; color: var(--green); margin-top: 1px; }
.pub-next strong { display: block; font-size: .93rem; }
.pub-next span { font-size: .86rem; color: var(--ink-2); line-height: 1.45; }
.pub-tip p { font-size: .9rem; }

/* Mots-clés et encadrants : champ à pastilles */
.pub-chips-input {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 48px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--paper);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.pub-chips-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-50); }
.pub-chips { display: contents; }
.pub-chips:empty { display: none; }
.pub-chips-field { flex: 1 1 200px; min-width: 160px; }

.pub-chips-field input {
    min-height: 34px;
    padding: 4px 6px;
    border: 0;
    box-shadow: none !important;
    background: transparent;
}

.memory-keyword-tag, .memory-supervisor-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 11px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: .86rem;
    font-weight: 550;
    line-height: 1.3;
}

.memory-supervisor-tag { background: var(--green); }

.memory-keyword-tag-remove, .memory-supervisor-tag-remove {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
}

.memory-keyword-tag-remove:hover, .memory-supervisor-tag-remove:hover { background: rgba(255, 255, 255, .32); }

.pub-suggestions {
    position: absolute;
    left: -1px;
    right: -1px;
    top: calc(100% + 6px);
    z-index: 30;
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-3);
    max-height: 280px;
    overflow-y: auto;
}

.pub-suggestions:empty { display: none; }

.memory-keyword-suggestion, .memory-supervisor-suggestion, .memory-keyword-create {
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: none;
    text-align: left;
    font-size: .93rem;
    cursor: pointer;
}

.memory-keyword-suggestion:hover, .memory-supervisor-suggestion:hover { background: var(--canvas); }
.memory-keyword-create { color: var(--green); font-weight: 600; }
.memory-keyword-create:hover { background: var(--green-50); }

.memory-keywords-empty, .memory-supervisors-empty,
.memory-keywords-error, .memory-supervisors-error {
    padding: 9px 12px;
    font-size: .88rem;
    color: var(--ink-3);
}

.memory-keywords-error, .memory-supervisors-error { color: var(--danger); }

/* Le select multiple Symfony reste dans le DOM pour l'envoi, mais pas à l'écran */
.memory-keywords-select-wrapper, .memory-supervisors-select-wrapper {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.memory-keywords-field, .memory-supervisors-field { position: relative; }

/* Document */
.pub-current-doc {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: var(--r-md);
    background: var(--canvas);
    border: 1px solid var(--line-soft);
}

.pub-current-doc div { display: flex; flex-direction: column; min-width: 0; }
.pub-current-doc strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-current-doc span { font-size: .84rem; }
.pub-current-doc.is-empty p { margin: 0; color: var(--ink-2); }
.pub-current-doc.is-empty .icon { color: var(--ink-3); }

.pub-pdf-badge {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--danger);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.pub-replace-help { margin: 0 0 12px; }

.pub-drop input[type="file"] {
    min-height: 110px;
    padding: 34px 20px;
    text-align: center;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' fill='none' stroke='%230F7B5C' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5'/%3E%3Cpath d='M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E") no-repeat center 12px,
        var(--green-50);
    border: 1.5px dashed #9BCFB8;
    border-radius: var(--r-md);
    color: var(--ink-2);
}

.pub-drop input[type="file"]:hover { border-color: var(--green); }

/* Diffusion */
.pub-fieldset { border: 0; margin: 0 0 20px; padding: 0; min-width: 0; }
.pub-fieldset legend { padding: 0; margin-bottom: 10px; }

.pub-choices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.pub-choices .check-card { margin: 0; font-weight: 400; height: 100%; }
.pub-choices .check-card > span { display: flex; flex-direction: column; gap: 3px; }
.pub-choices .check-card strong { font-weight: 650; }
.pub-choices .check-card span span { line-height: 1.4; }

.pub-toggle, .pub-terms {
    padding: 14px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    margin-bottom: 12px;
}

.pub-toggle > div, .pub-terms > div { margin: 0; }
.pub-toggle .field-help { margin: 6px 0 0 28px; }
.pub-terms { background: var(--marker-50); border-color: #F3E39A; }
.pub-terms label { font-weight: 500; }

.pub-actions {
    position: sticky;
    bottom: 12px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 14px 16px 14px 20px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
}

.pub-actions-copy { display: flex; align-items: flex-start; gap: 10px; max-width: 52ch; }
.pub-actions-copy .icon { color: var(--green); margin-top: 2px; }
.pub-actions-copy p { margin: 0; font-size: .88rem; color: var(--ink-2); line-height: 1.45; }

/* ---------- Signalement ---------- */
.report-layout {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.report-cover .cover { width: 120px; }
.report-head { margin-bottom: 20px; }
.h3 { font-size: 1.15rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .pub-layout { grid-template-columns: 1fr; }
    .pub-aside { position: static; order: -1; }
    .pub-steps, .pub-tip { display: none; }
}

@media (max-width: 720px) {
    .ws-memory { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: start; }
    .ws-memory-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .ws-card { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; }
    .ws-card .ws-memory-title { font-size: 1.1rem; }
    .ws-chart { height: 160px; gap: 3px; }
    .ws-bar-value { display: none; }
    .ws-bar:nth-child(even) .ws-bar-label { visibility: hidden; }
    .pub-choices { grid-template-columns: 1fr; }
    .pub-actions { position: static; }
    .pub-actions .row { width: 100%; }
    .pub-actions .btn-primary { flex: 1; }
    .report-layout { grid-template-columns: 1fr; }
    .report-cover { display: none; }
}

/* Espacement des form_row Symfony imbriqués dans les sections */
.pub-form .form-section > div:not(.form-section-head):not(.field-row),
.pub-form .field-row > div { margin-bottom: 18px; }
.pub-form .form-section > :last-child { margin-bottom: 0; }
.pub-form .field-row { margin-bottom: 0; }

@media (min-width: 1081px) {
    .ws-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .ws-stats .stat-value { font-size: 1.8rem; }
}

/* Suppression d'un mémoire (Mes mémoires, menu du tableau de bord) */
.ws-card-actions-end { margin-left: auto; display: inline-flex; }
.ws-delete { color: var(--ink-3); }
.ws-delete:hover { background: var(--danger-50); color: var(--danger); }
.ws-more-menu form.inline-form { display: block; }
