/* Pro-Lease Chat Widget — Matches dark/charcoal site theme */

:root {
  --plc-dark:      #1a1e24;
  --plc-darker:    #141720;
  --plc-blue:      #1e5fa8;
  --plc-blue-mid:  #2d7dd2;
  --plc-blue-lite: #4a9eff;
  --plc-border:    rgba(255,255,255,0.08);
  --plc-text:      #e8ecf0;
  --plc-muted:     #8a97a8;
  --plc-radius:    12px;
  --plc-shadow:    0 8px 40px rgba(0,0,0,0.55), 0 2px 12px rgba(0,0,0,0.3);
}

/* ── Launcher Button ─────────────────────────── */
#plc-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--plc-blue) 0%, var(--plc-blue-mid) 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(30, 95, 168, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 99998;
}
#plc-launcher:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(30, 95, 168, 0.7);
}
#plc-launcher svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: opacity 0.15s;
}
#plc-launcher .plc-icon-close { display: none; }
#plc-launcher.is-open .plc-icon-chat  { display: none; }
#plc-launcher.is-open .plc-icon-close { display: block; }

/* Unread badge */
#plc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e84545;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  border: 2px solid #fff;
}
#plc-badge.visible { display: flex; }

/* ── Chat Window ─────────────────────────────── */
#plc-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-height: 540px;
  background: var(--plc-dark);
  border: 1px solid var(--plc-border);
  border-radius: var(--plc-radius);
  box-shadow: var(--plc-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99997;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Hidden state */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#plc-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ──────────────────────────────────── */
#plc-header {
  background: linear-gradient(135deg, #17305a 0%, var(--plc-blue) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
#plc-header-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#plc-header-icon svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}
#plc-header-text { flex: 1; }
#plc-header-title {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.2;
}
#plc-header-sub {
  color: rgba(255,255,255,0.65);
  font-size: 11px;
  margin-top: 1px;
}
#plc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3de070;
  box-shadow: 0 0 6px rgba(61, 224, 112, 0.6);
  flex-shrink: 0;
}

/* ── Messages ────────────────────────────────── */
#plc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
#plc-messages::-webkit-scrollbar { width: 4px; }
#plc-messages::-webkit-scrollbar-track { background: transparent; }
#plc-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.plc-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.plc-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.07);
  color: var(--plc-text);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--plc-border);
}
.plc-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--plc-blue) 0%, var(--plc-blue-mid) 100%);
  color: #fff;
  border-bottom-right-radius: 3px;
}

/* Typing indicator */
.plc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--plc-border);
  border-radius: 10px;
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}
.plc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--plc-muted);
  animation: plcBounce 1.2s infinite;
}
.plc-typing span:nth-child(2) { animation-delay: 0.2s; }
.plc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes plcBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input Area ──────────────────────────────── */
#plc-input-area {
  padding: 12px 14px;
  background: var(--plc-darker);
  border-top: 1px solid var(--plc-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
#plc-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--plc-border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--plc-text);
  font-size: 13.5px;
  line-height: 1.4;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 90px;
  transition: border-color 0.15s;
}
#plc-input::placeholder { color: var(--plc-muted); }
#plc-input:focus { border-color: var(--plc-blue-mid); }

#plc-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--plc-blue) 0%, var(--plc-blue-mid) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}
#plc-send:hover { opacity: 0.88; transform: scale(1.05); }
#plc-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
#plc-send svg { width: 16px; height: 16px; fill: #fff; }

/* ── Footer ──────────────────────────────────── */
#plc-footer {
  text-align: center;
  padding: 6px 14px 10px;
  font-size: 10.5px;
  color: var(--plc-muted);
  background: var(--plc-darker);
  border-top: 1px solid var(--plc-border);
}
#plc-footer a {
  color: var(--plc-blue-lite);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 420px) {
  #plc-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 88px;
  }
  #plc-launcher {
    right: 16px;
    bottom: 16px;
  }
}
