/**
 * SCRIBONAUTES — Aperçu d'une œuvre
 * pages/work-detail.css
 * Palette : parchemin chaud + vert forêt + brun sépia
 */

/* ============================================================
   HERO
   ============================================================ */
.work-hero {
  background: var(--accent-light);
  background-image:
    radial-gradient(ellipse at 80% 0%,  rgba(61, 107, 94, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 100%, rgba(92, 74, 58, 0.07) 0%, transparent 50%);
  border-bottom: 1px solid var(--border);
  padding: 56px 0 48px;
}

.work-hero-inner {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  align-items: flex-start;
}

/* ---- Couverture ---- */
.cover-container {
  flex-shrink: 0;
}

.cover-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl), 6px 6px 0 var(--accent-mid);
  transition: transform var(--trans-base);
  aspect-ratio: 2/3;
}

.cover-wrap:hover {
  transform: translateY(-4px);
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  min-height: 280px;
}

/* ---- Infos ---- */
.work-info {
  padding-top: 4px;
}

.work-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.work-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.work-hero-author {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.work-hero-author a {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}

.work-hero-author a:hover {
  color: var(--green-hover);
}

.work-hero-description {
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--text-mid);
  line-height: 1.75;
  margin-bottom: 24px;
}

/* Métadonnées */
.work-meta-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-mid);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
}

/* Actions */
.work-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* ============================================================
   STATS BAND
   ============================================================ */
.work-stats-band {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.work-stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.work-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  text-align: center;
  transition: background var(--trans-fast);
}

.work-stat-item:last-child {
  border-right: none;
}

.work-stat-item:hover {
  background: var(--bg);
}

.work-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.work-stat-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 5px;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.work-detail-page {
  background: var(--bg);
  min-height: calc(100vh - 64px);
  padding-bottom: 80px;
}

.work-detail-body {
  padding-top: 40px;
}

.work-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: flex-start;
}

/* ============================================================
   PROGRESSION DE LECTURE
   ============================================================ */
.reading-progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  border-left: 4px solid var(--green);
}

.reading-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.reading-progress-title {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text);
  font-size: var(--text-lg);
  margin: 0;
}

.reading-progress-pct {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}

.progress-bar-track {
  height: 10px;
  background: var(--green-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--green-border);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-hover));
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
}

.reading-progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.reading-progress-stat {
  font-family: var(--font-ui);
}

.reading-progress-stat .val {
  font-weight: 700;
  color: var(--text);
  font-size: var(--text-lg);
  display: block;
}

.reading-progress-stat .lbl {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ============================================================
   PARTIES & CHAPITRES
   ============================================================ */

/* Section de partie */
.part-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}

/* En-tête de partie */
.part-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border);
}

.part-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-mid);
}

.part-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.part-stats {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex-shrink: 0;
}

.part-description {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 8px 24px 0;
}

/* Liste de chapitres */
.chapters-list {
  padding: 8px 0;
}

/* Item de chapitre */
.chapter-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-left: 3px solid transparent;
  text-decoration: none !important;
  color: inherit;
  transition: all var(--trans-fast);
  position: relative;
}

.chapter-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.chapter-item:hover {
  background: var(--bg);
  border-left-color: var(--accent);
  padding-left: 28px;
  color: inherit;
}

.chapter-item.read {
  border-left-color: var(--success);
  background: var(--success-light);
}

.chapter-item.read:hover {
  border-left-color: var(--success);
  background: #ddf0e6;
}

.chapter-item.reading {
  border-left-color: var(--warning);
  background: var(--warning-light);
}

.chapter-item.modified {
  border-left-color: #d97706;
  background: #fffbeb;
}

.chapter-item.modified:hover {
  border-left-color: #b45309;
  background: #fef3c7;
}

/* Numéro */
.chapter-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-mid);
  transition: all var(--trans-fast);
}

.chapter-item:hover .chapter-number {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  color: var(--accent);
}

.chapter-item.read .chapter-number {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

.chapter-item.reading .chapter-number {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning);
}

.chapter-item.modified .chapter-number {
  background: #fef3c7;
  border-color: #d97706;
  color: #b45309;
}

/* Titre et méta */
.chapter-info {
  flex: 1;
}

.chapter-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.3;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chapter-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 9px;
}

.chapter-badge--draft {
  background: var(--warning-light);
  border-color: rgba(214, 137, 16, 0.3);
  color: var(--warning);
}

.chapter-badge--read {
  background: var(--success-light);
  border-color: rgba(34, 139, 87, 0.3);
  color: var(--success);
  font-weight: 600;
}

.chapter-badge--modified {
  background: #fff3e0;
  border-color: rgba(214, 137, 16, 0.35);
  color: #b45309;
  font-weight: 600;
}

/* Indicateur de lecture */
.read-indicator {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.read-indicator.done {
  background: var(--success-light);
  color: var(--success);
}

.read-indicator.in-progress {
  background: var(--warning-light);
  color: var(--warning);
}

.read-indicator.modified {
  background: #fef3c7;
  color: #b45309;
  font-size: 1rem;
  font-weight: 700;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.work-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.sidebar-card-header {
  padding: 14px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.sidebar-card-body {
  padding: 18px;
}

/* Auteur card */
.author-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.author-mini-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.author-mini-name:hover {
  color: var(--accent);
}

.author-mini-bio {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

/* Tags */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Actions auteur (édition) */
.author-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.author-action-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-mid);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--trans-fast);
}

.author-action-link:hover {
  background: var(--bg);
  color: var(--accent);
}

/* ============================================================
   BOUTON FLOTTANT
   ============================================================ */
.floating-action {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: var(--z-fixed);
}

.fab-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-base);
}

.fab-button:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

/* ============================================================
   SECTION TITRE
   ============================================================ */
.section-heading {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .work-detail-layout {
    grid-template-columns: 1fr;
  }

  .work-sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .work-hero {
    padding: 40px 0 32px;
  }

  .work-hero-inner {
    grid-template-columns: 140px 1fr;
    gap: 24px;
  }

  .work-stats-inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .work-stat-item:nth-child(2) { border-right: none; }
  .work-stat-item:nth-child(3) { border-top: 1px solid var(--border); }
  .work-stat-item:nth-child(4) { border-top: 1px solid var(--border); border-right: none; }

  .work-sidebar {
    grid-template-columns: 1fr;
  }

  .floating-action {
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 560px) {
  .work-hero-inner {
    grid-template-columns: 1fr;
  }

  .cover-container {
    max-width: 180px;
    margin: 0 auto;
  }

  .work-hero-title {
    font-size: var(--text-2xl);
  }
}

/* ============================================================
   BANDEAU ŒUVRE PRIVÉE
   À ajouter dans static/css/pages/work-detail.css
   ============================================================ */

.private-work-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 2px solid #f59e0b;
  padding: 14px 0;
}

.private-work-banner__inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.private-work-banner__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

.private-work-banner__text {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: #78350f;
  line-height: 1.5;
}

.private-work-banner__text strong {
  font-weight: 700;
  color: #92400e;
}

.private-work-banner__text a {
  color: #92400e;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.private-work-banner__text a:hover {
  color: #78350f;
}

/* ── Bandeau quête non finalisée (auteur) ── */
.quest-pending-banner {
  background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
  border-bottom: 2px solid #f97316;
  padding: 10px 0;
}
.quest-pending-banner__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: .88rem;
  color: #7c2d12;
}
.quest-pending-banner__btn {
  display: inline-block;
  padding: 4px 14px;
  background: #f97316;
  color: #fff;
  border-radius: 20px;
  font-weight: 700;
  font-size: .82rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.quest-pending-banner__btn:hover { background: #ea6c00; color: #fff; }
.quest-pending-banner__closed { font-style: italic; color: #9a3412; }

/* ============================================================
   AUDIENCE WARNING BANNER — à ajouter dans work-detail.css
   ============================================================ */

.audience-warning-banner {
  background: #1a1a2e;
  border-bottom: 2px solid #e63946;
  padding: 14px 0;
}

.audience-warning-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* Badge 18+ */
.audience-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.audience-badge--mature {
  background: #e63946;
  color: #fff;
}

.audience-badge__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.audience-badge__label {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

/* Trigger warnings */
.audience-triggers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.audience-triggers__label {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #f4a261;
  white-space: nowrap;
  flex-shrink: 0;
}

.audience-triggers__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trigger-chip {
  display: inline-block;
  background: rgba(244, 162, 97, 0.15);
  border: 1px solid rgba(244, 162, 97, 0.4);
  color: #f4a261;
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .audience-warning-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}


/* ============================================================
   TRIGGER WARNINGS GRID 
   ============================================================ */

.trigger-warnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 20px;
}

.trigger-warning-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--trans-fast), background var(--trans-fast);
}

.trigger-warning-item:has(.form-check-input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.trigger-warning-item .form-check-input {
  margin: 0;
  flex-shrink: 0;
}

.trigger-warning-item .form-check-label {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
  margin: 0;
  line-height: 1.3;
}

/* ============================================================
   DARK MODE — chapter_detail.html (lecture) + work-detail.css
   À ajouter à la FIN de static/css/pages/work-detail.css
   (et/ou dans design-system.css au bloc [data-theme="dark"])

   Note : chapter_detail.html contient du CSS inline dans
   un bloc <style> — les surcharges ci-dessous s'appliquent
   via [data-theme="dark"] depuis design-system.css qui est
   chargé avant le CSS inline de la page.
   ============================================================ */

/* ── Contenu de lecture Quill ────────────────────────────── */
/* Le chapitre est rendu via .ql-editor en lecture seule */
[data-theme="dark"] .ql-editor,
[data-theme="dark"] .chapter-body,
[data-theme="dark"] .chapter-content {
  color: var(--text) !important;
  background: transparent;
}

/* ── Surbrillance d'annotation (hardcoded yellow) ───────── */
/* annotation_selection.css utilise probablement du jaune inline */
[data-theme="dark"] .annotation-highlight,
[data-theme="dark"] mark,
[data-theme="dark"] [data-annotation] {
  background: rgba(250, 204, 21, 0.20) !important;
  color: var(--text) !important;
}

/* ── Bootstrap classes utilisées dans chapter_detail ────── */
[data-theme="dark"] .bg-light {
  background: var(--bg-alt) !important;
}

[data-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}

/* ── Breadcrumb inline ───────────────────────────────────── */
[data-theme="dark"] .chapter-breadcrumb a,
[data-theme="dark"] .work-breadcrumb a {
  color: var(--green);
}

/* ── Sidebar annotations en lecture ─────────────────────── */
[data-theme="dark"] .annotation-panel,
[data-theme="dark"] .annot-sidebar {
  background: var(--surface);
  border-color: var(--border);
}

/* ── work-detail.css — badges hardcodés ─────────────────── */
/* Si work-detail.css contient des couleurs statut hardcodées,
   elles sont couvertes par les règles badge-status dans work-list-dark.css
   (les classes sont partagées). */

/* ── Tooltip annotation (souvent en blanc hardcodé) ─────── */
[data-theme="dark"] .annot-tooltip,
[data-theme="dark"] .annotation-tooltip {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-md) !important;
}

/* ── Bouton "Annoter" flottant ───────────────────────────── */
[data-theme="dark"] .btn-annotate,
[data-theme="dark"] #annotate-btn,
[data-theme="dark"] .annotation-btn-float {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow-md) !important;
}

/* ── Progress bar lecture ────────────────────────────────── */
[data-theme="dark"] .reading-progress,
[data-theme="dark"] .chapter-progress-bar {
  background: var(--border);
}

[data-theme="dark"] .reading-progress-fill,
[data-theme="dark"] .chapter-progress-fill {
  background: var(--accent);
}

/* ============================================================
   COUVERTURE — taille ajustée
   ============================================================ */
.work-hero-inner {
  grid-template-columns: 240px 1fr;
  align-items: start;
}

.cover-wrap {
  width: 240px;
}

@media (max-width: 768px) {
  .work-hero-inner {
    grid-template-columns: 160px 1fr;
    gap: 20px;
  }

  .cover-wrap {
    width: 160px;
  }
}

@media (max-width: 560px) {
  .work-hero-inner {
    grid-template-columns: 1fr;
  }

  .cover-wrap {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
}