/* Reasignar el proyecto de una grabación — menú del clic derecho + modal.
   Solo lo ve jesus con rol ADMIN (js/reasignar-proyecto.js). Mismo lenguaje visual
   que el modal de Modelos (model-config.css). */

.rp-menu,
.rp-overlay {
  --rp-ink: #182132;
  --rp-muted: #647084;
  --rp-line: #dce2eb;
  --rp-panel: #f7f9fc;
  --rp-violet: #6657e8;
  --rp-violet-dark: #5040d4;
  --rp-green: #168c61;
  --rp-amber: #a66208;
  --rp-red: #b4233f;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.rp-menu[hidden],
.rp-overlay [hidden] {
  display: none !important;
}

/* ── Menú del clic derecho ─────────────────────────────────────────────── */

.rp-menu {
  position: fixed;
  z-index: 100100;
  min-width: 270px;
  padding: 6px;
  color: var(--rp-ink);
  background: #fff;
  border: 1px solid var(--rp-line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(8, 14, 28, .22), 0 2px 6px rgba(8, 14, 28, .12);
  animation: rpFade .1s ease-out;
}

.rp-menu-titulo {
  margin: 4px 10px 6px;
  color: var(--rp-violet-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.rp-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  color: var(--rp-ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.rp-menu-item svg {
  flex: 0 0 auto;
  color: var(--rp-violet);
}

.rp-menu-item:hover,
.rp-menu-item:focus-visible {
  background: #f3f1ff;
  outline: none;
}

.rp-menu-pie {
  margin: 6px 10px 3px;
  padding-top: 7px;
  color: var(--rp-muted);
  border-top: 1px solid var(--rp-line);
  font-size: 10px;
}

/* ── Modal ─────────────────────────────────────────────────────────────── */

.rp-overlay {
  position: fixed;
  inset: 0;
  z-index: 100050;
  display: none;
  place-items: center;
  padding: 28px;
  background: rgba(14, 19, 31, .68);
  backdrop-filter: blur(7px);
}

.rp-overlay.is-open {
  display: grid;
  animation: rpFade .16s ease-out;
}

.rp-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, calc(100vw - 56px));
  max-height: min(860px, calc(100vh - 56px));
  overflow: hidden;
  color: var(--rp-ink);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(8, 14, 28, .35), 0 3px 12px rgba(8, 14, 28, .18);
}

.rp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--rp-line);
  background:
    radial-gradient(circle at 0 0, rgba(102, 87, 232, .12), transparent 38%),
    linear-gradient(180deg, #fff, #fbfbfe);
}

.rp-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  color: var(--rp-violet-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.rp-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rp-violet);
  box-shadow: 0 0 0 4px rgba(102, 87, 232, .12);
}

.rp-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.rp-subtitle {
  max-width: 560px;
  margin: 7px 0 0;
  color: var(--rp-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #5b6577;
  background: #fff;
  border: 1px solid var(--rp-line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .15s;
}

.rp-close:hover {
  color: var(--rp-violet-dark);
  border-color: #bdb5ff;
  transform: translateY(-1px);
}

.rp-body {
  display: grid;
  gap: 18px;
  min-height: 0;
  padding: 22px 26px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rp-banner {
  margin: 0;
  padding: 12px 14px;
  color: #7a4a06;
  background: #fff7e8;
  border: 1px solid #f3dcae;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.55;
}

.rp-label {
  display: block;
  margin-bottom: 6px;
  color: #49566a;
  font-size: 11px;
  font-weight: 700;
}

.rp-search-row {
  display: flex;
  gap: 9px;
}

.rp-input,
.rp-select {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  padding: 9px 11px;
  color: var(--rp-ink);
  background: #fff;
  border: 1px solid #cfd6e2;
  border-radius: 10px;
  outline: none;
  font: inherit;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}

.rp-input:focus,
.rp-select:focus,
.rp-close:focus-visible,
.rp-action:focus-visible,
.rp-result:focus-visible {
  border-color: var(--rp-violet);
  box-shadow: 0 0 0 3px rgba(102, 87, 232, .16);
  outline: none;
}

/* Resultados de la búsqueda */

.rp-results-titulo,
.rp-results-nota {
  margin: 0 0 8px;
  color: var(--rp-muted);
  font-size: 11px;
}

.rp-results-nota {
  margin: 8px 0 0;
}

.rp-results-lista {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rp-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  color: var(--rp-ink);
  background: #fff;
  border: 1px solid var(--rp-line);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.rp-result:hover {
  background: #f8f7ff;
  border-color: #c9c2ff;
}

.rp-result-id {
  color: var(--rp-violet-dark);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.rp-result-nombre {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rp-result-fecha {
  color: var(--rp-muted);
  font-size: 11px;
  white-space: nowrap;
}

.rp-chip {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  padding: 3px 8px;
  color: #11704e;
  background: #eaf8f2;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.rp-chip.is-warn {
  color: #8a5207;
  background: #fff3dc;
}

/* Ficha de la grabación */

.rp-card {
  padding: 16px;
  background: var(--rp-panel);
  border: 1px solid var(--rp-line);
  border-radius: 14px;
}

.rp-ficha-nombre {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.rp-ficha-meta {
  margin: 4px 0 0;
  color: var(--rp-muted);
  font-size: 11px;
}

.rp-fuentes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.rp-fuente {
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--rp-line);
  border-radius: 11px;
}

.rp-fuente dt {
  margin-bottom: 5px;
  color: var(--rp-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rp-fuente dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.rp-muted {
  color: var(--rp-muted);
  font-weight: 400;
}

.rp-warn {
  color: var(--rp-amber);
  font-weight: 700;
}

.rp-aviso {
  margin: 12px 0 0;
  padding: 9px 12px;
  color: #7a4a06;
  background: #fff7e8;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
}

/* Proyecto nuevo */

.rp-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  padding: 11px 13px;
  color: #7a4a06;
  background: #fff7e8;
  border: 1px solid #f3dcae;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}

.rp-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--rp-violet);
}

.rp-hint {
  min-height: 16px;
  margin: 8px 0 0;
  color: var(--rp-muted);
  font-size: 11px;
}

.rp-hint:empty {
  display: none;
}

/* Resultado antes -> después */

.rp-resultado-titulo {
  margin: 0 0 10px;
  font-size: 14px;
}

.rp-resultado-titulo.is-ok { color: var(--rp-green); }
.rp-resultado-titulo.is-no { color: var(--rp-red); }

.rp-tabla {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--rp-line);
  border-radius: 12px;
  font-size: 12px;
}

.rp-tabla th,
.rp-tabla td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rp-line);
  overflow-wrap: anywhere;
}

.rp-tabla tr:last-child th,
.rp-tabla tr:last-child td {
  border-bottom: 0;
}

.rp-tabla thead th {
  color: var(--rp-muted);
  background: var(--rp-panel);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rp-tabla tbody th {
  white-space: nowrap;
}

.rp-marca {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.rp-marca.is-ok { color: #fff; background: var(--rp-green); }
.rp-marca.is-no { color: #fff; background: var(--rp-red); }

.rp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Pie */

.rp-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 26px;
  background: #fbfcfe;
  border-top: 1px solid var(--rp-line);
}

.rp-feedback {
  min-height: 18px;
  margin: 0;
  color: var(--rp-muted);
  font-size: 12px;
  line-height: 1.45;
}

.rp-feedback.is-error { color: var(--rp-red); }
.rp-feedback.is-success { color: var(--rp-green); }
.rp-feedback.is-working { color: var(--rp-amber); }

.rp-actions {
  display: flex;
  gap: 9px;
}

.rp-action {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid #cfd6e2;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.rp-action.secondary {
  color: #4c586b;
  background: #fff;
}

.rp-action.secondary:hover {
  border-color: #bdb5ff;
}

.rp-action.primary {
  min-width: 130px;
  color: #fff;
  background: var(--rp-violet);
  border-color: var(--rp-violet);
  box-shadow: 0 6px 15px rgba(102, 87, 232, .22);
}

.rp-action.primary:hover:not(:disabled) {
  background: var(--rp-violet-dark);
}

.rp-action:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

body.rp-open {
  overflow: hidden !important;
}

@keyframes rpFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 640px) {
  .rp-overlay { padding: 14px; }
  .rp-dialog {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
  }
  .rp-header,
  .rp-body,
  .rp-footer { padding-left: 17px; padding-right: 17px; }
  .rp-fuentes { grid-template-columns: 1fr; }
  .rp-result { grid-template-columns: auto minmax(0, 1fr); }
  .rp-result-fecha,
  .rp-result .rp-chip { grid-column: 2; justify-self: start; }
  .rp-footer { grid-template-columns: 1fr; }
  .rp-feedback:empty { display: none; }
  .rp-action { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .rp-menu,
  .rp-overlay.is-open { animation: none; }
}
