/* =============================================
   PROYECTOS — ADSEN AI
   Tema claro. Paleta alineada con el resto de la app.
   ============================================= */

#proyectos-container { padding: 0 50px 3rem; }

/* ========== HERO ========== */
.pr-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0.5rem 0 1.5rem;
  padding: 26px 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f6f4ff 100%);
  border: 1px solid rgba(124,92,252,0.18);
  border-radius: 18px;
}
.pr-hero-content { flex: 1; min-width: 0; }
.pr-hero-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-bottom: 12px;
  background: rgba(124,92,252,0.12); color: #6d4aed; border-radius: 12px;
}
.pr-hero-title { font-size: 1.5rem; font-weight: 700; color: #1f2937; margin: 0 0 6px; }
.pr-hero-sub { font-size: 0.88rem; color: #4b5563; line-height: 1.55; margin: 0; max-width: 640px; }
.pr-hero-cta { flex-shrink: 0; }

/* ========== BOTONES ========== */
.pr-btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 20px;
  background: linear-gradient(135deg, #7c5cfc, #6d4aed);
  color: #fff; border: none; border-radius: 10px;
  font-size: 0.86rem; font-weight: 600; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pr-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,92,252,0.3); }
.pr-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.pr-btn-primary i { width: 16px; height: 16px; }
.pr-btn-ghost {
  padding: 10px 18px; background: transparent; color: #4b5563;
  border: 1px solid rgba(148,163,184,0.28); border-radius: 10px;
  font-size: 0.83rem; cursor: pointer; transition: all 0.15s;
}
.pr-btn-ghost:hover { background: rgba(148,163,184,0.08); color: #374151; }

/* Botón "Guardar en proyecto" — el que inyecta cada módulo */
.pr-save-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  background: rgba(124,92,252,0.09);
  border: 1px solid rgba(124,92,252,0.28);
  color: #5b3fd6; border-radius: 10px;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.pr-save-btn:hover { background: rgba(124,92,252,0.16); border-color: rgba(124,92,252,0.45); }
.pr-save-btn i { width: 15px; height: 15px; }

/* ========== GRID DE PROYECTOS ========== */
.pr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}
.pr-card {
  display: flex; flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s;
}
.pr-card:hover, .pr-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15,23,42,0.12);
  border-color: rgba(124,92,252,0.35);
  outline: none;
}
.pr-card-bar { height: 4px; width: 100%; }
.pr-card-body { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pr-card-title {
  font-size: 0.98rem; font-weight: 650; color: #1f2937; margin: 0; line-height: 1.35;
}
.pr-card-marca {
  font-size: 0.74rem; color: #6d4aed; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.pr-card-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.pr-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  border: 1px solid transparent;
  font-size: 0.7rem; font-weight: 600;
}
.pr-chip i { width: 12px; height: 12px; }
.pr-chip-vacio { background: rgba(148,163,184,0.12); color: #64748b; border-color: rgba(148,163,184,0.25); }
.pr-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 10px;
  border-top: 1px solid rgba(148,163,184,0.16);
  font-size: 0.73rem; color: #64748b;
}
.pr-archivados-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: #64748b; margin: 32px 0 12px;
}
.pr-grid-archivados .pr-card { opacity: 0.72; }

/* ========== ESTADOS ========== */
.pr-loading, .pr-error { text-align: center; padding: 60px 20px; color: #4b5563; }
.pr-error-detail { font-size: 0.8rem; color: #94a3b8; margin-top: 6px; }
.pr-spinner {
  width: 30px; height: 30px; margin: 0 auto 12px;
  border: 3px solid rgba(124,92,252,0.15); border-top-color: #7c5cfc;
  border-radius: 50%; animation: pr-spin 0.7s linear infinite;
}
@keyframes pr-spin { to { transform: rotate(360deg); } }

.pr-empty {
  text-align: center; padding: 56px 24px;
  background: #ffffff;
  border: 1px dashed rgba(148,163,184,0.35);
  border-radius: 16px;
}
.pr-empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin-bottom: 14px;
  background: rgba(124,92,252,0.1); color: #6d4aed; border-radius: 14px;
}
.pr-empty-icon i { width: 26px; height: 26px; }
.pr-empty h3 { font-size: 1.02rem; font-weight: 650; color: #1f2937; margin: 0 0 8px; }
.pr-empty p { font-size: 0.86rem; color: #4b5563; margin: 0 auto 18px; max-width: 460px; line-height: 1.55; }
.pr-empty-note { font-size: 0.82rem; color: #4b5563; line-height: 1.5; margin: 0 0 14px; }

/* ========== DETALLE ========== */
.pr-detail-head { margin: 0.5rem 0 1.25rem; }
.pr-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px; margin-bottom: 14px;
  background: transparent; border: 1px solid rgba(148,163,184,0.28);
  border-radius: 8px; color: #4b5563; font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s;
}
.pr-back:hover { background: rgba(148,163,184,0.08); color: #1f2937; }
.pr-back i { width: 15px; height: 15px; }
.pr-detail-title-row { display: flex; align-items: center; gap: 10px; }
.pr-detail-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pr-detail-title { font-size: 1.4rem; font-weight: 700; color: #1f2937; margin: 0; }
.pr-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: rgba(148,163,184,0.1); border: none; border-radius: 8px;
  color: #64748b; cursor: pointer; transition: all 0.15s;
}
.pr-icon-btn:hover { background: rgba(148,163,184,0.2); color: #1f2937; }
.pr-icon-btn i { width: 15px; height: 15px; }
.pr-icon-danger:hover { background: rgba(185,28,28,0.1); color: #b91c1c; }
.pr-detail-meta { font-size: 0.82rem; color: #64748b; margin: 8px 0 0; }
.pr-detail-objetivo {
  font-size: 0.86rem; color: #374151; line-height: 1.55;
  margin: 10px 0 0; padding: 12px 16px;
  background: rgba(124,92,252,0.05);
  border-left: 3px solid rgba(124,92,252,0.4);
  border-radius: 0 8px 8px 0;
}

/* Pestañas por tipo */
.pr-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 20px 0 18px; padding-bottom: 14px;
  border-bottom: 1px solid rgba(148,163,184,0.18);
}
.pr-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  background: #ffffff; border: 1px solid rgba(148,163,184,0.25);
  border-radius: 20px; color: #4b5563;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: all 0.15s;
}
.pr-tab:hover { border-color: rgba(124,92,252,0.4); color: #1f2937; }
.pr-tab.active {
  background: rgba(124,92,252,0.1); border-color: #7c5cfc; color: #5b3fd6; font-weight: 600;
}
.pr-tab-count {
  font-size: 0.7rem; padding: 1px 7px; border-radius: 10px;
  background: rgba(148,163,184,0.18); color: #475569; font-weight: 700;
}
.pr-tab.active .pr-tab-count { background: rgba(124,92,252,0.18); color: #5b3fd6; }

/* Items guardados */
.pr-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.pr-item {
  display: flex; flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.pr-item:hover { box-shadow: 0 8px 22px rgba(15,23,42,0.09); border-color: rgba(124,92,252,0.28); }
.pr-item-thumb { aspect-ratio: 16/10; max-height: 176px; overflow: hidden; background: #f1f3f9; }
.pr-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pr-item-body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.pr-item-tipo {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 6px; border: 1px solid transparent;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.pr-item-tipo i { width: 11px; height: 11px; }
.pr-item-title { font-size: 0.9rem; font-weight: 650; color: #1f2937; margin: 0; line-height: 1.4; }
.pr-item-resumen {
  font-size: 0.8rem; color: #4b5563; line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pr-item-nota {
  font-size: 0.78rem; color: #6d4aed; margin: 0;
  padding: 6px 10px; background: rgba(124,92,252,0.06); border-radius: 6px;
}
.pr-item-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 10px;
  border-top: 1px solid rgba(148,163,184,0.16);
}
.pr-item-fecha { font-size: 0.72rem; color: #64748b; }
.pr-item-actions { display: flex; align-items: center; gap: 10px; }
.pr-item-link {
  font-size: 0.76rem; font-weight: 600; color: #5b3fd6; text-decoration: none;
}
.pr-item-link:hover { text-decoration: underline; }
.pr-item-remove {
  background: none; border: none; padding: 0;
  font-size: 0.76rem; color: #94a3b8; cursor: pointer; transition: color 0.15s;
}
.pr-item-remove:hover { color: #b91c1c; }

/* ---- Editor inline de la nota (items con payload.contenido) ---- */
.pr-item-editor { display: flex; flex-direction: column; gap: 8px; }
.pr-item-ta {
  width: 100%; resize: vertical; min-height: 150px;
  font: inherit; font-size: 0.8rem; line-height: 1.55; color: #1f2937;
  background: #fff; border: 1px solid rgba(124,92,252,0.35); border-radius: 8px;
  padding: 10px 12px;
}
.pr-item-ta:focus { outline: none; border-color: #7c5cfc; box-shadow: 0 0 0 3px rgba(124,92,252,0.12); }
.pr-item-editor-foot { display: flex; gap: 8px; }
.pr-ed-save, .pr-ed-cancel {
  font-size: 0.76rem; font-weight: 600; padding: 6px 12px;
  border-radius: 7px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.pr-ed-save { background: #7c5cfc; border: 1px solid #7c5cfc; color: #fff; }
.pr-ed-save:hover { background: #6a48f0; }
.pr-ed-save:disabled { opacity: 0.6; cursor: default; }
.pr-ed-cancel { background: none; border: 1px solid rgba(148,163,184,0.4); color: #64748b; }
.pr-ed-cancel:hover { color: #1f2937; }
/* "Editar" es un <button> pero debe leerse igual que el link "Abrir" */
button.pr-item-link { background: none; border: none; padding: 0; cursor: pointer; }

/* ========== MODAL ========== */
.pr-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.pr-overlay-bg {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.pr-modal {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.22);
  padding: 24px;
  animation: pr-up 0.22s ease;
}
.pr-modal-sm { max-width: 420px; }
@keyframes pr-up { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: translateY(0) } }
.pr-modal::-webkit-scrollbar { width: 5px; }
.pr-modal::-webkit-scrollbar-thumb { background: rgba(124,92,252,0.25); border-radius: 3px; }
.pr-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(148,163,184,0.1); border: none; border-radius: 9px;
  color: #64748b; font-size: 1.25rem; line-height: 1; cursor: pointer;
  transition: background 0.15s;
}
.pr-modal-close:hover { background: rgba(148,163,184,0.2); color: #1f2937; }

.pr-modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding-right: 32px; }
.pr-modal-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
}
.pr-modal-icon i { width: 19px; height: 19px; }
.pr-modal-head h3 { font-size: 1.02rem; font-weight: 650; color: #1f2937; margin: 0 0 3px; }
.pr-modal-head p {
  font-size: 0.8rem; color: #64748b; margin: 0; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pr-modal-head p strong { color: #374151; font-weight: 600; }

/* Lista de proyectos dentro del modal */
.pr-search {
  width: 100%; padding: 9px 13px; margin-bottom: 10px;
  background: #ffffff; border: 1px solid rgba(148,163,184,0.28);
  border-radius: 9px; color: #374151; font-size: 0.83rem; outline: none;
  box-sizing: border-box; transition: border-color 0.2s;
}
.pr-search:focus { border-color: rgba(124,92,252,0.45); }
.pr-search::placeholder { color: #9aa3b2; }
.pr-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.pr-list::-webkit-scrollbar { width: 4px; }
.pr-list::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.3); border-radius: 2px; }
.pr-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 13px; text-align: left;
  background: #ffffff; border: 1px solid rgba(148,163,184,0.22);
  border-radius: 11px; cursor: pointer; transition: all 0.15s;
}
.pr-row:hover { border-color: rgba(124,92,252,0.45); background: #fbfaff; }
.pr-row.is-activo { border-color: rgba(124,92,252,0.35); background: rgba(124,92,252,0.04); }
.pr-row-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pr-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pr-row-name {
  font-size: 0.86rem; font-weight: 600; color: #1f2937;
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pr-row-tag {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 7px; border-radius: 10px;
  background: rgba(124,92,252,0.12); color: #5b3fd6;
}
.pr-row-meta {
  font-size: 0.74rem; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pr-row-arrow { width: 15px; height: 15px; color: #94a3b8; flex-shrink: 0; }
.pr-new-trigger {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  padding: 11px; background: transparent;
  border: 1px dashed rgba(124,92,252,0.35); border-radius: 11px;
  color: #5b3fd6; font-size: 0.83rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.pr-new-trigger:hover { background: rgba(124,92,252,0.06); }
.pr-new-trigger i { width: 15px; height: 15px; }

/* Formulario de creación */
.pr-label { display: block; font-size: 0.78rem; font-weight: 600; color: #374151; margin: 14px 0 6px; }
.pr-label:first-of-type { margin-top: 0; }
.pr-opt { font-weight: 400; color: #94a3b8; }
.pr-input {
  width: 100%; padding: 10px 13px;
  background: #ffffff; border: 1px solid rgba(148,163,184,0.28);
  border-radius: 9px; color: #374151; font-size: 0.85rem;
  outline: none; box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pr-input:focus { border-color: rgba(124,92,252,0.45); box-shadow: 0 0 0 3px rgba(124,92,252,0.08); }
.pr-input::placeholder { color: #9aa3b2; }
.pr-create-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  #proyectos-container { padding: 0 16px 2rem; }
  .pr-hero { flex-direction: column; padding: 20px; }
  .pr-hero-cta { width: 100%; justify-content: center; }
  .pr-grid, .pr-items { grid-template-columns: 1fr; }
  .pr-detail-title { font-size: 1.15rem; }
  .pr-modal { padding: 20px; max-height: 92vh; }
}

/* ========== ENGANCHES POR MODULO ========== */
/* Static Ads Lab: el boton va debajo de "Elegir este framework" */
.al-detail-left .pr-save-btn {
  width: 100%; justify-content: center; padding: 12px 20px; font-size: 0.86rem;
}
