/* Cámara de Representantes PR — Chat Widget Styles
   Import or enqueue this file in your WordPress theme / plugin. */

:root {
  --camara-primary: #171D26;      /* deep blue — legislative */
  --camara-accent:  #c8a951;      /* gold accent */
  --camara-bg:      #ffffff;
  --camara-surface: #f4f6f9;
  --camara-border:  #dde2ea;
  --camara-text:    #1a1a2e;
  --camara-muted:   #6b7280;
  --camara-radius:  12px;
  --camara-shadow:  0 8px 32px rgba(10, 49, 97, 0.18);
  --camara-z:       99999;
}

/* ── Floating trigger button ─────────────────────────────────────────────── */
#camara-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--camara-z);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--camara-primary);
  border: 3px solid var(--camara-accent);
  cursor: pointer;
  box-shadow: var(--camara-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  padding: 0;
}

#camara-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(10, 49, 97, 0.28);
}

#camara-chat-btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: opacity 0.2s;
}

/* ── Chat window ─────────────────────────────────────────────────────────── */
#camara-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: var(--camara-z);
  width: 444px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--camara-bg);
  border-radius: var(--camara-radius);
  box-shadow: var(--camara-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
}

#camara-chat-window.camara-hidden {
  transform: scale(0.85) translateY(16px);
  opacity: 0;
  pointer-events: none;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.camara-header {
  background: var(--camara-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.camara-header-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--camara-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.camara-header-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--camara-primary);
}

.camara-header-text {
  flex: 1;
}

.camara-header-title {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.camara-header-subtitle {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  opacity: 0.75;
  margin: 0;
}

.camara-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  opacity: 0.7;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.camara-close-btn:hover { opacity: 1; }

.camara-close-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ── Messages area ───────────────────────────────────────────────────────── */
.camara-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--camara-surface);
  scroll-behavior: smooth;
}

.camara-messages::-webkit-scrollbar { width: 5px; }
.camara-messages::-webkit-scrollbar-track { background: transparent; }
.camara-messages::-webkit-scrollbar-thumb { background: var(--camara-border); border-radius: 4px; }

/* ── Message bubbles ─────────────────────────────────────────────────────── */
.camara-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: camara-fade-in 0.2s ease;
}

@keyframes camara-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.camara-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.camara-msg.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.camara-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--camara-text);
  word-break: break-word;
}

.camara-msg.user .camara-bubble {
  background: var(--camara-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.camara-msg.bot .camara-bubble {
  background: #fff;
  border: 1px solid var(--camara-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Sources ─────────────────────────────────────────────────────────────── */
.camara-sources {
  margin-top: 6px;
  font-size: 11px;
  color: var(--camara-muted);
  font-family: system-ui, -apple-system, sans-serif;
}

.camara-sources summary {
  cursor: pointer;
  user-select: none;
  color: var(--camara-primary);
  font-weight: 600;
}

.camara-sources a {
  display: block;
  margin-top: 3px;
  color: var(--camara-primary);
  text-decoration: underline;
  word-break: break-all;
}

.camara-sources a:hover { color: var(--camara-accent); }

/* ── Loading dots ────────────────────────────────────────────────────────── */
.camara-loading .camara-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.camara-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--camara-muted);
  animation: camara-bounce 1.2s infinite ease-in-out;
}

.camara-dot:nth-child(1) { animation-delay: 0s; }
.camara-dot:nth-child(2) { animation-delay: 0.18s; }
.camara-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes camara-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* ── Input area ──────────────────────────────────────────────────────────── */
.camara-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--camara-border);
  background: var(--camara-bg);
  flex-shrink: 0;
}

.camara-input {
  flex: 1;
  border: 1.5px solid var(--camara-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  color: var(--camara-text);
  background: var(--camara-surface);
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.15s;
  overflow-y: auto;
}

.camara-input:focus { border-color: var(--camara-primary); }
.camara-input::placeholder { color: var(--camara-muted); }

.camara-send-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--camara-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.camara-send-btn:hover:not(:disabled) {
  background: #171D26;
  transform: scale(1.05);
}

.camara-send-btn:disabled {
  background: var(--camara-border);
  cursor: not-allowed;
}

.camara-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ── Footer disclaimer ───────────────────────────────────────────────────── */
.camara-disclaimer {
  text-align: center;
  font-size: 10px;
  color: var(--camara-muted);
  padding: 4px 14px 8px;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--camara-bg);
  flex-shrink: 0;
}

/* ── Mobile tweaks ───────────────────────────────────────────────────────── */
@media (max-width: 420px) {
  #camara-chat-window {
    right: 8px;
    bottom: 84px;
    width: calc(100vw - 16px);
    height: calc(100vh - 100px);
    border-radius: 12px;
  }

  #camara-chat-btn {
    right: 16px;
    bottom: 16px;
  }
}
