/* ============================================================
   ProfeAcademī · Estilos de colaboración en tiempo real
   ============================================================ */

/* ── Panel flotante ── */
.pa-collab-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9000;
  background: white;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
  padding: 0.85rem 0.95rem;
  min-width: 230px;
  max-width: 320px;
  font-family: 'Inter', sans-serif;
}
.pa-collab-panel.hidden { display: none; }

.pa-collab-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem;
}
.pa-collab-title {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.78rem; font-weight: 700; color: #374151;
}
.pa-collab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
  animation: pa-pulse 1.6s ease-in-out infinite;
}
@keyframes pa-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

.pa-collab-end {
  background: none; border: none; color: #9ca3af;
  cursor: pointer; font-size: 1.1rem; line-height: 1;
  padding: 0 0.25rem; border-radius: 4px;
}
.pa-collab-end:hover { background: #fee2e2; color: #b91c1c; }

.pa-collab-avatars {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin-bottom: 0.65rem; min-height: 28px;
}
.pa-avatar {
  position: relative;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.72rem; font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  cursor: default;
}
.pa-avatar .pa-crown {
  position: absolute; top: -6px; right: -4px;
  font-size: 0.65rem; color: #f59e0b;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.pa-collab-empty {
  font-size: 0.74rem; color: #9ca3af; font-style: italic;
}

.pa-collab-actions {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
}

.pa-collab-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.38rem 0.75rem; border-radius: 7px;
  border: 1.5px solid #e5e7eb; background: white;
  color: #374151;
  font-size: 0.74rem; font-weight: 600; cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.pa-collab-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.pa-collab-btn.primary {
  background: #F9A825; color: #1A1A1A; border-color: #F9A825;
}
.pa-collab-btn.primary:hover { background: #E65100; }
.pa-collab-btn.ghost {
  background: transparent; color: #6b7280; border-color: #e5e7eb;
}
.pa-collab-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Botón "Colaborar" en sidebar (anclado por la app huésped) ── */
.pa-collab-cta {
  display: inline-flex; align-items: center; gap: 0.4rem;
  width: 100%; justify-content: center;
  padding: 0.62rem 1rem; border-radius: 8px;
  background: linear-gradient(135deg, #F9A825, #FDD835);
  color: #1A1A1A; font-weight: 700; font-size: 0.84rem;
  border: none; cursor: pointer;
  box-shadow: 0 4px 14px rgba(249,168,37,0.32);
  transition: transform 0.12s, box-shadow 0.12s;
  margin-top: 0.55rem;
}
.pa-collab-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(249,168,37,0.42);
}
.pa-collab-cta::before { content: '👥'; font-size: 0.95rem; }
.pa-collab-cta.active {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 4px 14px rgba(16,185,129,0.32);
}
.pa-collab-cta.active::before { content: '🟢'; }

/* ── Banner de invitaciones pendientes ── */
.pa-collab-invite-card {
  margin-top: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: #FFFDE7;
  border: 1px solid #FEF08A;
  border-radius: 10px;
}
.pa-collab-invite-text {
  font-size: 0.78rem; color: #4b5563;
  margin-bottom: 0.55rem;
}
.pa-collab-invite-text em {
  color: #92400E; font-style: normal; font-weight: 600;
}
.pa-collab-invite-actions {
  display: flex; gap: 0.4rem; justify-content: flex-end;
}

/* ── Modal de invitación ── */
.pa-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.55); backdrop-filter: blur(4px);
  z-index: 9500;
  align-items: center; justify-content: center;
}
.pa-modal-overlay.open { display: flex; }
.pa-modal {
  background: white; border-radius: 14px;
  padding: 1.6rem 1.5rem; width: 92%; max-width: 460px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  position: relative;
  font-family: 'Inter', sans-serif;
  max-height: 88vh; overflow-y: auto;
}
.pa-modal-close {
  position: absolute; top: 0.85rem; right: 0.95rem;
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: #9ca3af; line-height: 1;
}
.pa-modal-close:hover { color: #374151; }
.pa-modal-title {
  font-size: 1.05rem; font-weight: 800; color: #1f2937;
  margin-bottom: 0.35rem;
}
.pa-modal-sub {
  font-size: 0.78rem; color: #6b7280; margin-bottom: 1rem;
}
.pa-modal-sub strong { color: #92400E; }

.pa-form-group { margin-bottom: 0.85rem; }
.pa-form-ctrl {
  width: 100%; padding: 0.6rem 0.85rem;
  border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 0.86rem; outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s;
  background: white; color: #1f2937;
}
.pa-form-ctrl:focus { border-color: #F9A825; }
.pa-form-ctrl.tiny  { padding: 0.32rem 0.5rem; font-size: 0.78rem; }

/* ── Lista de sugerencias ── */
.pa-suggest-list {
  max-height: 260px; overflow-y: auto;
  border: 1px solid #e5e7eb; border-radius: 10px;
  background: white;
}
.pa-suggest-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid #f3f4f6;
  gap: 0.5rem;
}
.pa-suggest-row:last-child { border-bottom: none; }
.pa-suggest-row.tiny { padding: 0.4rem 0.7rem; }
.pa-suggest-info { flex: 1; min-width: 0; }
.pa-suggest-name {
  font-size: 0.83rem; font-weight: 600; color: #1f2937;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pa-suggest-email {
  font-size: 0.74rem; color: #6b7280;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pa-suggest-loading,
.pa-suggest-empty {
  padding: 1rem; font-size: 0.82rem;
  color: #9ca3af; text-align: center; font-style: italic;
}

.pa-pill {
  font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: #f3f4f6; color: #6b7280;
}

.pa-collab-section { margin-top: 1rem; }
.pa-collab-section-title {
  font-size: 0.74rem; font-weight: 700;
  color: #6b7280; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 0.4rem;
}

/* ── Menú de modo de acceso ── */
.pa-access-menu {
  position: fixed;
  bottom: 90px; right: 1rem;
  z-index: 9100;
  background: white; border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  border: 1px solid #e5e7eb;
  padding: 0.5rem; min-width: 290px;
  max-height: 60vh; overflow-y: auto;
  font-family: 'Inter', sans-serif;
}
.pa-access-menu.hidden { display: none; }
.pa-access-opt {
  padding: 0.55rem 0.7rem; border-radius: 8px;
  cursor: pointer; transition: background 0.12s;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.pa-access-opt:hover { background: #FFFDE7; }
.pa-access-opt strong { font-size: 0.84rem; color: #1f2937; }
.pa-access-opt span   { font-size: 0.72rem; color: #6b7280; }

.pa-access-divider {
  height: 1px; background: #e5e7eb; margin: 0.4rem 0;
}
.pa-access-assign { padding: 0.3rem 0.4rem; }
.pa-access-assign-title {
  font-size: 0.72rem; font-weight: 700; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}
.pa-access-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0; font-size: 0.78rem;
}
.pa-access-row-name {
  flex: 1; color: #374151; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pa-access-row select { width: 130px; }

/* ── Indicadores en la rúbrica (criterio bloqueado, dueño visible) ── */
.rubric-table tr.row-locked td.col-crit {
  position: relative;
}
.rubric-table tr.row-locked td.lvl-cell {
  opacity: 0.55;
  cursor: not-allowed !important;
  background: repeating-linear-gradient(
    45deg, #f9fafb, #f9fafb 8px, #f3f4f6 8px, #f3f4f6 16px
  ) !important;
}
.rubric-table tr.row-locked td.lvl-cell:hover { background: inherit !important; }

.pa-row-owner-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-left: 0.4rem; padding: 0.12rem 0.45rem;
  background: #FFFDE7; color: #92400E;
  border-radius: 999px; font-size: 0.7rem; font-weight: 600;
  vertical-align: middle;
}
.pa-row-owner-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}

/* ── Bloqueo de navegación para invitados (host-led) ── */
body.pa-collab-guest .eval-item {
  cursor: not-allowed !important;
  position: relative;
}
body.pa-collab-guest .eval-item:not(.active) { opacity: 0.7; }
body.pa-collab-guest .eval-item.active::after {
  content: '👁';
  position: absolute;
  top: 50%; right: 0.5rem;
  transform: translateY(-50%);
  font-size: 0.78rem;
  opacity: 0.8;
}
body.pa-collab-guest #add-eval-btn { display: none !important; }

/* Highlight efímero cuando otro usuario hizo clic */
@keyframes pa-flash {
  0%   { box-shadow: inset 0 0 0 3px var(--pa-flash, #F9A825); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
.lvl-cell.pa-flash {
  animation: pa-flash 1.1s ease-out;
}

/* ── Toast global (fallback si la página no lo define) ── */
.toast {
  position: fixed; bottom: 1.4rem; right: 1.4rem;
  padding: 0.7rem 1.2rem; border-radius: 10px;
  color: white; font-size: 0.85rem; font-weight: 600;
  z-index: 9999; display: none;
  font-family: 'Inter', sans-serif;
}
.toast.show { display: block; animation: pa-slide-up 0.25s ease; }
.toast-ok  { background: #10b981; }
.toast-err { background: #ef4444; }
@keyframes pa-slide-up {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Responsive */
@media (max-width: 640px) {
  .pa-collab-panel {
    bottom: 0.6rem; right: 0.6rem; left: 0.6rem;
    max-width: none;
  }
  .pa-access-menu {
    left: 0.6rem; right: 0.6rem; min-width: 0;
  }
}
