/* ROC Electric AI Chat Widget */
.roc-chat-root {
  --roc-bg: #0f0f10;
  --roc-surface: #1a1a1c;
  --roc-surface-2: #232326;
  --roc-border: #2e2e33;
  --roc-text: #f5f5f5;
  --roc-muted: #a1a1aa;
  --roc-accent: hsl(45 95% 55%);
  --roc-accent-hover: hsl(45 95% 62%);
  --roc-accent-fg: #0a0a0a;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.roc-chat-button {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--roc-accent);
  color: var(--roc-accent-fg);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s, background .2s;
  position: relative;
}
.roc-chat-button:hover { background: var(--roc-accent-hover); transform: scale(1.06); }
.roc-chat-button svg { width: 28px; height: 28px; }
.roc-chat-button .roc-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--roc-accent); opacity: .4;
  animation: roc-pulse 2s infinite;
  pointer-events: none;
}
@keyframes roc-pulse {
  0% { transform: scale(1); opacity: .4; }
  100% { transform: scale(1.6); opacity: 0; }
}

.roc-chat-window {
  position: absolute;
  bottom: 76px; right: 0;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px);
  background: var(--roc-bg);
  color: var(--roc-text);
  border-radius: 14px;
  border: 1px solid var(--roc-border);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: roc-slide-up .25s ease-out;
}
.roc-chat-root.open .roc-chat-window { display: flex; }
.roc-chat-root.open .roc-chat-button { display: none; }

@keyframes roc-slide-up {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.roc-chat-header {
  background: linear-gradient(135deg, #1a1a1c 0%, #232326 100%);
  border-bottom: 1px solid var(--roc-border);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.roc-chat-header .roc-avatar {
  width: 38px; height: 38px; border-radius: 8px;
  background: #000; color: var(--roc-accent-fg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  border: 1px solid var(--roc-accent);
}
.roc-chat-header .roc-avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.roc-chat-header .roc-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px; letter-spacing: .08em; line-height: 1.1;
  margin: 0;
}
.roc-chat-header .roc-sub {
  font-size: 11px; color: var(--roc-muted);
  display: flex; align-items: center; gap: 6px;
}
.roc-chat-header .roc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 6px #22c55e;
}
.roc-chat-header-meta { flex: 1; min-width: 0; }
.roc-chat-actions { display: flex; gap: 4px; }
.roc-icon-btn {
  background: transparent; border: none; color: var(--roc-muted);
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.roc-icon-btn:hover { background: var(--roc-surface-2); color: var(--roc-text); }
.roc-icon-btn svg { width: 16px; height: 16px; }

.roc-chat-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--roc-border) transparent;
}
.roc-chat-body::-webkit-scrollbar { width: 6px; }
.roc-chat-body::-webkit-scrollbar-thumb { background: var(--roc-border); border-radius: 3px; }

.roc-msg { max-width: 85%; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.roc-msg.user {
  align-self: flex-end;
  background: var(--roc-accent);
  color: var(--roc-accent-fg);
  border-bottom-right-radius: 4px;
}
.roc-msg.assistant {
  align-self: flex-start;
  background: var(--roc-surface);
  color: var(--roc-text);
  border: 1px solid var(--roc-border);
  border-bottom-left-radius: 4px;
}
.roc-msg.assistant a { color: var(--roc-accent); text-decoration: underline; }
.roc-msg.assistant p { margin: 0 0 8px; }
.roc-msg.assistant p:last-child { margin: 0; }
.roc-msg.assistant ul, .roc-msg.assistant ol { margin: 4px 0 8px 18px; padding: 0; }

.roc-typing {
  align-self: flex-start;
  background: var(--roc-surface);
  border: 1px solid var(--roc-border);
  border-radius: 12px; border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex; gap: 4px;
}
.roc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--roc-muted);
  animation: roc-bounce 1.2s infinite ease-in-out;
}
.roc-typing span:nth-child(2) { animation-delay: .15s; }
.roc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes roc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.roc-quick {
  padding: 0 16px 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.roc-quick button {
  background: var(--roc-surface);
  color: var(--roc-text);
  border: 1px solid var(--roc-border);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  font-family: inherit;
}
.roc-quick button:hover {
  border-color: var(--roc-accent);
  color: var(--roc-accent);
}

.roc-chat-form {
  border-top: 1px solid var(--roc-border);
  padding: 12px;
  display: flex; gap: 8px;
  background: var(--roc-bg);
}
.roc-chat-form textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 120px;
  background: var(--roc-surface);
  color: var(--roc-text);
  border: 1px solid var(--roc-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.roc-chat-form textarea:focus { border-color: var(--roc-accent); }
.roc-chat-form button {
  background: var(--roc-accent);
  color: var(--roc-accent-fg);
  border: none;
  border-radius: 10px;
  width: 44px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.roc-chat-form button:hover:not(:disabled) { background: var(--roc-accent-hover); }
.roc-chat-form button:disabled { opacity: .5; cursor: not-allowed; }
.roc-chat-form button svg { width: 18px; height: 18px; }

/* Lead capture form */
.roc-lead-form {
  align-self: stretch;
  background: var(--roc-surface);
  border: 1px solid var(--roc-border);
  border-radius: 12px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.roc-lead-form h4 {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: .06em; font-size: 15px; margin: 0 0 4px;
}
.roc-lead-form input, .roc-lead-form select, .roc-lead-form textarea {
  background: var(--roc-bg);
  border: 1px solid var(--roc-border);
  color: var(--roc-text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.roc-lead-form input:focus, .roc-lead-form select:focus, .roc-lead-form textarea:focus { border-color: var(--roc-accent); }
.roc-lead-form textarea { min-height: 60px; resize: vertical; }
.roc-lead-form .roc-row { display: flex; gap: 6px; }
.roc-lead-form .roc-row > * { flex: 1; min-width: 0; }
.roc-lead-form .roc-submit {
  background: var(--roc-accent); color: var(--roc-accent-fg);
  border: none; padding: 10px; border-radius: 8px;
  font-family: 'Bebas Neue', sans-serif; letter-spacing: .08em; font-size: 14px;
  cursor: pointer; transition: background .15s;
}
.roc-lead-form .roc-submit:hover:not(:disabled) { background: var(--roc-accent-hover); }
.roc-lead-form .roc-submit:disabled { opacity: .6; cursor: not-allowed; }
.roc-lead-form .roc-cancel {
  background: transparent; border: none; color: var(--roc-muted);
  font-size: 12px; cursor: pointer; padding: 4px;
}
.roc-lead-form .roc-cancel:hover { color: var(--roc-text); }
.roc-lead-error { color: #f87171; font-size: 12px; }

/* Mobile: full-screen chat, button stays floating but shifts above sticky call */
@media (max-width: 640px) {
  .roc-chat-window {
    position: fixed;
    inset: 0;
    width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh;
    border-radius: 0; border: none;
    bottom: 0; right: 0;
  }
}
/* Avoid the sticky CALL NOW button on small/medium screens (it's lg:hidden, so <1024px) */
@media (max-width: 1023px) {
  .roc-chat-root { bottom: 96px; }
}