/* === RESET & BASE === */
body { 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; 
  margin: 18px; 
}
a { color: inherit; }

/* === LAYOUT === */
.wrap { max-width: 1200px; }
.topbar { display:flex; gap:12px; align-items:center; margin-bottom: 12px; }
.row { display:grid; grid-template-columns: 1.2fr 0.8fr; gap: 12px; }
.hidden { display:none; }

/* === COMPONENTS === */
.btn { 
  border:1px solid #ddd; 
  padding:8px 10px; 
  border-radius: 10px; 
  text-decoration:none;
  background: #fff;
  cursor: pointer;
}
.btn:hover { background: #f5f5f5; }
.btn-primary {
  background: #111;
  color: #fff;
  border-color: #111;
}
.btn-primary:hover { background: #333; }

.panel { 
  border:1px solid #ddd; 
  border-radius: 14px; 
  padding: 12px; 
}

.mono { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; 
  font-size: 12px; 
  color:#333; 
}

.error { 
  color: #a00; 
  background: #fee; 
  border: 1px solid #fbb; 
  padding: 10px; 
  border-radius: 10px; 
}

/* === TABS === */
.tabs { display:flex; gap:8px; margin-bottom: 10px; flex-wrap: wrap; }
.tab { 
  padding: 8px 10px; 
  border:1px solid #ddd; 
  border-radius: 999px; 
  cursor:pointer; 
  user-select:none; 
}
.tab:hover { background: #f5f5f5; }
.tab.active { border-color:#111; font-weight: 700; }

/* === GRID & THUMBS === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.thumb-container {
  position: relative;
  border-radius: 10px;
  overflow: visible;
}

.thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #eee;
  cursor: pointer;
  display: block;
}

.thumb-checkbox {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #111;
  z-index: 100;
  pointer-events: auto;
}

.thumb-container.selected {
  outline: 3px solid #111;
  outline-offset: 2px;
  border-radius: 10px;
}

.thumb-timecode {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-family: ui-monospace, monospace;
  pointer-events: none;
}

/*  CREDIT  */
.credit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.credit-overlay.hidden {
  display: none;
}

.credit-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px 32px;
  min-width: 320px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  animation: creditIn 0.25s ease-out;
}

.credit-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.credit-text {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
}

.credit-text a {
  color: #0066ff;
  text-decoration: none;
}

.credit-hint {
  margin-top: 12px;
  font-size: 11px;
  color: #666;
  font-family: ui-monospace, monospace;
}

@keyframes creditIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* === SELECTION BAR === */
.selection-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 1000;
}
.selection-bar.hidden { display: none; }
.selection-bar button {
  background: #fff;
  color: #111;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.selection-bar button:hover { background: #eee; }
.selection-bar .clear-btn {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
}
.selection-bar .clear-btn:hover { background: rgba(255,255,255,0.1); }

/* === KPI === */
.kpi { display:grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.kpi .box { border:1px solid #eee; border-radius: 12px; padding: 10px; }
.kpi .lab { color:#666; font-size: 12px; }
.kpi .val { font-weight: 700; font-size: 16px; margin-top: 4px; }

/* === DETAIL === */
.detail { display:flex; gap: 10px; align-items:flex-start; }
.detail img { 
  width: 280px; 
  aspect-ratio: 16/9; 
  object-fit: cover; 
  border-radius: 12px; 
  border:1px solid #eee; 
}

/* === SWATCHES === */
.swatches { display:flex; gap:8px; flex-wrap:wrap; }
.swatch { 
  display:flex; 
  gap:8px; 
  align-items:center; 
  border:1px solid #eee; 
  border-radius:12px; 
  padding:8px 10px; 
}
.swatchColor { 
  width:18px; 
  height:18px; 
  border-radius:6px; 
  border:1px solid rgba(0,0,0,0.12); 
}

/* === CANVAS === */
#umap2d { min-height: 700px; }

.hover-player{
  position:fixed;
  z-index:9999;
  width:320px;
  height:180px;
  border-radius:12px;
  overflow:hidden;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
  background:#000;
  pointer-events:none; /* important : ne pas “bloquer” la souris */
}
.hover-player video{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.hidden{ display:none; }

/* PLANCHE */
.planche-topbar {
      background: #fff;
      border-bottom: 1px solid #ddd;
      padding: 10px 16px;
      display: flex;
      gap: 12px;
      align-items: center;
      flex-wrap: wrap;
    }
    

.toolbar {
      display: flex;
      gap: 6px;
      margin-left: auto;
    }
    
    .tool-btn {
      padding: 8px 10px;
      border: 1px solid #ddd;
      border-radius: 999px;
      background: #fff;
      cursor: pointer;
      font-size: 14px;
    }
    .tool-btn:hover { background: #f5f5f5; }
    .tool-btn.active { background: #111; color: #fff; border-color: #111; }
    
    .planche-container {
      display: flex;
      justify-content: center;
      padding: 30px;
      min-height: calc(100vh - 60px);
    }
    
    .planche-page {
      /* A4 paysage: 297mm x 210mm, ratio ~1.414 */
      width: 1122px;
      height: 793px;
      background: #fff;
      box-shadow: 0 4px 20px rgba(0,0,0,0.15);
      position: relative;
      overflow: hidden;
    }
    
    .planche-item {
      position: absolute;
      cursor: move;
      user-select: none;
    }
    
    .planche-item.selected {
      outline: 2px solid #0066ff;
      outline-offset: 2px;
    }
    
    .planche-image {
      width: 160px;
      border-radius: 6px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .planche-image-label {
      position: absolute;
      bottom: -20px;
      left: 0;
      right: 0;
      text-align: center;
      font-size: 10px;
      font-family: ui-monospace, monospace;
      color: #666;
    }
    
   .planche-text {
  min-width: 50px;
  min-height: 20px;
  padding: 8px 12px;
  font-size: 14px;
  border: 2px dashed transparent;
  border-radius: 4px;
  background: transparent;
}
.planche-text:hover { border-color: #ccc; }
.planche-text:focus {
  border-color: #0066ff;
  outline: none;
}
    
planche-arrow{
  position:absolute;
  inset:0;
  z-index:9999;      /* <-- SUPER IMPORTANT */
  pointer-events:none;
}
.planche-arrow line,
.planche-arrow circle{
  pointer-events:auto;
}
    
    .planche-rect {
  border: 2px solid #111;
  background: transparent;
  min-width: 50px;
  min-height: 50px;
  border-radius: 4px;
}
    
    .planche-rect.selected,
    .planche-text.selected {
      outline: 2px solid #0066ff;
      outline-offset: 2px;
    }
    
    .resize-handle {
      position: absolute;
      width: 10px;
      height: 10px;
      background: #0066ff;
      border-radius: 2px;
      bottom: -5px;
      right: -5px;
      cursor: se-resize;
      display: none;
    }
    .planche-item.selected .resize-handle { display: block; }


/* Hover video player */
.hover-player {
 position: fixed;
 z-index: 9999;
 pointer-events: none;
 border-radius: 8px;
 overflow: hidden;
 box-shadow: 0 4px 20px rgba(0,0,0,0.4);
 background: #000;
}
.hover-player video {
 width: 280px;
 aspect-ratio: 16/9;
 object-fit: cover;
 display: block;
}
.hover-player.hidden {
 display: none;
}
.planche-timeline {
 border: 2px solid #ccc;
 border-radius: 6px;
 background: #f0f0f0;
 overflow: hidden;
}

.planche-timeline.selected {
 outline: 2px solid #0066ff;
 outline-offset: 2px;
}

.main-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Colonne principale */
.main-content {
  flex: 1;
  min-width: 0;
}

/* Colonne droite */
.side-column {
  width: 120px;              /* colonne étroite */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 20px;
}

.side-link {
  display: block;
  text-decoration: none;
  color: #111;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 6px;
  background: #fff;
  text-align: center;
  font-size: 11px;
}

.side-link:hover {
  background: #f5f5f5;
}

.side-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;      /* carré */
  background: #ccc;
  border-radius: 6px;
  margin-bottom: 4px;
  object-fit: cover;
}

/* ========================================
   FOCUS EDITORIAL
   ======================================== */
.focus-box {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  color: #fff;
}

.focus-header {
  margin-bottom: 16px;
}

.focus-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.focus-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin: 0;
}

.focus-description {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255,255,255,0.85);
  margin-bottom: 16px;
}

.focus-films {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.focus-film {
  flex: 0 0 auto;
  width: 140px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.focus-film:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.focus-film img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.focus-film-title {
  padding: 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focus-footer {
  margin-top: 14px;
  text-align: right;
}

.focus-link {
  color: #64b5f6;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.focus-link:hover {
  text-decoration: underline;
}

/* Masquer si pas de focus */
.focus-box.hidden {
  display: none;
}
