/* ─────────────────────────────────────────────────────────────────────────
 * Eligentia v8 · caller.css
 * Estilos compartidos para los 4 HTMLs llamadores (Your Aims, Your Business,
 * Market Demand, Industry Supply). Port de los componentes de Lovable
 * YourAimsPage.tsx / YourBusinessPage.tsx (template idéntico).
 * ───────────────────────────────────────────────────────────────────────── */

body.caller-page {
  background-color: var(--gray-50);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}

/* Background image específico por bloque — convención kebab-case unificada
   strategy-<block-kebab>.png. Si un archivo no existe, queda solo el
   background-color gris (sin error visible). */
body.caller-page[data-block="S1"] { background-image: url('../img/strategy-your-business.png'); }
body.caller-page[data-block="S2"] { background-image: url('../img/strategy-your-aims.png'); }
body.caller-page[data-block="S3"] { background-image: url('../img/strategy-market-demand.png'); }
body.caller-page[data-block="S4"] { background-image: url('../img/strategy-industry-supply.png'); }
body.caller-page[data-block="S5"] { background-image: url('../img/strategy-current-competitiveness.png'); }
body.caller-page[data-block="S6"] { background-image: url('../img/strategy-target-competitiveness.png'); }
body.caller-page[data-block="S7"] { background-image: url('../img/strategy-business-strategy.png'); }
body.caller-page[data-block="S8"] { background-image: url('../img/strategy-corporate-strategy.png'); }
body.caller-page[data-block="S9"] { background-image: url('../img/strategy-risk-opportunity.png'); }

/* Velo blanco semitransparente sobre el fondo para asegurar legibilidad
   de las cards, manteniendo la imagen visible. */
body.caller-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(247, 246, 242, .55) 0%, rgba(247, 246, 242, .82) 100%);
  z-index: 0;
  pointer-events: none;
}
body.caller-page .site-header,
body.caller-page main { position: relative; z-index: 1; }

.cl-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px);
}

/* Volver a la pirámide */
.cl-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-700);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color var(--t-fast);
}
.cl-back:hover { color: var(--accent); text-decoration: none; }
.cl-back svg { width: 14px; height: 14px; }

/* Header del bloque */
.cl-block-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.cl-block-badge {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .04em;
}
.cl-block-name {
  font-family: var(--ff-display);
  font-size: clamp(22px, 3vw, 32px);
  color: var(--gray-900);
  letter-spacing: -.01em;
}
.cl-block-meta {
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 24px;
}

/* Lista de tools — cada una ocupa toda la fila */
.cl-tool-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cl-tool {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(4px);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.cl-tool:hover {
  box-shadow: 0 8px 22px rgba(83, 74, 183, .10);
  border-color: var(--accent);
}

/* Imagen / thumbnail del tool */
.cl-tool-thumb {
  position: relative;
  flex-shrink: 0;
  width: 88px; height: 88px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
/* Fallback: ID renderizado debajo. Si la imagen carga, queda tapado. */
.cl-tool-thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  pointer-events: none;
}
/* Imagen real: posicionada en absoluto encima del fallback. */
.cl-tool-thumb img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: rgba(0,0,0,.04);
  padding: 4px;
  z-index: 1;
}
@media (max-width: 640px) {
  .cl-tool-thumb { width: 64px; height: 64px; font-size: 11px; }
}

/* Contenido clicable (lleva al programa v8) */
.cl-tool-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.cl-tool-main:hover { background: var(--accent-soft); padding: 6px 8px; margin: -6px -8px; }
.cl-tool-id {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: .04em;
}
.cl-tool-title {
  font-weight: 600;
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--accent);
  line-height: 1.25;
  margin-top: 2px;
  margin-bottom: 6px;
}
.cl-tool-summary {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Botones de acción */
.cl-tool-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 110px;
  align-items: stretch;
}
@media (max-width: 640px) {
  .cl-tool { flex-direction: column; }
  .cl-tool-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; width: 100%; }
  .cl-tool-actions button { flex: 1 1 100px; }
}
.cl-tool-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--gray-100);
  background: var(--white);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
}
.cl-tool-actions button svg { width: 14px; height: 14px; }
.cl-tool-actions .cl-btn-help:hover     { background: #534AB7; color: var(--white); border-color: #534AB7; }
.cl-tool-actions .cl-btn-autodemo:hover { background: #1D9E75; color: var(--white); border-color: #1D9E75; }
.cl-tool-actions .cl-btn-video:hover    { background: #E24B4A; color: var(--white); border-color: #E24B4A; }

/* Status pill (indica si la tool está activa, en preview, o coming) */
.cl-tool-status {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.cl-tool-status.active  { background: #DCFCE7; color: #166534; }
.cl-tool-status.preview { background: #FEF3C7; color: #854D0E; }
.cl-tool-status.coming  { background: var(--gray-100); color: var(--gray-700); }

/* ─── Modal Help ───────────────────────────────────────────────────────── */
.cl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cl-modal-overlay[data-open="1"] { display: flex; }
.cl-modal {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-xl);
  max-width: 720px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: cl-modal-in .15s ease-out;
}
@keyframes cl-modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.cl-modal-head {
  position: sticky;
  top: 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 18px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 1;
}
.cl-modal-eye {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: .04em;
}
.cl-modal-title {
  font-family: var(--ff-display);
  font-size: 20px;
  color: var(--accent);
  margin-top: 4px;
}
.cl-modal-close {
  flex-shrink: 0;
  background: none;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--gray-700);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast);
}
.cl-modal-close:hover { background: var(--gray-100); }
.cl-modal-close svg { width: 18px; height: 18px; }
.cl-modal-body {
  padding: 18px 24px 24px;
  display: flex; flex-direction: column; gap: 16px;
  font-size: 13px; line-height: 1.6;
  color: var(--gray-800);
}
.cl-modal-body section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}
.cl-modal-body section p {
  color: var(--gray-700);
  white-space: pre-line;
}
.cl-modal-related {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
}
.cl-modal-related a {
  display: inline-block;
  font-family: monospace;
  font-size: 11px; font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: all var(--t-fast);
}
.cl-modal-related a:hover {
  background: var(--accent);
  color: var(--white);
  text-decoration: none;
}

/* ─── Toast (mensaje flotante) ───────────────────────────────────────── */
.cl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  padding: 12px 18px;
  background: var(--gray-900);
  color: var(--white);
  border-radius: var(--r-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity .2s, transform .2s;
  max-width: 90vw;
  text-align: center;
}
.cl-toast[data-visible="1"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.cl-toast.warn { background: #BA7517; }
.cl-toast.err  { background: #A52826; }
.cl-toast.ok   { background: #0F6E56; }
