/* ===========================================================================
   Dupliquer un Rali — focused duplicate page (web).
   Reuses the Reprogrammer shell/chrome (reschedule.css → rb-* classes) for
   topbar, hero, cards, mascot, recap rail, modal, switch, density, responsive.
   This file only adds the components specific to duplication (dp-*):
   quantity stepper, per-copy list, cadence helper, recap timeline, Pro note,
   result rows. Full light + dark via [data-theme] on <html>.
   =========================================================================== */

/* Design tokens (colors_and_type.css) are already loaded by shell.css and
   reschedule.css. Do NOT @import them again here — a third import would
   re-declare :root (dark) AFTER reschedule's [data-theme="light"] overrides
   and break light mode. This file only consumes the existing variables. */

/* =====================================================================
   TOPBAR — neutral "original kept" status (blue, not the green live dot)
   ===================================================================== */
.dp-status {
  background: rgba(91,141,239,0.12);
  border-color: rgba(91,141,239,0.32);
  color: var(--k-blue);
}
.dp-status .dot { background: var(--k-blue); }
.dp-status .dot::after { animation: none; box-shadow: none; }

/* =====================================================================
   SOURCE CARD — "modèle conservé" badge on the original Rali
   ===================================================================== */
.dp-source-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: 9999px;
  background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.30);
  font-size: 11.5px; font-weight: 700; color: var(--success);
}
.dp-source-badge svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2.2; fill: none; }

.dp-detail-link {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--fg-muted);
  background: none; border: 0; cursor: pointer; font-family: inherit;
  transition: color var(--t-fast);
}
.dp-detail-link:hover { color: var(--k-violet); }
.dp-detail-link svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2.2; fill: none; }

/* =====================================================================
   QUANTITY STEPPER
   ===================================================================== */
.dp-stepper {
  display: flex; align-items: center; justify-content: center; gap: 28px;
  padding: 6px 0 4px;
}
.dp-step-btn {
  width: 58px; height: 58px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; color: #fff; background: var(--k-gradient-h);
  box-shadow: 0 8px 20px rgba(185,104,199,0.30);
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast), opacity var(--t-fast);
}
.dp-step-btn svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 3; fill: none; }
.dp-step-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 26px rgba(185,104,199,0.42); }
.dp-step-btn:active:not(:disabled) { transform: scale(0.94); }
.dp-step-btn:disabled { opacity: 0.32; cursor: not-allowed; box-shadow: none; background: var(--bg-elev-2); color: var(--fg-muted); }

.dp-step-val { display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.dp-step-val .n {
  font-family: var(--font-display); font-weight: 800; font-size: 64px; line-height: 1;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #5B8DEF, #B968C7, #E94E8B);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.dp-step-val .u { font-size: 13px; font-weight: 600; color: var(--fg-muted); margin-top: 4px; letter-spacing: 0.02em; }

.dp-step-hint { text-align: center; font-size: 12.5px; color: var(--fg-muted); margin-top: 14px; line-height: 1.45; text-wrap: pretty; }

.dp-presets { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.dp-preset {
  min-width: 42px; padding: 7px 14px; border-radius: 9999px; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; color: var(--fg-secondary);
  background: var(--bg-elev-2); border: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums; transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.dp-preset:hover { transform: translateY(-1px); border-color: rgba(185,104,199,0.34); color: var(--fg); }
.dp-preset.on {
  color: var(--fg);
  background: linear-gradient(var(--bg-elev-1), var(--bg-elev-1)) padding-box, linear-gradient(135deg, var(--k-blue), var(--k-violet), var(--k-pink)) border-box;
  border: 1.5px solid transparent; box-shadow: 0 6px 16px rgba(185,104,199,0.18);
}

/* =====================================================================
   CADENCE HELPER — auto-distribute the copy dates
   ===================================================================== */
.dp-cadence {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 16px;
  background: var(--bg-elev-2); border: 1px solid var(--border-soft); margin-bottom: 14px;
}
.dp-cadence .cl {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--fg-secondary); margin-right: 2px;
}
.dp-cadence .cl svg { width: 15px; height: 15px; stroke: var(--k-violet); stroke-width: 2; fill: none; }
.dp-cad-opts { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--bg-elev-1); border: 1px solid var(--border-soft); gap: 2px; flex-wrap: wrap; }
.dp-cad-opt {
  padding: 6px 11px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600; color: var(--fg-muted); white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.dp-cad-opt:hover { color: var(--fg); }
.dp-cad-opt.on { background: var(--k-gradient-h); color: #fff; box-shadow: 0 4px 12px rgba(185,104,199,0.28); }
.dp-cad-from { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; }
.dp-cad-from .lbl { font-size: 12px; color: var(--fg-muted); }
.dp-cad-from input[type="date"] {
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums;
  background: var(--bg-elev-1); border: 1px solid var(--border-soft); border-radius: 10px; padding: 6px 9px;
  cursor: pointer; outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.dp-cad-from input[type="date"]:focus { border-color: rgba(185,104,199,0.5); box-shadow: 0 0 0 3px rgba(185,104,199,0.12); }
[data-theme="dark"] .dp-cad-from input[type="date"] { color-scheme: dark; }

/* =====================================================================
   COPY LIST — one editable row per duplicate
   ===================================================================== */
.dp-copies { display: flex; flex-direction: column; gap: 10px; }
.dp-copy {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto auto auto; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 16px; background: var(--bg-elev-2); border: 1px solid var(--border-soft);
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.dp-copy:hover { border-color: rgba(185,104,199,0.28); }
.dp-copy.dp-new { animation: dpRowIn .4s var(--ease-out); }
@keyframes dpRowIn { from { opacity: 0; transform: translateY(-6px); } }

.dp-copy .badge {
  flex: 0 0 auto; padding: 5px 11px; border-radius: 9999px;
  background: var(--k-gradient-h); color: #fff; font-size: 11.5px; font-weight: 700;
  white-space: nowrap; letter-spacing: 0.01em; box-shadow: 0 3px 9px rgba(185,104,199,0.26);
}
.dp-copy .name {
  min-width: 0; width: 100%; font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--fg);
  background: transparent; border: 0; border-bottom: 1px solid transparent; padding: 5px 4px; outline: none;
  border-radius: 4px; transition: border-color var(--t-fast), background var(--t-fast);
}
.dp-copy .name::placeholder { color: var(--fg-muted); font-weight: 500; }
.dp-copy .name:hover { background: var(--surface-tint-light); }
.dp-copy .name:focus { background: var(--surface-tint-light); border-bottom-color: rgba(185,104,199,0.5); }

.dp-copy input[type="date"], .dp-copy input[type="time"] {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums;
  background: var(--bg-elev-1); border: 1px solid var(--border-soft); border-radius: 10px; padding: 7px 10px;
  cursor: pointer; outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.dp-copy input[type="time"] { width: 84px; }
.dp-copy input[type="date"]:focus, .dp-copy input[type="time"]:focus {
  border-color: rgba(185,104,199,0.5); box-shadow: 0 0 0 3px rgba(185,104,199,0.12);
}
[data-theme="dark"] .dp-copy input[type="date"], [data-theme="dark"] .dp-copy input[type="time"] { color-scheme: dark; }

.dp-copy .rm {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--fg-muted); cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.dp-copy .rm svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.2; fill: none; }
.dp-copy .rm:hover { color: var(--error); background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.24); }
.dp-copy .rm:disabled { opacity: 0; pointer-events: none; }

.dp-copies-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 11px 13px;
  border-radius: 14px; border: 1px dashed var(--border); color: var(--fg-muted);
  font-size: 12.5px; font-weight: 600; cursor: pointer; background: transparent; font-family: inherit; width: 100%;
  justify-content: center; transition: border-color var(--t-fast), color var(--t-fast);
}
.dp-copies-foot svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.dp-copies-foot:hover:not(:disabled) { border-color: rgba(185,104,199,0.5); color: var(--k-violet); }
.dp-copies-foot:disabled { opacity: 0.4; cursor: not-allowed; }

/* =====================================================================
   RECAP — big count + date range
   ===================================================================== */
.dp-recap-count { display: flex; align-items: baseline; gap: 10px; }
.dp-recap-count .n {
  font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #5B8DEF, #B968C7, #E94E8B);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.dp-recap-count .u { font-size: 15px; font-weight: 700; color: var(--fg); }
.dp-recap-range { font-size: 12.5px; color: var(--fg-secondary); margin-top: 7px; font-variant-numeric: tabular-nums; }
.dp-recap-range b { color: var(--fg); font-weight: 700; }

/* recap timeline of the copies */
.dp-timeline { display: flex; flex-direction: column; }
.dp-tl-row { display: flex; align-items: center; gap: 11px; padding: 6px 0; position: relative; }
.dp-tl-row .pin {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--k-gradient-h); box-shadow: 0 2px 7px rgba(185,104,199,0.30);
}
.dp-tl-row:not(:last-child)::before {
  content: ''; position: absolute; left: 11.5px; top: 26px; bottom: -6px; width: 1.5px;
  background: linear-gradient(180deg, rgba(185,104,199,0.5), rgba(185,104,199,0.12));
}
.dp-tl-row .tx { min-width: 0; flex: 1 1 auto; }
.dp-tl-row .tx .nm { display: block; font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-tl-row .tx .dt { display: block; font-size: 11.5px; color: var(--fg-muted); margin-top: 1px; font-variant-numeric: tabular-nums; }

/* fresh-start note inside "repart à zéro" column header */
.dp-fresh-tag { font-size: 10.5px; font-weight: 700; color: var(--fg-muted); }

/* Pro note */
.dp-pro {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(100deg, rgba(91,141,239,0.10), rgba(233,78,139,0.10));
  border: 1px solid rgba(185,104,199,0.26);
}
.dp-pro .pi {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: var(--k-gradient-h); box-shadow: 0 4px 12px rgba(185,104,199,0.30);
}
.dp-pro .pi svg { width: 17px; height: 17px; stroke: #fff; stroke-width: 2; fill: none; }
.dp-pro .pt { min-width: 0; }
.dp-pro .pt .h { font-size: 13px; font-weight: 700; color: var(--fg); }
.dp-pro .pt .s { font-size: 11.5px; color: var(--fg-secondary); margin-top: 1px; }

/* =====================================================================
   MODAL — positive (non-destructive) variant overrides
   ===================================================================== */
.dp-modal-icon { background: linear-gradient(135deg, rgba(91,141,239,0.16), rgba(233,78,139,0.16)) !important; }
.dp-modal-icon svg { stroke: url(#k-grad-stroke) !important; }
.rb-modal-actions .dp-go {
  flex: 1.4 1 0; border-color: transparent; color: #fff; background: var(--k-gradient-h);
  box-shadow: var(--shadow-button);
}
.rb-modal-actions .dp-go:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(233,78,139,0.42); }

/* modal copies preview (scrolly list) */
.dp-modal-list { max-height: 168px; overflow-y: auto; margin: 2px -4px 16px; padding: 0 4px; scrollbar-width: thin; }
.dp-modal-list::-webkit-scrollbar { width: 6px; }
.dp-modal-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9999px; }
.dp-modal-li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.dp-modal-li:last-child { border-bottom: 0; }
.dp-modal-li .b { flex: 0 0 auto; padding: 3px 9px; border-radius: 9999px; background: var(--k-gradient-h); color: #fff; font-size: 11px; font-weight: 700; }
.dp-modal-li .nm { flex: 1 1 auto; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-modal-li .dt { flex: 0 0 auto; color: var(--fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* =====================================================================
   SUCCESS — created copies list
   ===================================================================== */
.dp-results { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 22px; text-align: left; }
.dp-result {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--bg-elev-2); border: 1px solid var(--border-soft); cursor: pointer; text-decoration: none;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.dp-result:hover { border-color: rgba(185,104,199,0.4); transform: translateY(-1px); }
.dp-result .b { flex: 0 0 auto; padding: 4px 10px; border-radius: 9999px; background: var(--k-gradient-h); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.dp-result .info { flex: 1 1 auto; min-width: 0; }
.dp-result .info .nm { display: block; font-size: 13.5px; font-weight: 700; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-result .info .code { display: block; font-size: 11.5px; color: var(--fg-muted); margin-top: 1px; font-variant-numeric: tabular-nums; }
.dp-result .cog { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--surface-tint-light); border: 1px solid var(--border-soft); color: var(--fg-secondary); }
.dp-result .cog svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; }

/* =====================================================================
   DENSITY = compact
   ===================================================================== */
[data-density="compact"] .dp-stepper { gap: 22px; }
[data-density="compact"] .dp-step-val .n { font-size: 54px; }
[data-density="compact"] .dp-step-hint { margin-top: 10px; }
[data-density="compact"] .dp-presets { margin-top: 12px; }
[data-density="compact"] .dp-copy { padding: 9px 11px; }
[data-density="compact"] .dp-copies { gap: 8px; }

/* =====================================================================
   RESPONSIVE — robust single-column stack under 1180px.
   The shared grid (reschedule.css) collapses the editor row under a
   fixed-height flex parent; block flow stacks editor + rail cleanly.
   ===================================================================== */
@media (max-width: 1180px) {
  .rb-stage { display: block; overflow-y: auto; }
  .rb-editor { display: block; overflow: visible; padding: 4px 2px 32px; margin-right: 0; }
  .rb-rail { display: block; min-height: auto; }
  .rb-rail-scroll { display: block; overflow: visible; margin: 0; }
  .rb-rail-foot { position: sticky; bottom: 0; background: var(--bg); padding-bottom: 16px; }
}

/* =====================================================================
   RESPONSIVE — stack copy rows on narrow editors
   ===================================================================== */
@media (max-width: 760px) {
  .dp-copy { grid-template-columns: auto 1fr auto; row-gap: 8px; }
  .dp-copy .name { grid-column: 2 / 4; }
  .dp-copy input[type="date"] { grid-column: 2 / 3; }
  .dp-copy input[type="time"] { grid-column: 3 / 4; justify-self: end; }
  .dp-copy .rm { grid-row: 1; grid-column: 3; justify-self: end; }
}
