/* Vistas personalizadas de Iniciativas: botón "ojo" + menú desplegable y modal
   de guardado. Mantiene el lenguaje visual de la barra de filtros (controles de
   32px, tokens de superficie, --shadow-pop para popovers). Sin style="" inline
   (CSP de producción): el color de cada vista se pinta con .view-color-<key>. */

/* ── Botón "ojo" (mismo formato que .filter-toggle) ──
   .table-views es el contenedor genérico (Licenciamiento y futuras tablas). */
.initiatives-views,
.table-views {
  position: relative;
  display: inline-flex;
}
/* ── Menú desplegable ── */
.views-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 280px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 8px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  display: none;
  flex-direction: column;
  gap: 4px;
}
.views-menu.open { display: flex; }

.views-menu-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  padding: 4px 8px 2px;
}
.views-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}
.views-menu-empty {
  color: var(--text3);
  font-size: 12px;
  padding: 8px;
  text-align: center;
}

.views-menu-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-sm);
}
.views-menu-item:hover { background: var(--bg3); }
.views-menu-item.is-active { background: var(--accent-soft); }

.views-menu-apply {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.views-menu-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.views-menu-check {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent);
}
.views-menu-del {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.views-menu-del svg { width: 14px; height: 14px; }
.views-menu-del:hover { color: var(--red); background: var(--red-soft); }

.views-menu-create {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 9px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.views-menu-create svg { width: 15px; height: 15px; flex: 0 0 auto; }
.views-menu-create:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Punto de color de la vista en el menú. */
.view-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shadow-color) 18%, transparent);
}

/* ── Muestras de color del modal ── */
.cv-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-top: 8px;
  justify-items: center;
}
.cv-swatch {
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shadow-color) 18%, transparent);
  transition: transform var(--transition-fast), box-shadow var(--transition);
}
.cv-swatch:hover { transform: scale(1.1); }
.cv-swatch.is-selected {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shadow-color) 18%, transparent), 0 0 0 2px var(--bg2), 0 0 0 4px var(--accent);
}

@media (max-width: 520px) {
  .cv-swatches { grid-template-columns: repeat(6, 1fr); gap: 8px; }
}

/* ── Clases de color (una por token de paleta) ── */
.view-color-v1  { background-color: var(--view-1); }
.view-color-v2  { background-color: var(--view-2); }
.view-color-v3  { background-color: var(--view-3); }
.view-color-v4  { background-color: var(--view-4); }
.view-color-v5  { background-color: var(--view-5); }
.view-color-v6  { background-color: var(--view-6); }
.view-color-v7  { background-color: var(--view-7); }
.view-color-v8  { background-color: var(--view-8); }
.view-color-v9  { background-color: var(--view-9); }
.view-color-v10 { background-color: var(--view-10); }
.view-color-v11 { background-color: var(--view-11); }
.view-color-v12 { background-color: var(--view-12); }
