/* ═══════════════════════════════════════════════════════════
   BMC Canvas — Experiencia completa rediseñada
   Layout: Canvas visual (izq) + Facilitador (der) en desktop
   Mobile: Two-view system (Chat View ↔ Canvas View)
   6 screen classes, container queries, reduced motion
   ═══════════════════════════════════════════════════════════ */

/* ── Overlay full-screen ── */
.bmc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--bg-deep, #08080d);
  display: flex;
  overflow: hidden;
  animation: bmcFadeIn 0.3s ease-out;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@keyframes bmcFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Left: Visual Canvas ── */
.bmc-canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  min-width: 0;
}

.bmc-canvas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 800px;
  background: #111118;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Grid placement matching Strategyzer layout */
/* Positions are set via JS inline styles; these CSS rules are fallback only */
.bmc-block[data-block="1"] { grid-column: 5; grid-row: 1; }      /* Segmentos de Clientes */
.bmc-block[data-block="2"] { grid-column: 3; grid-row: 1 / 3; }  /* Propuesta de Valor */
.bmc-block[data-block="3"] { grid-column: 4; grid-row: 2; }      /* Canales */
.bmc-block[data-block="4"] { grid-column: 4; grid-row: 1; }      /* Relaciones con Clientes */
.bmc-block[data-block="5"] { grid-column: 4 / 6; grid-row: 3; }  /* Fuentes de Ingresos */
.bmc-block[data-block="6"] { grid-column: 2; grid-row: 2; }      /* Recursos Clave */
.bmc-block[data-block="7"] { grid-column: 2; grid-row: 1; }      /* Actividades Clave */
.bmc-block[data-block="8"] { grid-column: 1; grid-row: 1; }      /* Socios Clave */
.bmc-block[data-block="9"] { grid-column: 1 / 4; grid-row: 3; }  /* Estructura de Costos */

/* ── Block card ── */
.bmc-block {
  background: #161622;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  min-height: 155px;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}

.bmc-block:hover {
  border-color: rgba(232, 115, 74, 0.4);
  box-shadow: 0 0 24px rgba(232, 115, 74, 0.12);
  transform: translateY(-2px);
}

.bmc-block:focus-visible {
  outline: 2px solid #e8734a;
  outline-offset: 2px;
}

/* States */
.bmc-block.state-empty {
  background: #161622;
  border-color: rgba(255, 255, 255, 0.06);
}

.bmc-block.state-active {
  border-color: #e8734a;
  background: rgba(232, 115, 74, 0.06);
  box-shadow: 0 0 0 3px rgba(232, 115, 74, 0.15), 0 0 32px rgba(232, 115, 74, 0.1);
  animation: blockPulse 2s ease-in-out infinite;
}

@keyframes blockPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(232, 115, 74, 0.15), 0 0 32px rgba(232, 115, 74, 0.1); }
  50% { box-shadow: 0 0 0 8px rgba(232, 115, 74, 0.05), 0 0 48px rgba(232, 115, 74, 0.15); }
}

.bmc-block.state-validated {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.05);
}

.bmc-block.state-validated::after {
  content: '\2713';
  position: absolute;
  top: 12px;
  right: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #4ade80;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Block number */
.bmc-block-num {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5a5555;
  margin-bottom: 6px;
}

.state-active .bmc-block-num { color: #e8734a; }
.state-validated .bmc-block-num { color: #4ade80; }

/* Block title */
.bmc-block-title {
  font-size: 15px;
  font-weight: 700;
  color: #e0dcd6;
  margin-bottom: 8px;
  line-height: 1.25;
}

/* Block summary (shown when filled) */
.bmc-block-summary {
  font-size: 12.5px;
  color: #a89e94;
  line-height: 1.55;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

/* Empty placeholder */
.bmc-block-placeholder {
  font-size: 12px;
  color: #4a4545;
  font-style: italic;
  margin-top: auto;
}

/* Hover edit hint */
.bmc-block-edit-hint {
  display: none;
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 10px;
  color: #e8734a;
  font-weight: 600;
}

.state-validated:hover .bmc-block-edit-hint {
  display: block;
}

/* ── Pointer queries for edit hint ── */
@media (pointer: coarse) {
  /* Always show edit hint on touch devices */
  .state-validated .bmc-block-edit-hint {
    display: block;
  }
  /* Disable hover transform on touch */
  .bmc-block:hover {
    transform: none;
    box-shadow: none;
  }
  .bmc-block:active {
    transform: scale(0.98);
  }
}

@media (pointer: fine) {
  .state-validated:hover .bmc-block-edit-hint {
    display: block;
  }
  .bmc-block:hover {
    border-color: #e8734a;
    box-shadow: 0 4px 16px rgba(232, 115, 74, 0.15);
    transform: translateY(-1px);
  }
}

/* Block SVG icon colors — match state */
.bmc-block-icon {
  color: #b8a99a;
  flex-shrink: 0;
}
.state-active .bmc-block-icon { color: #e8734a; }
.state-validated .bmc-block-icon { color: #4ade80; }

/* ── Right: Facilitator Panel (Chat) ── */
/* Mobile-first: full-width, height inherits from overlay (100%) */
.bmc-facilitator {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #0f0f17;
}

/* Desktop: fixed width sidebar */
@media (min-width: 769px) {
  .bmc-facilitator {
    width: 460px;
    min-width: 400px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  }
}

/* Header */
.bmc-fac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  gap: 8px;
}

.bmc-fac-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bmc-fac-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e8734a, #f4a261);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 15px;
}

.bmc-fac-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bmc-fac-status {
  font-size: 11px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bmc-fac-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.bmc-fac-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.bmc-fac-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #9e8e8e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 14px;
}

.bmc-fac-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.bmc-fac-btn:focus-visible {
  outline: 2px solid #e8734a;
  outline-offset: -2px;
}

/* Progress bar */
.bmc-fac-progress {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.bmc-fac-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bmc-fac-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #e8734a, #f4a261);
  transition: width 0.5s ease;
}

.bmc-fac-progress-label {
  font-size: 11px;
  color: #6b5b5b;
  margin-top: 4px;
  text-align: right;
}

/* Messages area — the scrollable heart of the chat */
.bmc-fac-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.bmc-fac-messages::-webkit-scrollbar { width: 4px; }
.bmc-fac-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
}

/* Mode selector */
.bmc-mode-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 20px 0;
}

.bmc-mode-selector h3 {
  color: #fff;
  font-size: 15px;
  margin: 0 0 8px 0;
}

.bmc-mode-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #e0d6d6;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bmc-mode-btn:hover {
  background: rgba(232, 115, 74, 0.08);
  border-color: rgba(232, 115, 74, 0.3);
}

.bmc-mode-btn .mode-icon { font-size: 22px; }
.bmc-mode-btn .mode-info { display: flex; flex-direction: column; gap: 2px; }
.bmc-mode-btn .mode-name { font-weight: 700; color: #fff; font-size: 14px; }
.bmc-mode-btn .mode-desc { font-size: 11px; color: #9e8e8e; }

/* Message bubbles */
.bmc-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
  animation: bmcMsgIn 0.25s ease-out;
}

@keyframes bmcMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bmc-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bmc-msg .msg-avatar {
  width: 28px; height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}

.bmc-msg.agent .msg-avatar { background: linear-gradient(135deg, #e8734a, #f4a261); }
.bmc-msg.user  .msg-avatar { background: linear-gradient(135deg, #6b5b5b, #4a4040); }

.bmc-msg .msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  color: #e0d6d6;
}

.bmc-msg.agent .msg-bubble {
  background: #241f1f;
  border-bottom-left-radius: 4px;
}

.bmc-msg.user .msg-bubble {
  background: linear-gradient(135deg, #e8734a, #d46230);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bmc-msg .msg-bubble strong { color: #f4a261; font-weight: 600; }
.bmc-msg.user .msg-bubble strong { color: #fff; }
.bmc-msg.agent.proposal .msg-bubble { border-left: 3px solid #e8734a; }
.bmc-msg.agent.confirmed .msg-bubble { border-left: 3px solid #4ade80; }

/* Typing indicator */
.bmc-typing {
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  align-self: flex-start;
}

.bmc-typing .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #e8734a;
  animation: bmcTypingBounce 1.4s ease-in-out infinite;
}

.bmc-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.bmc-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bmcTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Chips area */
.bmc-fac-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.bmc-fac-chips:empty { display: none; }

.bmc-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #c4b8ae;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.bmc-chip:hover {
  background: rgba(232, 115, 74, 0.12);
  border-color: rgba(232, 115, 74, 0.35);
  color: #f4a261;
}

.bmc-chip.chip-action {
  background: rgba(232, 115, 74, 0.1);
  border-color: rgba(232, 115, 74, 0.25);
  color: #e8734a;
  font-weight: 600;
}

.bmc-chip.chip-action:hover { background: rgba(232, 115, 74, 0.2); }

.bmc-chip.chip-confirm {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.25);
  color: #4ade80;
  font-weight: 600;
}

/* Input area — sits at bottom of flex column */
.bmc-fac-input {
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #0f0f17;
}

.bmc-fac-input textarea {
  flex: 1;
  background: #1a1a24;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 14px;
  color: #e0d6d6;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s;
}

.bmc-fac-input textarea:focus {
  border-color: rgba(232, 115, 74, 0.5);
}

.bmc-fac-input textarea::placeholder {
  color: #5a4e4e;
}

.bmc-fac-send {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #e8734a, #f4a261);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.bmc-fac-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 115, 74, 0.35);
}

.bmc-fac-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}


/* ── Export modal ── */
.bmc-export-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bmcFadeIn 0.2s;
}

.bmc-export-modal {
  background: #111118;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 32px;
  width: 95vw;
  max-width: 1200px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.bmc-export-modal h2 {
  color: #f0ebe3;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.bmc-export-modal .export-subtitle {
  color: #a89e94;
  font-size: 14px;
  margin-bottom: 24px;
}

.bmc-export-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.bmc-export-btn {
  padding: 10px 22px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.bmc-export-btn.primary {
  background: linear-gradient(135deg, #e8734a, #f4a261);
  color: #fff;
}

.bmc-export-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 115, 74, 0.3);
}

.bmc-export-btn.secondary {
  background: #f5f0ec;
  color: #6b5b5b;
}

.bmc-export-btn.secondary:hover {
  background: #ebe4dc;
}

/* ═══════════════════════════════════════════════════════════
   VIEW TOGGLE BUTTONS (visible only on mobile)
   ═══════════════════════════════════════════════════════════ */
.bmc-view-toggle-canvas,
.bmc-view-toggle-chat {
  display: none;
}

/* ── Canvas-top toolbar (mobile canvas view) ── */
.bmc-canvas-toolbar {
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — 6 Screen Classes
   ═══════════════════════════════════════════════════════════ */

/* ── Laptop + Desktop (default, declared above): side-by-side ── */
/* No extra overrides needed — the default styles ARE the desktop layout */

/* ── Tablet / iPad (769px - 1024px) ── */
@media (max-width: 1024px) {
  .bmc-canvas-grid {
    min-width: 560px;
    gap: 8px;
    padding: 12px;
  }

  .bmc-block {
    padding: 14px 14px;
    min-height: 110px;
  }

  .bmc-block-title { font-size: 13px; }
  .bmc-block-summary { font-size: 10.5px; }
  .bmc-block-num { font-size: 9px; }

  .bmc-fac-header { padding: 12px 16px; }
  .bmc-fac-avatar { width: 30px; height: 30px; }
  .bmc-fac-header h3 { font-size: 14px; }
  .bmc-fac-messages { padding: 12px 16px; gap: 10px; }
  .bmc-fac-input { padding: 10px 12px; }
}

/* ── Tablet vertical / Small laptop (< 960px): stack canvas + facilitator ── */
@media (max-width: 960px) {
  .bmc-overlay {
    flex-direction: column;
  }

  .bmc-canvas-area {
    padding: 10px;
    flex: none;
    height: 50vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bmc-canvas-grid {
    min-width: 520px;
  }

  .bmc-facilitator {
    width: 100%;
    min-width: 0;
    flex: 1;
  }
}

/* ═══════════════════════════════════════════════════════════
   📱 MOBILE — TWO-VIEW SYSTEM (≤768px)
   Chat View ↔ Canvas View toggle
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .bmc-overlay {
    position: absolute;
    flex-direction: column;
  }

  /* ── View toggle buttons ── */
  .bmc-view-toggle-canvas {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(232, 115, 74, 0.15), rgba(244, 162, 97, 0.08));
    border: 1px solid rgba(232, 115, 74, 0.3);
    border-radius: 20px;
    padding: 6px 14px;
    color: #f4a261;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
  }
  .bmc-view-toggle-canvas:hover {
    background: linear-gradient(135deg, rgba(232, 115, 74, 0.25), rgba(244, 162, 97, 0.15));
    border-color: #e8734a;
    box-shadow: 0 0 16px rgba(232, 115, 74, 0.2);
    transform: translateY(-1px);
  }
  .bmc-view-toggle-canvas:active {
    transform: scale(0.97);
  }
  .bmc-view-toggle-canvas .toggle-icon { 
    display: flex;
    align-items: center;
  }
  .bmc-view-toggle-canvas .toggle-icon svg {
    width: 14px; height: 14px;
  }

  .bmc-view-toggle-chat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 6px 14px;
    color: #a89e94;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
  }
  .bmc-view-toggle-chat svg {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .bmc-view-toggle-chat:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
  }
  .bmc-view-toggle-chat:hover svg {
    transform: translateX(-2px);
  }
  .bmc-view-toggle-chat:active {
    transform: scale(0.97);
  }

  /* ── Canvas top toolbar (shown in canvas view) ── */
  .bmc-canvas-toolbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0f0f17;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
  }
  .bmc-canvas-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .bmc-canvas-toolbar .toolbar-progress {
    font-size: 11px;
    color: #6b5b5b;
  }

  

  /* ── Mobile block-by-block navigation ── */
  .bmc-mobile-nav {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .bmc-nav-arrow {
    width: 36px; height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #a89e94;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    backdrop-filter: blur(8px);
  }

  .bmc-nav-arrow:hover {
    background: rgba(232, 115, 74, 0.15);
    border-color: rgba(232, 115, 74, 0.35);
    color: #e8734a;
    transform: scale(1.05);
  }

  .bmc-nav-arrow:active {
    transform: scale(0.95);
  }

  .bmc-nav-arrow:disabled {
    opacity: 0.2;
    cursor: default;
    background: rgba(255, 255, 255, 0.01);
    transform: none;
  }

  .bmc-nav-arrow svg {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .bmc-nav-arrow:hover svg {
    transform: translateX(0);
  }

  .bmc-nav-arrow:first-of-type:hover svg {
    transform: translateX(-2px);
  }

  .bmc-nav-arrow:last-of-type:hover svg {
    transform: translateX(2px);
  }

  /* Single block focus in mobile canvas */
  .bmc-block.mobile-block-focus {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 200px;
    padding: 24px 20px;
    border-radius: 14px;
    border-width: 2px;
    margin: 0;
  }

  .bmc-block.mobile-block-focus .bmc-block-title {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .bmc-block.mobile-block-focus .bmc-block-summary {
    font-size: 15px;
    line-height: 1.65;
    -webkit-line-clamp: 6;
  }

  .bmc-block.mobile-block-focus .bmc-block-num {
    font-size: 13px;
  }

  .bmc-block.mobile-block-focus .bmc-block-placeholder {
    font-size: 15px;
  }

  .bmc-block.mobile-block-focus.state-validated::after {
    top: 16px; right: 18px;
    width: 28px; height: 28px;
    font-size: 15px;
  }

  /* All blocks hidden by default in mobile canvas view */
  .bmc-overlay.view-canvas .bmc-block {
    display: none;
  }
/* ═══ CHAT VIEW (default) ═══ */
.bmc-overlay.view-chat {
  position: absolute;
  inset: 0;
}
.bmc-overlay.view-chat .bmc-canvas-area {
  display: none;
}
.bmc-overlay.view-chat .bmc-canvas-toolbar {
  display: none;
}
.bmc-overlay.view-chat .bmc-facilitator {
  width: 100%;
  min-width: 0;
  min-height: 0;             /* allow shrinking when keyboard opens */
  flex: 1;
  border-left: none;
  box-shadow: none;
}
.bmc-overlay.view-chat .bmc-fac-messages {
  flex: 1;
  min-height: 0;             /* allow shrinking */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bmc-overlay.view-chat .bmc-view-toggle-canvas {
  /* Shown in header actions */
}
.bmc-overlay.view-chat .bmc-view-toggle-chat {
  display: none;
}

/* ═══ CANVAS VIEW ═══ */
.bmc-overlay.view-canvas .bmc-facilitator {
  display: none;
}
.bmc-overlay.view-canvas .bmc-canvas-area {
  display: flex;
  flex: 1;
  width: 100%;
  padding: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bmc-overlay.view-canvas .bmc-canvas-toolbar {
  display: flex;
}
.bmc-overlay.view-canvas .bmc-view-toggle-canvas {
  display: none;
}
.bmc-overlay.view-canvas .bmc-view-toggle-chat {
  /* Shown in toolbar */
}

  /* ═══ CANVAS GRID: single column on mobile ═══ */
  .bmc-canvas-grid {
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
  }

  /* Override JS inline grid styles — all blocks stack vertically */
  .bmc-canvas-grid .bmc-block {
    grid-column: auto !important;
    grid-row: auto !important;
    width: 100% !important;
  }

  /* Bigger, more readable blocks */
  .bmc-block {
    padding: 16px 18px;
    min-height: auto;
    border-radius: 12px;
  }

  .bmc-block-title {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .bmc-block-summary {
    font-size: 13px;
    -webkit-line-clamp: 3;
  }

  .bmc-block-num {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .bmc-block-placeholder {
    font-size: 13px;
  }

  /* ═══ BETTER CHAT ═══ */
  .bmc-fac-header {
    padding: 12px 14px;
  }

  .bmc-fac-avatar {
    width: 34px; height: 34px;
    border-radius: 10px;
  }

  .bmc-fac-header h3 {
    font-size: 14px;
  }

  .bmc-fac-header .status {
    font-size: 11px;
  }

  .bmc-fac-actions {
    gap: 4px;
  }

  .bmc-fac-btn {
    width: 30px; height: 30px;
    border-radius: 8px;
  }

  .bmc-fac-progress {
    padding: 6px 14px;
  }

  .bmc-fac-messages {
    padding: 14px 14px;
    gap: 14px;
  }

  .bmc-msg {
    max-width: 96%;
  }

  .bmc-msg .msg-avatar {
    width: 30px; height: 30px;
    border-radius: 9px;
  }

  .bmc-msg .msg-bubble {
    font-size: 14px;
    padding: 12px 15px;
    border-radius: 16px;
    line-height: 1.6;
  }

  .bmc-msg.agent .msg-bubble {
    border-bottom-left-radius: 6px;
  }

  .bmc-msg.user .msg-bubble {
    border-bottom-right-radius: 6px;
  }

  /* Chips — bigger, easier to tap */
  .bmc-chips {
    padding: 0 14px 10px;
    gap: 8px;
  }

  .bmc-chip {
    font-size: 13px;
    padding: 9px 16px;
    border-radius: 22px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  /* Input area */
  .bmc-fac-input {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .bmc-fac-input textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 10px 14px;
    max-height: 80px;
    border-radius: 14px;
  }

  .bmc-fac-send {
    width: 42px; height: 42px;
    border-radius: 14px;
  }

  /* Mode selector */
  .bmc-mode-selector {
    padding: 10px 0;
  }

  .bmc-mode-selector h3 {
    font-size: 16px;
  }

  .bmc-mode-btn {
    padding: 16px 18px;
    border-radius: 14px;
  }

  .bmc-mode-btn .mode-icon { font-size: 24px; }
  .bmc-mode-btn .mode-name { font-size: 15px; }
  .bmc-mode-btn .mode-desc { font-size: 12px; }

  /* Export modal — full screen on mobile */
  .bmc-export-modal {
    padding: 20px 16px;
    max-width: 100vw;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .bmc-export-modal h2 { font-size: 18px; }
  .bmc-export-actions {
    flex-direction: column;
    gap: 8px;
  }
  .bmc-export-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
  }
}

/* ── Compact Mobile (< 400px) — tighter spacing ── */
@media (max-width: 399px) {
  .bmc-canvas-grid {
    gap: 8px;
    padding: 8px;
  }

  .bmc-block {
    padding: 14px 16px;
  }

  .bmc-block-title { font-size: 14px; }

  .bmc-fac-messages {
    padding: 10px 8px;
    gap: 10px;
  }

  .bmc-fac-header {
    padding: 10px 10px;
  }

  .bmc-fac-header h3 { font-size: 13px; }

  .bmc-fac-avatar {
    width: 30px; height: 30px;
  }

  .bmc-fac-btn {
    width: 28px; height: 28px;
  }

  .bmc-chips {
    padding: 0 8px 8px;
    gap: 6px;
  }

  .bmc-chip {
    font-size: 12px;
    padding: 7px 13px;
  }

  .bmc-msg .msg-bubble {
    font-size: 13px;
  }
}

/* ── Large Desktop (1921px+) ── */
@media (min-width: 1921px) {
  .bmc-canvas-grid {
    min-width: 900px;
    max-width: 1100px;
  }

  .bmc-facilitator {
    width: 500px;
    min-width: 440px;
  }
}

/* ── Split View / Narrow Windows ── */
@media (max-width: 599px) {
  .bmc-fac-messages { padding: 8px 10px; }
  .bmc-mode-btn { padding: 12px 14px; }
}


/* ═══════════════════════════════════════════════════════════
   ANIMATIONS — Production-quality transitions
   ═══════════════════════════════════════════════════════════ */

/* ── Block slide transition (mobile) ── */
@keyframes bmcBlockSlideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes bmcBlockSlideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes bmcBlockSlideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-24px); }
}

@keyframes bmcBlockSlideOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}

.bmc-block.anim-slide-in-right {
  animation: bmcBlockSlideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.bmc-block.anim-slide-in-left {
  animation: bmcBlockSlideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Chat ↔ Canvas view transition ── */
.bmc-overlay.view-chat .bmc-canvas-area,
.bmc-overlay.view-canvas .bmc-facilitator {
  animation: bmcViewFadeOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes bmcViewFadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.98); }
}

.bmc-overlay.view-chat .bmc-facilitator,
.bmc-overlay.view-canvas .bmc-canvas-area {
  animation: bmcViewFadeIn 0.3s 0.05s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes bmcViewFadeIn {
  from { opacity: 0; transform: scale(1.02); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Block validated celebration ── */
@keyframes bmcCelebrate {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  50%  { box-shadow: 0 0 0 12px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.bmc-block.just-validated {
  animation: bmcCelebrate 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Improved block pulse ── */
@keyframes blockPulseV2 {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(232, 115, 74, 0.15), 0 0 32px rgba(232, 115, 74, 0.1);
    border-color: #e8734a;
  }
  50% {
    box-shadow: 0 0 0 8px rgba(232, 115, 74, 0.05), 0 0 48px rgba(232, 115, 74, 0.18);
    border-color: #f4a261;
  }
}

.bmc-block.state-active {
  animation: blockPulseV2 2.5s ease-in-out infinite;
}

/* ── Canvas toolbar slide ── */
@keyframes bmcToolbarSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bmc-canvas-toolbar {
  animation: bmcToolbarSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Message bubble improve ── */
@keyframes bmcMsgInV2 {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bmc-msg {
  animation: bmcMsgInV2 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Chip hover pop ── */
.bmc-chip {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bmc-chip:active {
  transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .bmc-overlay,
  .bmc-block,
  .bmc-msg,
  .bmc-canvas-area,
  .bmc-typing .dot,
  .bmc-chip,
  .bmc-fac-send,
  .bmc-mode-btn,
  .bmc-export-overlay {
    animation: none !important;
    transition: none !important;
  }

  .bmc-block.state-active {
    animation: none !important;
    box-shadow: 0 0 0 3px rgba(232, 115, 74, 0.15), 0 4px 12px rgba(232, 115, 74, 0.08) !important;
  }
}

/* ── Print / PDF Export ── */
@media print {
  body > *:not(.bmc-export-overlay),
  .bg-warm, nav, footer, .bottom-bar, .container,
  .hero, .section, .cta-section, .wave-divider, .scroll-indicator,
  .bmc-overlay {
    display: none !important;
  }

  .bmc-export-overlay {
    position: static !important;
    background: #fff !important;
    display: block !important;
    animation: none !important;
    overflow: visible !important;
  }

  .bmc-export-modal {
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 24px !important;
    border-radius: 0 !important;
    page-break-inside: avoid;
  }

  .bmc-export-modal h2 { font-size: 20px; }
  .bmc-export-actions { display: none !important; }
  .bmc-export-grid { border: 2px solid #333 !important; }

  @page {
    margin: 12mm;
    size: landscape;
  }
}
