/* ===== nol3m Representante Digital — Widget flotante ===== */

#nol3m-rep-root {
  --rep-accent: #39ff14;
  --rep-bg: #0a0a0a;
  --rep-bg-2: #141414;
  --rep-text: #ffffff;
  --rep-muted: #9ca3af;
  --rep-border: rgba(57, 255, 20, 0.25);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#nol3m-rep-root *,
#nol3m-rep-root *::before,
#nol3m-rep-root *::after {
  box-sizing: border-box;
}

/* ---------- Pestaña lateral "Calcula tu precio" ---------- */
#nol3m-rep-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 999998;
  background: linear-gradient(135deg, #2bdb0c 0%, #39ff14 50%, #54ff3a 100%);
  color: #001a00;
  border: none;
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
  padding: 22px 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  box-shadow:
    0 0 24px rgba(57, 255, 20, 0.55),
    0 0 48px rgba(57, 255, 20, 0.35),
    inset 0 0 12px rgba(255, 255, 255, 0.25),
    -4px 0 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, padding 0.25s ease;
  animation: rep-tab-glow 2.6s ease-in-out infinite;
}
#nol3m-rep-tab:hover {
  transform: translateY(-50%) translateX(-4px);
  padding: 24px 14px;
  box-shadow:
    0 0 32px rgba(57, 255, 20, 0.85),
    0 0 64px rgba(57, 255, 20, 0.55),
    inset 0 0 14px rgba(255, 255, 255, 0.35),
    -6px 0 20px rgba(0, 0, 0, 0.45);
}
#nol3m-rep-tab .rep-tab-text {
  position: relative;
  z-index: 2;
  transform: rotate(180deg);
  display: inline-block;
}
#nol3m-rep-tab .rep-tab-shine {
  position: absolute;
  top: -50%;
  left: -100%;
  width: 60%;
  height: 200%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: rep-tab-shine 3.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes rep-tab-shine {
  0%   { left: -100%; }
  60%  { left: 140%; }
  100% { left: 140%; }
}
@keyframes rep-tab-glow {
  0%, 100% {
    box-shadow:
      0 0 24px rgba(57, 255, 20, 0.55),
      0 0 48px rgba(57, 255, 20, 0.35),
      inset 0 0 12px rgba(255, 255, 255, 0.25),
      -4px 0 16px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 32px rgba(57, 255, 20, 0.8),
      0 0 64px rgba(57, 255, 20, 0.5),
      inset 0 0 16px rgba(255, 255, 255, 0.35),
      -4px 0 16px rgba(0, 0, 0, 0.35);
  }
}

/* Cuando el panel está abierto, ocultamos la pestaña */
#nol3m-rep-root.is-open #nol3m-rep-tab {
  transform: translateY(-50%) translateX(110%);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Panel del chat (desliza desde la derecha) ---------- */
#nol3m-rep-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, rgba(15,15,15,0.97), rgba(7,7,7,0.97));
  border-left: 1px solid var(--rep-border);
  box-shadow: -20px 0 60px rgba(0,0,0,0.7), inset 0 0 20px rgba(57,255,20,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  color: var(--rep-text);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
#nol3m-rep-panel.is-open { transform: translateX(0); }

@media (max-width: 480px) {
  #nol3m-rep-panel { width: 100vw; }
  #nol3m-rep-tab { padding: 18px 10px; font-size: 12px; letter-spacing: 1px; }
}

/* ---------- Header ---------- */
.rep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.3);
}
.rep-header-left { display: flex; align-items: center; gap: 12px; }
.rep-header-logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--rep-accent);
  color: #000;
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 14px rgba(57,255,20,0.5);
}
.rep-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(90deg, #fff, var(--rep-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.rep-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--rep-muted); }
.rep-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rep-accent);
  box-shadow: 0 0 8px var(--rep-accent);
  animation: rep-blink 1.6s ease-in-out infinite;
}
@keyframes rep-blink { 50% { opacity: 0.5; } }

.rep-close-btn {
  background: transparent;
  border: none;
  color: var(--rep-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.rep-close-btn:hover { color: var(--rep-text); background: rgba(255,255,255,0.06); }

/* ---------- Mensajes ---------- */
.rep-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(57,255,20,0.3) transparent;
}
.rep-messages::-webkit-scrollbar { width: 6px; }
.rep-messages::-webkit-scrollbar-thumb { background: rgba(57,255,20,0.25); border-radius: 3px; }

.rep-msg { display: flex; flex-direction: column; gap: 10px; max-width: 92%; }
.rep-msg.user { align-self: flex-end; align-items: flex-end; }
.rep-msg.ai   { align-self: flex-start; align-items: flex-start; }

.rep-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.rep-msg.user .rep-bubble {
  background: var(--rep-accent);
  color: #000;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}
.rep-msg.ai .rep-bubble {
  background: rgba(255,255,255,0.05);
  color: var(--rep-text);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 4px;
}

/* Botones rápidos */
.rep-quick-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.rep-quick-btn {
  background: rgba(57,255,20,0.06);
  border: 1px solid rgba(57,255,20,0.25);
  color: var(--rep-accent);
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.rep-quick-btn:hover {
  background: rgba(57,255,20,0.18);
  border-color: rgba(57,255,20,0.5);
}

/* Tarjeta precontrato */
.rep-contract {
  background: rgba(10,10,10,0.6);
  border: 1px solid var(--rep-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), inset 0 0 12px rgba(57,255,20,0.05);
}
.rep-contract-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.rep-contract-head h3 {
  margin: 0; font-size: 13px; color: #fff; font-weight: 600;
  letter-spacing: 1px;
}
.rep-contract-body {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  background: rgba(0,0,0,0.35);
  padding: 12px;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 14px;
}
.rep-contract-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rep-contract-btn {
  flex: 1 1 120px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s ease;
  border: none;
}
.rep-contract-btn.primary { background: var(--rep-accent); color: #000; }
.rep-contract-btn.primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.rep-contract-btn.secondary {
  background: transparent;
  border: 1px solid rgba(57,255,20,0.4);
  color: var(--rep-accent);
}
.rep-contract-btn.secondary:hover { background: rgba(57,255,20,0.1); }

/* Loader */
.rep-loader {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
}
.rep-loader-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rep-accent);
  animation: rep-bounce 1.4s ease-in-out infinite both;
}
.rep-loader-dot:nth-child(1) { animation-delay: -0.32s; }
.rep-loader-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes rep-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40%           { transform: scale(1);  opacity: 1; }
}

/* Input */
.rep-input-area {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.3);
}
.rep-input-form { display: flex; gap: 8px; }
.rep-input-form input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--rep-text);
  padding: 11px 14px;
  border-radius: 100px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: inherit;
}
.rep-input-form input::placeholder { color: var(--rep-muted); }
.rep-input-form input:focus { border-color: var(--rep-accent); }
.rep-input-form input:disabled { opacity: 0.5; cursor: not-allowed; }

.rep-send-btn {
  background: var(--rep-accent);
  border: none;
  color: #000;
  width: 42px; height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.rep-send-btn:hover:not(:disabled) { filter: brightness(1.15); transform: scale(1.05); }
.rep-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rep-send-btn svg { transform: rotate(90deg); }
