/* ============================================================
   KIOS — ARCHITECTURAL FEEDBACK & EVALUATION HUD (WHITE MINIMAL)
   Consola retráctil de auditoría visual y dictamen arquitectónico.
   Diseño conforme a DESIGN.md: Fondo Blanco Puro (#FFFFFF),
   Azul KIOS (#002175), Verde Operativo (#22CC7E), Líneas (#D4D9E8)
   y cortes ortogonales a 90° (0px border-radius).
   ============================================================ */

/* 1. CONTENEDOR PRINCIPAL DEL DOCK RETRÁCTIL */
.kios-feedback-dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Titillium', Arial, sans-serif;
  font-size: 12px;
  line-height: 1;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  padding: 0;
}

/* 2. PESTAÑA PULLER RETRÁCTIL (SIEMPRE VISIBLE EN EL BORDE INFERIOR) */
.dock-puller-tab {
  background: #FFFFFF;
  color: #002175;
  border: 1px solid #D4D9E8;
  border-bottom: none;
  border-top: 2px solid #002175;
  border-radius: 0px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 -4px 18px rgba(0, 24, 84, 0.1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.dock-puller-tab:hover {
  background: #EFF0F9;
  color: #001854;
  box-shadow: 0 -6px 24px rgba(0, 24, 84, 0.16);
}

.dock-status-dot {
  width: 8px;
  height: 8px;
  background: #22CC7E;
  border-radius: 0px;
  box-shadow: 0 0 6px #22CC7E;
  display: inline-block;
  flex-shrink: 0;
  animation: kiosDotPulse 2.4s infinite ease-in-out;
}

@keyframes kiosDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.dock-puller-title {
  color: #002175;
}

.dock-puller-badge {
  background: #EFF0F9;
  color: #002175;
  border: 1px solid #D4D9E8;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dock-puller-arrow {
  display: flex;
  align-items: center;
  color: #54607B;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3. BARRA DE HERRAMIENTAS PRINCIPAL (BLANCA, ELEVADA) */
.dock-main-toolbar {
  display: flex;
  align-items: stretch;
  background: #FFFFFF;
  border: 1px solid #D4D9E8;
  border-top: 2px solid #002175;
  border-radius: 0px;
  box-shadow: 0 16px 40px rgba(0, 24, 84, 0.14), 0 2px 6px rgba(0, 0, 0, 0.04);
  color: #002175;
  padding: 0;
  transition: opacity 0.22s ease, transform 0.25s ease;
  white-space: nowrap;
}

/* COMPORTAMIENTO DE COLAPSO: Cuando está plegada, se oculta la barra principal */
.kios-feedback-dock.dock-collapsed .dock-main-toolbar {
  display: none;
}

.kios-feedback-dock.dock-collapsed .dock-puller-arrow {
  transform: rotate(0deg); /* Apunta hacia ARRIBA ▲ */
}

.kios-feedback-dock:not(.dock-collapsed) .dock-puller-arrow {
  transform: rotate(180deg); /* Apunta hacia ABAJO ▼ */
}

/* ETIQUETA INSTITUCIONAL DENTRO DE LA BARRA */
.dock-brand-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #EFF0F9;
  border-right: 1px solid #D4D9E8;
}

.dock-brand-name {
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: #002175;
  text-transform: uppercase;
}

/* SELECTOR DE MODOS (SEGMENTED TABS) */
.dock-modes-group {
  display: flex;
  align-items: stretch;
  background: #EFF0F9;
  border-right: 1px solid #D4D9E8;
  padding: 4px;
  gap: 4px;
}

.dock-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0px;
  color: #54607B;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s ease;
}

.dock-mode-btn svg {
  display: block;
  flex-shrink: 0;
}

.dock-mode-btn:hover {
  color: #002175;
  background: #FFFFFF;
}

.dock-mode-btn.mode-active {
  background: #002175;
  color: #FFFFFF;
  border-color: #002175;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 33, 117, 0.2);
}

.dock-mode-btn.mode-active svg {
  color: #FFFFFF;
}

/* CONTADOR DE REGISTROS */
.dock-counter-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: #FFFFFF;
  border-right: 1px solid #D4D9E8;
  color: #002175;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dock-counter-badge svg {
  color: #002175;
}

.dock-counter-badge span#dock-notes-count {
  font-family: 'Titillium', Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  color: #002175;
  background: #EFF0F9;
  padding: 2px 6px;
  border: 1px solid #D4D9E8;
}

/* BOTÓN PRINCIPAL: CONSOLIDAR VEREDICTO */
.dock-btn-consolidate {
  background: #22CC7E;
  color: #001854;
  border: none;
  border-radius: 0px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: background 0.18s ease;
}

.dock-btn-consolidate:hover {
  background: #22CC7E;
  opacity: 0.92;
}

.dock-btn-consolidate svg {
  flex-shrink: 0;
}

/* BOTÓN RÁPIDO DE PLEGAR */
.dock-btn-collapse {
  background: #FFFFFF;
  border: none;
  border-left: 1px solid #D4D9E8;
  border-radius: 0px;
  color: #54607B;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.dock-btn-collapse:hover {
  background: #EFF0F9;
  color: #002175;
}

/* MENÚ DE OPCIONES / CONFIGURACIÓN */
.dock-menu-wrap {
  position: relative;
  display: flex;
}

.dock-icon-btn {
  background: #FFFFFF;
  border: none;
  border-left: 1px solid #D4D9E8;
  border-radius: 0px;
  color: #54607B;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.dock-icon-btn:hover {
  background: #EFF0F9;
  color: #002175;
}

.dock-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #FFFFFF;
  border: 1px solid #D4D9E8;
  border-top: 2px solid #002175;
  border-radius: 0px;
  box-shadow: 0 16px 36px rgba(0, 24, 84, 0.15);
  padding: 6px;
  min-width: 250px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 100000;
}

.dock-dropdown-menu.menu-open {
  display: flex;
}

.dock-dropdown-item {
  background: transparent;
  border: none;
  border-radius: 0px;
  color: #002175;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.dock-dropdown-item svg {
  flex-shrink: 0;
  color: #002175;
}

.dock-dropdown-item:hover {
  background: #EFF0F9;
  color: #001854;
}

.dock-dropdown-item.item-danger {
  color: #54607B;
  border-top: 1px solid #D4D9E8;
  margin-top: 4px;
  padding-top: 10px;
}

.dock-dropdown-item.item-danger:hover {
  background: #EFF0F9;
  color: #001854;
}

/* 4. MODO EVALUACIÓN: ESTILOS TÉCNICOS SOBRE LAS SECCIONES */
body.kios-review-mode [data-kios-section] {
  position: relative !important;
  transition: outline 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  cursor: crosshair !important;
}

body.kios-review-mode [data-kios-section]::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(0, 33, 117, 0.35);
  pointer-events: none;
  z-index: 9980;
  transition: border-color 0.18s ease, background 0.18s ease;
}

body.kios-review-mode [data-kios-section]:hover::after {
  border: 2px solid #002175;
  background: rgba(0, 33, 117, 0.025);
}

/* Etiqueta flotante de inspección al hacer hover */
body.kios-review-mode [data-kios-section]:hover::before {
  content: 'AUDITAR SECCIÓN: ' attr(data-kios-section-name);
  position: absolute;
  top: 12px;
  left: 16px;
  z-index: 9999;
  background: #002175;
  color: #FFFFFF;
  font-family: 'Titillium', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 0px;
  border: 1px solid #002175;
  box-shadow: 0 4px 14px rgba(0, 24, 84, 0.2);
  pointer-events: none;
}

/* Sección activa / con popover abierto */
body.kios-review-mode [data-kios-section].kios-section-active::after {
  border: 2px solid #22CC7E !important;
  background: rgba(34, 204, 126, 0.04) !important;
}

/* 5. PINES EN EL LIENZO (STICKY ARCHITECTURAL TAGS EN BLANCO) */
.kios-canvas-pin {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 9990;
  background: #FFFFFF;
  color: #002175;
  border: 1px solid #002175;
  padding: 6px 12px;
  border-radius: 0px;
  font-family: 'Titillium', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 24, 84, 0.14);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kios-canvas-pin:hover {
  background: #EFF0F9;
  transform: translateY(-2px);
}

.pin-icon {
  display: flex;
  align-items: center;
  color: #002175;
  flex-shrink: 0;
}

.pin-badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: #EFF0F9;
  color: #002175;
  border: 1px solid #D4D9E8;
  flex-shrink: 0;
}

.pin-text-preview {
  color: #54607B;
  font-weight: 400;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 6. POPOVER CONTEXTUAL DE EVALUACIÓN */
.kios-feedback-popover {
  position: absolute;
  z-index: 99999;
  width: min(480px, 94vw);
  background: #FFFFFF;
  color: #002175;
  border-radius: 0px;
  border: 1px solid #002175;
  box-shadow: 0 24px 64px rgba(0, 24, 84, 0.2), 0 2px 8px rgba(0, 0, 0, 0.06);
  font-family: 'Titillium', Arial, sans-serif;
  display: none;
  flex-direction: column;
  animation: kiosPopoverIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.kios-feedback-popover.popover-visible {
  display: flex;
}

@keyframes kiosPopoverIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.popover-header {
  background: #002175;
  color: #FFFFFF;
  padding: 14px 20px;
  border-bottom: 2px solid #22CC7E;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.popover-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #EFF0F9;
  margin: 0 0 4px 0;
}

.popover-title {
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.01em;
}

.popover-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0px;
  color: #FFFFFF;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.popover-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.popover-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: #FFFFFF;
}

/* Selector de Veredicto / Afinidad */
.popover-rating-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #002175;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popover-label::before {
  content: '';
  width: 4px;
  height: 10px;
  background: #002175;
  display: inline-block;
}

.rating-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.rating-card-btn {
  background: #EFF0F9;
  border: 1px solid #D4D9E8;
  border-radius: 0px;
  color: #54607B;
  padding: 10px 8px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  text-align: center;
}

.rating-card-btn:hover {
  border-color: #002175;
  background: #FFFFFF;
  color: #002175;
}

.rating-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.rating-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
}

.rating-card-btn.pill-selected {
  background: #002175;
  color: #FFFFFF;
  border: 1px solid #002175;
  box-shadow: 0 4px 12px rgba(0, 33, 117, 0.2);
}

.rating-card-btn.pill-selected .rating-card-icon {
  color: #22CC7E;
}

/* Campos de entrada */
.popover-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.popover-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #D4D9E8;
  border-radius: 0px;
  font-family: inherit;
  font-size: 17px;
  color: #001854;
  background: #EFF0F9;
  resize: vertical;
  min-height: 64px;
  outline: none;
  transition: border-color 0.18s, background-color 0.18s;
}

.popover-textarea:focus {
  border-color: #002175;
  background: #FFFFFF;
}

/* Botones de acción del popover */
.popover-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid #EFF0F9;
}

.btn-popover-save {
  background: #22CC7E;
  color: #002175;
  border: none;
  border-radius: 0px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(34, 204, 126, 0.3);
  transition: background 0.18s ease;
  margin-left: auto;
}

.btn-popover-save:hover {
  background: #22CC7E;
  opacity: 0.92;
}

.btn-popover-delete {
  background: transparent;
  border: none;
  border-radius: 0px;
  color: #54607B;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 10px;
  transition: background 0.15s, color 0.15s;
}

.btn-popover-delete:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #001854;
}

/* 7. TOAST DE NOTIFICACIÓN */
.kios-feedback-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #002175;
  color: #FFFFFF;
  border: 1px solid #002175;
  padding: 10px 20px;
  border-radius: 0px;
  font-family: 'Titillium', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(0, 24, 84, 0.3);
  z-index: 100001;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kios-feedback-toast.toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 8. RESPONSIVE HUD */
@media (max-width: 900px) {
  .dock-main-toolbar {
    width: 98vw;
    justify-content: space-between;
  }
  .dock-brand-tag {
    display: none;
  }
  .dock-counter-badge {
    padding: 0 10px;
  }
  .dock-mode-btn {
    padding: 7px 10px;
    font-size: 12px;
  }
  .dock-btn-consolidate {
    padding: 0 12px;
    font-size: 12px;
  }
}
