/* ============================================
   NexusLaR Chat — chat.css
   ============================================ */

/* Importar fuente */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

/* ─── Variables ─────────────────────────────── */
#cam-wrapper * {
  box-sizing: border-box;
  font-family: 'DM Sans', system-ui, sans-serif;
}

#cam-wrapper {
  --cam-bg:         #ffffff;
  --cam-surface:    #f7f8fa;
  --cam-border:     #e4e7ec;
  --cam-accent:     #155987;
  --cam-accent2:    #155987;
  --cam-text:       #0b0e16;
  --cam-text-muted: #6b7280;
  --cam-radius:     14px;
  --cam-shadow:     0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
  --cam-bubble-sz:  60px;

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ─── Burbuja flotante ───────────────────────── */
#cam-bubble {
  width:  var(--cam-bubble-sz);
  height: var(--cam-bubble-sz);
  border-radius: 50%;
  background: var(--cam-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(26,26,46,.35);
  transition: transform .2s ease, box-shadow .2s ease;
  color: #fff;
  flex-shrink: 0;
}
#cam-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26,26,46,.45);
}
#cam-wrapper #cam-bubble svg { 
  width: 28px !important; 
  height: 28px !important; 
  min-width: 28px;
  min-height: 28px;
  display: block;
}
#cam-wrapper #cam-bubble #cam-icon-open { 
  width: 28px !important; 
  height: 28px !important; 
  display: block;
}

#cam-wrapper #cam-bubble #cam-icon-close { 
  width: 28px !important; 
  height: 28px !important; 
  display: none;
}

#cam-wrapper.cam-open #cam-bubble #cam-icon-open { display: none; }
#cam-wrapper.cam-open #cam-bubble #cam-icon-close { display: block; }


/* Animación de entrada de la burbuja */
#cam-bubble { animation: camBubblePop .4s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes camBubblePop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Toggle icons */
#cam-icon-close { display: none; }
#cam-wrapper.cam-open #cam-icon-open  { display: none; }
#cam-wrapper.cam-open #cam-icon-close { display: block; }

/* ─── Panel ──────────────────────────────────── */
#cam-panel {
  position: absolute;
  bottom: calc(var(--cam-bubble-sz) + 12px);
  right: 0;
  width: 360px;
  max-height: 560px;
  background: var(--cam-bg);
  border-radius: var(--cam-radius);
  box-shadow: var(--cam-shadow);
  border: 1px solid var(--cam-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* cerrado */
  transform: scale(.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.3,.64,1), opacity .2s ease;
  transform-origin: bottom right;
}
#cam-wrapper.cam-open #cam-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ─── Header ─────────────────────────────────── */
#cam-header {
  background: var(--cam-accent);
  color: #fff;
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#cam-header-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#cam-header-icon svg { width: 18px; height: 18px; }
#cam-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
}
#cam-subtitle {
  font-size: 12px;
  opacity: .7;
  display: block;
  margin-top: 1px;
}
#cam-close-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
#cam-close-btn:hover { color: #fff; background: rgba(255,255,255,.12); }
#cam-close-btn svg { width: 16px; height: 16px; }

/* ─── Breadcrumb ─────────────────────────────── */
#cam-breadcrumb {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--cam-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--cam-border);
  flex-wrap: wrap;
}
.cam-bc-item {
  cursor: pointer;
  transition: color .15s;
}
.cam-bc-item:hover { color: var(--cam-accent2); text-decoration: underline; }
.cam-bc-sep { color: var(--cam-border); }
.cam-bc-current { color: var(--cam-text); font-weight: 500; cursor: default; }
.cam-bc-current:hover { text-decoration: none; color: var(--cam-text); }

/* ─── Contenido ──────────────────────────────── */
#cam-content {
  overflow-y: auto;
  flex: 1;
  padding: 14px 12px;
  scroll-behavior: smooth;
}
#cam-content::-webkit-scrollbar { width: 4px; }
#cam-content::-webkit-scrollbar-track { background: transparent; }
#cam-content::-webkit-scrollbar-thumb { background: var(--cam-border); border-radius: 4px; }

/* Sección de módulos */
.cam-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cam-text-muted);
  margin: 4px 2px 10px;
}

/* Grid de módulos */
.cam-modules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}
.cam-module-card {
  background: var(--cam-surface);
  border: 1px solid var(--cam-border);
  border-radius: 10px;
  padding: 14px 12px 12px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cam-module-card:hover {
  border-color: var(--cam-accent2);
  box-shadow: 0 2px 12px rgba(79,70,229,.1);
  transform: translateY(-1px);
}
.cam-module-icon {
  width: 36px; height: 36px;
  background: var(--cam-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.cam-module-icon svg { width: 18px; height: 18px; }
.cam-module-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cam-text);
  line-height: 1.3;
}

/* ─── Vista de módulo: secciones / acordeón ──── */
.cam-module-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--cam-text);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cam-section-group { margin-bottom: 14px; }
.cam-section-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--cam-text-muted);
  margin: 0 0 6px 2px;
}

/* Acordeón */
.cam-accordion { display: flex; flex-direction: column; gap: 4px; }
.cam-item {
  border: 1px solid var(--cam-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .2s;
}
.cam-item.cam-item-open { border-color: #c7d2fe; }
.cam-item-btn {
  width: 100%;
  text-align: left;
  background: var(--cam-surface);
  border: none;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cam-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background .15s;
}
.cam-item-btn:hover { background: #eff0f5; }
.cam-item.cam-item-open .cam-item-btn { background: #eef2ff; color: var(--cam-accent2); }
.cam-item-chevron {
  width: 14px; height: 14px;
  flex-shrink: 0;
  transition: transform .2s;
  color: var(--cam-text-muted);
}
.cam-item.cam-item-open .cam-item-chevron { transform: rotate(180deg); }
.cam-item-body {
  display: none;
  padding: 10px 12px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--cam-text);
  background: #fff;
  border-top: 1px solid var(--cam-border);
}
.cam-item.cam-item-open .cam-item-body { display: block; }
.cam-item-body p { margin: 0 0 8px; }
.cam-item-body p:last-child { margin-bottom: 0; }
.cam-item-body ul { margin: 6px 0; padding-left: 18px; }
.cam-item-body li { margin-bottom: 4px; }
.cam-item-body strong { font-weight: 600; }

/* ─── Botón WhatsApp ─────────────────────────── */
.cam-wa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .2s, border-color .2s, box-shadow .2s, transform .15s;
}
.cam-wa-btn:hover {
  background: #dcfce7;
  border-color: #4ade80;
  box-shadow: 0 2px 12px rgba(34,197,94,.15);
  transform: translateY(-1px);
}
.cam-wa-icon {
  width: 36px;
  height: 36px;
  background: #25d366;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.cam-wa-icon svg { width: 20px; height: 20px; }
.cam-wa-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.cam-wa-label {
  font-size: 11px;
  color: #16a34a;
  font-weight: 500;
}
.cam-wa-cta {
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cam-wa-arrow {
  color: #4ade80;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cam-wa-arrow svg { width: 15px; height: 15px; }

/* ─── Estado vacío / cargando ────────────────── */
.cam-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--cam-text-muted);
  font-size: 13px;
}
.cam-empty svg { width: 32px; height: 32px; margin: 0 auto 8px; display: block; opacity: .4; }
.cam-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--cam-border);
  border-top-color: var(--cam-accent2);
  border-radius: 50%;
  animation: camSpin .7s linear infinite;
  margin: 28px auto;
}
@keyframes camSpin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 400px) {
  #cam-wrapper { bottom: 16px; right: 16px; }
  #cam-panel { width: calc(100vw - 32px); }
}
