/* Albums: folder-manager modal. */

.study-table > tbody > tr > td.td-viewer-icon > .div-icon {
  display: none !important;
}

:root {
  --entelai-albums-z-backdrop: 2147483601;
  --entelai-albums-z-drawer:   2147483602;
  --entelai-albums-bg:         var(--ao-dark-2, #1A232F);
  --entelai-albums-bg-2:       #111827;
  --entelai-albums-fg:         #FFFFFF;
  --entelai-albums-accent:     var(--ao-accent, #0DE4C4);
}

.entelai-albums-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--entelai-albums-bg-2);
}
#entelai-albums-title {
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
}

.entelai-albums-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── Folder manager modal (V2) ─────────────────────────────── */
#entelai-albums-backdrop {
  position: fixed; inset: 0; z-index: var(--entelai-albums-z-backdrop);
  display: none; align-items: center; justify-content: center;
  background: rgba(3, 13, 25, 0.6);
}
#entelai-albums-backdrop[data-open="true"] { display: flex; }
#entelai-albums-modal {
  position: static; transform: none; width: 760px; max-width: calc(100vw - 32px);
  max-height: min(640px, calc(100vh - 48px));
  display: flex; flex-direction: column;
  background: var(--ao-dark-2, #1A232F);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px;
  color: var(--ao-text, #E2E8F0); font-family: 'Manrope', 'Inter', sans-serif;
}
.entelai-albums-header {           /* reusar clase existente, re-estilar */
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--ao-dark-1, #030D19);
}
#entelai-albums-title { font-size: 18px; font-weight: 700; color: #fff; }
.entelai-albums-body { flex: 1 1 auto; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 32px; }
.eam-section-title { font-size: 16px; font-weight: 700; color: #fff; margin: 0 0 14px; }
/* Titulo -> listado: 16px. El gap de 32px del body separa secciones entre si, no titulo de lista. */
.eam-section { display: flex; flex-direction: column; gap: 16px; }
.eam-section .eam-section-title { margin: 0; }
.eam-list { display: flex; flex-direction: column; }
.eam-row { display: flex; align-items: center; justify-content: space-between; padding: 8px; cursor: pointer; }
.eam-list .eam-row:nth-child(odd) { background: var(--ao-dark-1, #030D19); }
.eam-row-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eam-row-folder svg { display: block; color: #fff; }
.eam-row-name { font-size: 16px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eam-row-actions { display: flex; gap: 8px; }
/* Color y hover de los iconos de accion: "Icono de accion" en entelai-ui.css. */
.eam-act { background: none; border: none; padding: 0; cursor: pointer; }
.eam-act svg { display: block; }

/* ── "Carpeta" study-table column cell (FolderColumn in entelai-albums.js) ──
   One accent-colored linked chip per folder the study belongs to. The td
   ellipsizes; each link keeps its icon + name on one line. */
td.eam-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eam-cell-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ao-accent, #0DE4C4); text-decoration: none; font-size: 14px; min-width: 0; }
.eam-cell-link:hover span:last-child { text-decoration: underline; }
/* Flex en un <div>, no en el <td> (un td flex sale del layout de tabla). */
.eam-cell-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.eam-cell-name { overflow: hidden; text-overflow: ellipsis; }
/* "+N": disparador de AOUI.select sin la piel de campo; texto de acento, sin chevron. */
.eam-cell-ms { width: auto; flex: 0 0 auto; }
.eam-cell-ms > .eam-cell-more { display: flex; cursor: pointer; padding: 0; background: none; border: 0; }
.eam-cell-ms .eam-cell-more .ao-ms-label { color: var(--ao-accent, #0DE4C4); }
.eam-cell-ms .eam-cell-more:hover .ao-ms-label { text-decoration: underline; }
.eam-cell-ms .ao-ms-chev { display: none; }
.eam-cell-ms .ao-ms-pop { min-width: 200px; }
.eam-cell-ic svg { display: block; }
.eam-create-btns { display: flex; gap: 14px; }
.eam-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-top: 1px solid var(--ao-dark-1, #030D19); }
/* .eam-cancel es el link secundario de entelai-ui.css. */

/* ── Create/rename/smart-editor/delete forms (Task 3) ────────────────────
 * All share the .eam-form shell inside .entelai-albums-body (which already
 * supplies the modal's own padding — no padding duplicated here) and hand
 * their submit/cancel off to the shared renderFooter(view, opts) from
 * Task 2 instead of rendering their own inline action row. */
.eam-form { display: flex; flex-direction: column; gap: 20px; }

.eam-input {
  flex: 1 1 auto; min-width: 0; padding: 0 15px;
  background: var(--ao-dark-1, #030D19); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 64px; color: var(--ao-text, #E2E8F0);
}
.eam-field { display: flex; align-items: center; gap: 8px; width: 100%; }
.eam-field > label { font-size: 16px; color: #fff; white-space: nowrap; }

/* Smart editor's first row: Nombre (grows) + Combinar (intrinsic) + the
 * static "estas reglas:" text, all on one line (wraps only if narrow). */
.eam-row1 {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  color: #fff; font-size: 16px;
}
.eam-row1 > .eam-field { width: auto; }
.eam-field-name { flex: 1 1 220px; }
.eam-field-combine { flex: 0 0 auto; }

.eam-confirm { display: flex; flex-direction: column; gap: 12px; }
.eam-confirm-help {
  color: #94a3b8;
  font-size: 12px;
}
.entelai-albums-row-label { flex: 1; }
.entelai-albums-row-actions {
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 120ms;
}
.entelai-albums-row:hover .entelai-albums-row-actions { opacity: 1; }
.entelai-albums-row-actions button {
  background: transparent;
  color: var(--entelai-albums-fg);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  width: 24px; height: 24px;
  padding: 0;
  font: inherit;
}
.entelai-albums-row-actions button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.eam-rules {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.eam-rule {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
/* Field/operator/value controls share one pill class. Value is always the
 * 3rd child (field, operator, value, delete-button) so it's the one that
 * grows to fill the row; field/operator size to their own content. */
.eam-rule-ctl {
  padding: 0 15px; min-width: 0;
  background: var(--ao-dark-1, #030D19); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 64px; color: var(--ao-text, #E2E8F0);
  flex: 0 1 auto;
}
/* El control de valor es siempre el 3er hijo (campo, operador, valor, borrar),
 * cualquiera sea su forma. Posicional y no por clase porque AOCalendar.attach()
 * envuelve el input de fecha en un <span class="ao-cal-field"> que NO lleva
 * .eam-rule-ctl: con el selector por clase la regla de fecha no crecia y la
 * papelera quedaba a la izquierda del resto. */
.eam-rule > *:nth-child(3) { flex: 1 1 120px; width: auto; min-width: 0; }
.eam-rule > .ao-cal-field > input { width: 100%; }
/* Campo y operador entran envueltos en .ao-ms (el wrapper que posiciona su
   popover), que fuera de esta fila ocupa el 100% del ancho: AOUI.select con fit
   les da el de su opcion mas larga, como el <select> nativo que eran. */
.eam-rule > .ao-ms { min-width: 0; }
/* Compound value controls (date-range, reportStatus checkbox group) can't be
 * a fixed-height single-line pill — they wrap their own inner controls, so
 * the pill grows instead of clipping them. Higher-specificity compound
 * selector so this reliably wins over the base .eam-rule-ctl rule above
 * regardless of stylesheet order. */
.eam-rule-ctl.eam-rule-range { display: inline-flex; gap: 4px; align-items: center; }
.eam-rule-range input[type="date"] {
  background: transparent; border: none; color: inherit; font: inherit;
  padding: 0; min-width: 0;
}
.eam-rule-del {
  background: none; border: none; padding: 0; cursor: pointer; flex: 0 0 auto;
}
.eam-rule-del svg { display: block; width: 20px; height: 20px; }

/* Link secundario de entelai-ui.css (color, tipo, subrayado en hover) con icono:
   solo queda lo estructural y la escala de 14px, sin padding. */
.eam-newrule {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-end;
  padding: 0; font-size: 14px;
}
.eam-newrule svg { display: block; width: 20px; height: 20px; }

.eam-count-line {
  font-size: 14px;
  color: var(--ao-text, #E2E8F0);
}
.eam-count-value {
  color: var(--ao-text, #E2E8F0);
  font-weight: 600;
}

/* Hide rows that aren't in the active album. ActivationFilter sets/clears
 * the attribute. Use !important to outrank any inline display styling
 * Vue might apply during reactive re-render. */
.study-table > tbody > tr[data-album-hidden="true"] {
  display: none !important;
}

/* Siempre en flujo para que la tabla no se mueva al seleccionar: el toggle
 * es visibility, no display. min-height fija los 44px porque el alto real
 * depende de los permisos del rol (sin iconos el contenido da 38px) y el
 * espacio reservado tiene que ser constante. pointer-events:none en reposo
 * para no comerle 56px de superficie de arranque al marquee. */
#entelai-selection-bar {
  display: flex;
  visibility: hidden;
  pointer-events: none;
  min-height: 44px;
  width: 95%;
  margin: 0 auto 12px;
  align-items: center;
  gap: 24px;
  padding: 8px 12px;
  border-radius: 50px;
  background: #1A232F;
  color: #E2E8F0;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}
#entelai-selection-bar[data-visible="true"] {
  visibility: visible;
  pointer-events: auto;
}
#entelai-selection-bar .esb-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
#entelai-selection-bar .esb-close {
  background: none;
  border: none;
  padding: 0;
  font-size: 22px;
  line-height: 22px;
  cursor: pointer;
}
#entelai-selection-bar .esb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Color y hover de .esb-act y .esb-close: "Icono de accion" en entelai-ui.css. */
#entelai-selection-bar .esb-act {
  background: none;
  border: none;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
}
#entelai-selection-bar .esb-act svg { width: 20px; height: 20px; }

/* ── Bulk send-to-PACS progress panel (SendProgress, entelai-albums.js) ──
 * Bottom-left, independent of entelai-upload.js's .eu-widget (bottom-right)
 * so both can be on screen at once — that coexistence is the reason this
 * is its own panel instead of a second state on the upload widget. Reuses
 * .eu-widget/.eu-w-header/.eu-w-title/.eu-w-pct/.eu-aggregate/.eu-agg-row1/
 * .eu-agg-count/.eu-agg-bar/.eu-agg-bar-fill/.eu-agg-pct from
 * entelai-upload.css (loaded on every portal page regardless of this file);
 * this rule block only repositions/restyles on top of that. Deliberate
 * cross-file class coupling, not an accident. */
.esp-widget { left: 16px; right: auto; }
/* .eu-w-header's grid (1fr auto auto auto) is sized for the upload widget's
 * 4 children (title/pct/toggle/close). This panel only ever renders 2
 * (title/pct — no toggle or close, see entelai-albums.js), so without this
 * override the 2 unused trailing "auto" tracks still each eat a `gap`,
 * leaving dead space to the right of the pct. */
.esp-widget .eu-w-header { grid-template-columns: 1fr auto; }
.esp-widget.esp-error .eu-agg-bar-fill { background: var(--ao-error, #FF595C); }

.study-table > tbody > tr.eai-row-selected > td {
  background-color: rgba(13, 228, 196, 0.2) !important;
}

/* ── Multi-select: marquee (rubber-band) rectangle ─────────────────────────
   Fixed-position overlay drawn in viewport coords while dragging from an empty
   area. pointer-events:none so it never eats the mouse events driving it; sits
   below the drawer/tab (z ~2147483600) but above the table. */
.eai-marquee {
  position: fixed;
  z-index: 2147483590;
  border: 1px solid var(--entelai-albums-accent);
  background: rgba(13, 228, 196, 0.15);
  pointer-events: none;
  box-sizing: border-box;
}
/* While a marquee drag is live, kill text selection across the page. */
body.eai-marquee-active {
  user-select: none;
  -webkit-user-select: none;
}

.entelai-albums-ctx {
  position: fixed;
  list-style: none;
  margin: 0; padding: 0;
  background: #1A232F;
  color: #E5E7EB;
  border: none;
  border-radius: 6px;
  min-width: 200px;
  z-index: 2147483640;
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.35);
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 14px;
  overflow: hidden;
}
.entelai-albums-ctx li {
  padding: 11px 13px;
  cursor: pointer;
}
.entelai-albums-ctx li:hover { background: rgba(13, 228, 196, 0.12); }
.entelai-albums-ctx li.sep {
  padding: 0;
  height: 1px;
  background: #030D19;
  margin: 0;
  cursor: default;
}
.entelai-albums-ctx li.sep:hover { background: #030D19; }

.entelai-albums-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 16px;
  background: rgba(20, 184, 166, 0.1);
  color: var(--entelai-albums-fg);
  font-size: 13px;
  border-radius: 6px;
  margin: 8px 0;
}
.entelai-albums-banner button {
  flex: 0 0 auto;
  background: transparent;
  color: var(--entelai-albums-accent);
  border: 1px solid var(--entelai-albums-accent);
  border-radius: 40px;
  padding: 4px 14px;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.entelai-albums-banner button:hover {
  background: var(--entelai-albums-accent);
  color: var(--ao-dark-1, #030D19);
  box-shadow: 0 0 8px 0 var(--entelai-albums-accent);
}

#entelai-breadcrumb {
  display: flex; align-items: center; gap: 2px;
  margin: 0 0 12px 48px;
  font-family: Manrope, sans-serif; font-weight: 700; font-size: 24px; line-height: 1;
  color: #fff;
}
#entelai-breadcrumb .ebc-seg {
  appearance: none; -webkit-appearance: none; background: none; border: none;
  padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer;
  transition: color .12s ease;
}
#entelai-breadcrumb .ebc-seg.ebc-link:hover { color: var(--ao-accent, #0DE4C4); }
#entelai-breadcrumb .ebc-sep {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; color: #fff; flex: 0 0 auto;
}
#entelai-breadcrumb .ebc-sep svg { width: 24px; height: 24px; display: block; }
#entelai-breadcrumb .ebc-current { color: #fff; }

/* Pills de filtro aplicado + acciones de la fila. Nodo Figma 1137:805
   (1137:1122 la pill, 1138:1149 el boton): gap 16, la fila arranca 24px bajo el
   breadcrumb (24 colapsa contra los 12 de abajo del breadcrumb, gana el mayor). */
#entelai-active-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  margin: 24px 0 12px 48px;
  font-family: Manrope, sans-serif; font-size: 12px; line-height: 16px;
}
#entelai-active-filters .eaf-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px 4px 12px; border-radius: 20px;
  background: var(--ao-dark-2, #1A232F);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff; font-weight: 500;
  white-space: nowrap; max-width: 100%;
}
/* Una sola pill: las reglas de la carpeta inteligente y los filtros de la barra
   se ven y se operan igual (pedido del usuario, 2026-09-22). Antes .eaf-chip-album
   las separaba con borde y clave en acento. */
#entelai-active-filters .eaf-k { font-weight: 500; }
/* El valor es lo unico que puede crecer: trunca ahi y no en la pill, para que
   los dos iconos nunca queden fuera del recorte. */
#entelai-active-filters .eaf-v { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Los dos iconos de la pill siguen la regla general del portal: #FFFFFF en
   reposo, #0DE4C4 en hover. El nodo los pinta gris (chevron) y acento (X); el
   usuario pidio alinearlos con el resto (2026-09-22). */
#entelai-active-filters .eaf-ic {
  width: 24px; height: 24px; flex: 0 0 auto; padding: 0; border: none; cursor: pointer;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: 24px 24px; mask-size: 24px 24px;
  transition: background-color .12s ease;
}
#entelai-active-filters .eaf-edit {
  background-color: #fff;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='7.5 10.15 12 14.85 16.5 10.15'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='7.5 10.15 12 14.85 16.5 10.15'/></svg>");
}
#entelai-active-filters .eaf-x {
  background-color: #fff;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><line x1='8' y1='8' x2='16' y2='16'/><line x1='16' y1='8' x2='8' y2='16'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><line x1='8' y1='8' x2='16' y2='16'/><line x1='16' y1='8' x2='8' y2='16'/></svg>");
}
#entelai-active-filters .eaf-ic:hover { background-color: var(--ao-accent, #0DE4C4); }

/* QUITAR FILTROS: el link secundario de entelai-ui.css
   (.ao-link-btn) en la escala 12px del nodo. Esta hoja carga despues, asi que
   alcanza con redeclarar el tamano, sin !important. */
#entelai-active-filters .eaf-action { font-size: 12px; font-weight: 400; line-height: 1.3; }

/* Editor de una regla de carpeta inteligente: operador arriba, valor abajo.
   Apilados y no en linea porque el popover mide 397px y los controles de valor
   (multi-select, rango de fechas) necesitan el ancho completo. */
#ao-chip-editor .eaf-rule { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
#ao-chip-editor .eaf-rule > * { width: 100%; box-sizing: border-box; }
