/* ═══════════════════════════════════════════════════════════════
   UniProy — proyectos.css
   Tablero de proyectos: tabs, grid/list, pills resumidos, modal admin
   ═══════════════════════════════════════════════════════════════ */

/* ── Section shell (sin wrap card) ─────────────────────────────── */
.projects-section { padding-bottom: 4rem; }

.projects-section-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 14px;
  margin: 0 4px 22px;
}
.projects-section-head h2 {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(1.3rem, 2.6vw, 1.95rem);
  margin: 0 0 6px;
  color: var(--text);
  letter-spacing: -0.03em;
}
.projects-section-head p {
  margin: 0; color: var(--text-muted);
  line-height: 1.65; font-size: .9rem;
  max-width: 640px;
}

/* ── Toolbar: search + tabs + view + filtros ───────────────────── */
.projects-toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px; margin: 0 4px 14px;
}

.projects-search-pill {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
  min-width: 200px;
}
.projects-search-pill > i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .85rem; pointer-events: none;
}
.projects-search-input {
  width: 100%;
  padding: .62rem 1rem .62rem 2.6rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .85rem;
  transition: border-color .15s, background .15s;
}
.projects-search-input:focus {
  outline: none; border-color: rgba(0,89,78,.32);
  background: var(--card-solid);
}

.projects-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  flex: 1 1 auto;
}
.projects-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: .46rem .92rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: .79rem; font-weight: 700;
  cursor: pointer;
  transition: all .14s;
  white-space: nowrap;
}
.projects-chip i { font-size: .82rem; opacity: .85; }
.projects-chip strong {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 6px; border-radius: 999px;
  background: rgba(0,89,78,.1);
  color: var(--brand);
  font-size: .68rem; font-weight: 900;
}
.projects-chip:hover {
  border-color: rgba(0,89,78,.22);
  color: var(--brand);
  background: rgba(0,89,78,.04);
}
.projects-chip.is-active {
  background: rgba(0,89,78,.1);
  border-color: rgba(0,89,78,.22);
  color: var(--brand);
}
.projects-chip.is-active strong {
  background: var(--brand); color: #fff;
}
.projects-chip.tab-fase04.is-active { background: rgba(181,161,96,.14); border-color: rgba(181,161,96,.32); color: #8a6b19; }
.projects-chip.tab-fase04.is-active strong { background: #8a6b19; color: #fff; }
.projects-chip.tab-fase05.is-active { background: rgba(15,118,110,.12); border-color: rgba(15,118,110,.28); color: var(--green); }
.projects-chip.tab-fase05.is-active strong { background: var(--green); color: #fff; }

.projects-toolbar-end {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto;
}

.projects-view-toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.projects-view-toggle .view-btn {
  border: 0; background: transparent;
  width: 34px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--text-muted);
  font-size: .82rem; cursor: pointer;
  transition: background .14s, color .14s, box-shadow .14s;
}
.projects-view-toggle .view-btn:hover { color: var(--text); }
.projects-view-toggle .view-btn.is-active {
  background: var(--card-solid);
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 4px 10px rgba(15,23,42,.06);
}

.projects-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .48rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: .8rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: border-color .14s, background .14s, color .14s;
}
.projects-filter-btn:hover { border-color: rgba(0,89,78,.22); color: var(--brand); }
.projects-filter-btn.is-active { background: rgba(0,89,78,.08); border-color: rgba(0,89,78,.22); color: var(--brand); }

/* ── Filtros avanzados (drawer) ────────────────────────────────── */
.projects-filters-advanced {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 4px 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
}

/* ── Meta del grupo activo ─────────────────────────────────────── */
.projects-active-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  margin: 0 4px 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0,89,78,0.045), rgba(37,99,235,0.03));
  border: 1px solid rgba(0,89,78,.08);
}
.projects-active-meta strong {
  display: block;
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: .94rem;
}
.projects-active-meta p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 1.5;
}
.projects-active-meta [data-filter-summary] {
  font-size: .76rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.projects-status {
  margin: 0 4px 14px;
  padding: 0 4px;
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── Collection (grid / list) FUERA de cualquier card ──────────── */
.projects-collection { display: grid; gap: 20px; }
.projects-collection.is-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 991px) {
  .projects-collection.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.projects-collection.is-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ── Project card (vista grid) ─────────────────────────────────── */
.proj-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
.proj-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0,89,78,.18);
}
.proj-card.is-active {
  border-color: rgba(0,89,78,.36);
  box-shadow: 0 0 0 3px rgba(0,89,78,.08);
}

/* Banner: stripe coloreado por fase */
.proj-card-banner {
  position: relative;
  height: 72px;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #0a7a6b);
  overflow: hidden;
  border-radius: 20px 20px 0 0;
}
.proj-card-banner::after {
  content: "";
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='19' fill='none' stroke='rgba(255,255,255,.07)' stroke-width='1'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
.proj-card-banner.stage-borradores { background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%); }
.proj-card-banner.stage-fase04 { background: linear-gradient(135deg, #8a6b19 0%, #b5a160 100%); }
.proj-card-banner.stage-fase05 { background: linear-gradient(135deg, var(--brand), #0a7a6b); }

.proj-card-banner-icon {
  position: relative; z-index: 1;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  font-size: 1rem;
  border: 1px solid rgba(255,255,255,.18);
}
.proj-card-banner-status {
  position: relative; z-index: 1;
  margin-left: auto;
  padding: .3rem .75rem;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  font-size: .72rem; font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 70%;
}

/* Body */
.proj-card-body {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 18px 20px 14px;
  min-height: 130px;
}
.proj-card-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--text);
  line-height: 1.35;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.proj-card-code {
  display: inline-block;
  font-size: .7rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 14px;
}
.proj-card-meta {
  display: flex; flex-wrap: wrap;
  gap: 6px 14px;
  font-size: .8rem; color: var(--text-muted);
  line-height: 1.5;
  margin-top: auto;
  padding-top: 4px;
}
.proj-card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.proj-card-meta i { font-size: .74rem; opacity: .75; }
.proj-card-meta .meta-owner { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Foot — pills + more */
.proj-card-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(15,23,42,.015));
}
.proj-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  flex: 1; min-width: 0;
}

/* Pill de fase */
.proj-pill {
  position: relative;
  isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: .8rem; font-weight: 800;
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s, border-color .14s, background .14s, color .14s;
}
.proj-pill > span { position: relative; z-index: 1; line-height: 1; }
.proj-pill::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--pill-strong, rgba(0,89,78,.22)), var(--pill-soft, rgba(0,89,78,.08)));
  z-index: 0;
  transition: width .35s ease;
}
.proj-pill:hover { transform: translateY(-1px); }
.proj-pill.is-complete {
  border-color: rgba(0,89,78,.32);
  font-weight: 900;
}
.proj-pill.is-complete::after {
  content: "";
  position: absolute;
  right: 4px; top: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  z-index: 2;
  opacity: .9;
}

.proj-pill.phase-1 { --pill-strong: rgba(0,89,78,.28); --pill-soft: rgba(0,89,78,.08); color: var(--brand); }
.proj-pill.phase-1:hover { border-color: rgba(0,89,78,.32); }
.proj-pill.phase-2 { --pill-strong: rgba(37,99,235,.26); --pill-soft: rgba(37,99,235,.08); color: #1d4ed8; }
.proj-pill.phase-2:hover { border-color: rgba(37,99,235,.32); }
.proj-pill.phase-3 { --pill-strong: rgba(124,58,237,.26); --pill-soft: rgba(124,58,237,.08); color: #6d28d9; }
.proj-pill.phase-3:hover { border-color: rgba(124,58,237,.32); }
.proj-pill.phase-4 { --pill-strong: rgba(217,119,6,.28); --pill-soft: rgba(217,119,6,.08); color: #b45309; }
.proj-pill.phase-4:hover { border-color: rgba(217,119,6,.32); }
.proj-pill.phase-5 { --pill-strong: rgba(15,118,110,.28); --pill-soft: rgba(15,118,110,.08); color: var(--green); }
.proj-pill.phase-5:hover { border-color: rgba(15,118,110,.32); }
.proj-pill.is-current {
  border-color: currentColor;
  box-shadow: 0 0 0 2px rgba(0,89,78,.08);
}

/* Botón "más" + menú */
.proj-more-wrap { position: relative; flex-shrink: 0; }
.proj-more {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: grid; place-items: center;
  color: var(--text-muted);
  font-size: .88rem;
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}
.proj-more:hover { border-color: rgba(0,89,78,.28); color: var(--brand); background: rgba(0,89,78,.04); }
.proj-more-wrap.is-open .proj-more {
  border-color: rgba(0,89,78,.32); color: var(--brand); background: rgba(0,89,78,.08);
}
.proj-menu {
  position: absolute; right: 0; bottom: calc(100% + 8px);
  display: none; flex-direction: column;
  min-width: 200px; padding: 6px;
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  z-index: 30;
}
.proj-more-wrap.is-open .proj-menu { display: flex; }
.proj-menu a, .proj-menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0; background: transparent;
  text-align: left; text-decoration: none;
  color: var(--text);
  font-size: .8rem; font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
}
.proj-menu a i, .proj-menu button i { width: 14px; color: var(--text-muted); }
.proj-menu a:hover, .proj-menu button:hover {
  background: rgba(0,89,78,.08); color: var(--brand);
}
.proj-menu a:hover i, .proj-menu button:hover i { color: var(--brand); }
.proj-menu .menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.proj-menu .danger:hover { background: rgba(220,38,38,.1); color: #dc2626; }
.proj-menu .danger:hover i { color: #dc2626; }

/* ── Vista lista ───────────────────────────────────────────────── */
.projects-collection.is-list .proj-card {
  flex-direction: row; align-items: stretch;
  border-radius: 16px;
}
.projects-collection.is-list .proj-card-banner {
  width: 8px; height: auto;
  padding: 0; flex-shrink: 0;
  border-radius: 16px 0 0 16px;
}
.projects-collection.is-list .proj-card-banner::after,
.projects-collection.is-list .proj-card-banner-icon,
.projects-collection.is-list .proj-card-banner-status { display: none; }
.projects-collection.is-grid .proj-card-status-list { display: none; }
.projects-collection.is-list .proj-card-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(180px, 2.2fr) minmax(0, 1.6fr) auto;
  grid-template-areas:
    "title meta status"
    "code  meta status";
  gap: 0 16px;
  align-items: center;
  padding: 12px 18px;
}
.projects-collection.is-list .proj-card-title {
  grid-area: title;
  -webkit-line-clamp: 1;
  font-size: .92rem;
  margin: 0;
}
.projects-collection.is-list .proj-card-code { grid-area: code; margin: 0; font-size: .62rem; }
.projects-collection.is-list .proj-card-meta { grid-area: meta; margin: 0; }
.projects-collection.is-list .proj-card-status-list {
  grid-area: status;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-soft);
  padding: .26rem .6rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  white-space: nowrap;
  justify-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.projects-collection.is-list .proj-card-foot {
  border-top: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  padding: 12px 14px;
  flex-shrink: 0;
}

/* ── Empty / status ────────────────────────────────────────────── */
.projects-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: .88rem;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: rgba(0,89,78,.025);
}
.projects-empty i {
  font-size: 2.2rem;
  color: var(--border);
  display: block;
  margin-bottom: .75rem;
}

/* ── Skeleton (loading) ────────────────────────────────────────── */
.proj-skeleton {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-solid);
  overflow: hidden;
  animation: projSkelPulse 1.4s ease infinite;
}
.proj-skeleton-banner { height: 56px; background: var(--bg-soft); }
.proj-skeleton-body { padding: 14px 16px; }
.proj-skeleton-line { height: 12px; border-radius: 6px; background: var(--bg-soft); margin-bottom: 10px; }
.proj-skeleton-line.w40 { width: 40%; }
.proj-skeleton-line.w70 { width: 70%; }
.proj-skeleton-line.w90 { width: 90%; }
@keyframes projSkelPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .55; }
}

/* ── Modal de gestión administrativa ───────────────────────────── */
.projects-admin-modal { border-radius: 22px; overflow: hidden; }
.projects-admin-modal .modal-header {
  padding: 18px 22px 14px;
  background: linear-gradient(135deg, rgba(0,89,78,.06), rgba(181,161,96,.06));
  border-bottom: 1px solid var(--border);
}
.projects-admin-modal .modal-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1rem;
  color: var(--text);
}
.projects-admin-modal .modal-title i { color: var(--brand); }
.projects-admin-modal .modal-body { padding: 20px 22px; }
.admin-modal-context {
  display: grid; gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.admin-modal-context strong {
  font-size: .92rem; color: var(--text); font-weight: 800;
  display: block; word-break: break-word;
}
.admin-modal-context span {
  font-size: .72rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand);
}
.admin-modal-context .ctx-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: .76rem; color: var(--text-muted);
  letter-spacing: 0; text-transform: none; font-weight: 600;
  margin-top: 4px;
}
.admin-modal-context .ctx-meta i { font-size: .72rem; margin-right: 4px; opacity: .75; }

/* Reusa los estilos existentes de project-admin-grid pero los simplifica
   dentro del modal */
.projects-admin-modal .project-admin-controls {
  border-top: 0;
  padding-top: 0;
  gap: 14px;
}
.projects-admin-modal .project-admin-head {
  margin-bottom: 4px;
}
.projects-admin-modal .project-admin-grid {
  grid-template-columns: 1fr 1fr;
}
.projects-admin-modal .project-admin-actions {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .projects-toolbar-end { width: 100%; margin-left: 0; }
}
@media (max-width: 767px) {
  .projects-tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .projects-tabs::-webkit-scrollbar { height: 4px; }
  .projects-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
  .projects-search-pill { max-width: 100%; flex: 1 1 100%; }
  .projects-toolbar-end { justify-content: space-between; }
  .projects-collection.is-list .proj-card { flex-direction: column; }
  .projects-collection.is-list .proj-card-banner { width: auto; height: 6px; border-radius: 16px 16px 0 0; }
  .projects-collection.is-list .proj-card-body {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "code" "meta" "status";
    padding: 12px 14px;
    gap: 4px;
  }
  .projects-collection.is-list .proj-card-status-list { justify-self: start; }
  .projects-collection.is-list .proj-card-foot {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 10px 14px 12px;
    background: linear-gradient(180deg, transparent, rgba(15,23,42,.015));
  }
  .projects-admin-modal .project-admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .projects-collection.is-grid { grid-template-columns: 1fr; }
  .proj-pill { min-width: 34px; padding: 0 7px; font-size: .72rem; }
}
