/* ==========================================================================
   JIM CHEN RESEARCH — AI ASSISTANT STYLES
   ========================================================================== */

#jcr-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  background: linear-gradient(135deg, #d4a847, #f0c55a);
  color: #0a0c10;
  border: none;
  border-radius: 100px;
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(212, 168, 71, 0.35), 0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
}
#jcr-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(212, 168, 71, 0.5), 0 2px 8px rgba(0,0,0,0.5);
}
#jcr-chat-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85) translateY(8px);
}
.jcr-chat-label {
  font-size: 13px;
  letter-spacing: 0.3px;
}
@media (max-width: 480px) {
  .jcr-chat-label { display: none; }
  #jcr-chat-toggle {
    padding: 12px;
    bottom: 14px;
    right: 14px;
    box-shadow: 0 3px 14px rgba(212, 168, 71, 0.3), 0 1px 3px rgba(0,0,0,0.4);
  }
  #jcr-chat-toggle svg { width: 20px; height: 20px; }
}

#jcr-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: #12161d;
  border: 1px solid rgba(212, 168, 71, 0.25);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  color: #e8eaed;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 4px 16px rgba(212, 168, 71, 0.1);
}
#jcr-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (max-width: 480px) {
  #jcr-chat-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px); /* better mobile height */
    bottom: 8px;
    right: 8px;
    border-radius: 12px;
  }
  .jcr-chat-header { padding: 14px 16px; }
  .jcr-chat-title-main { font-size: 16px; }
  .jcr-chat-title-sub { font-size: 8.5px; letter-spacing: 0.16em; }
  .jcr-chat-messages { padding: 16px; gap: 12px; }
  .jcr-msg-content { font-size: 13.5px !important; }
  .jcr-chat-input-wrap { padding: 12px 14px; }
  #jcr-chat-input { font-size: 14px; }
  .jcr-chat-suggestions { padding: 0 14px 10px; }
  .jcr-suggestion { font-size: 10.5px; padding: 5px 10px; }
}

/* HEADER */
.jcr-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(212, 168, 71, 0.1), rgba(91, 157, 255, 0.05));
  border-bottom: 1px solid rgba(212, 168, 71, 0.15);
}
.jcr-chat-title-main {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: #f0c55a;
}
.jcr-chat-title-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #6b7280;
  margin-top: 3px;
  text-transform: uppercase;
}
#jcr-chat-close, #jcr-chat-clear {
  background: transparent;
  border: 1px solid rgba(168, 176, 189, 0.18);
  color: #a8b0bd;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
#jcr-chat-close:hover, #jcr-chat-clear:hover {
  border-color: #d4a847;
  color: #f0c55a;
}

/* MESSAGES AREA */
.jcr-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.jcr-chat-messages::-webkit-scrollbar { width: 6px; }
.jcr-chat-messages::-webkit-scrollbar-track { background: transparent; }
.jcr-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(168, 176, 189, 0.2);
  border-radius: 3px;
}

/* WELCOME STATE */
.jcr-chat-welcome {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: auto 0;
}
.jcr-welcome-icon {
  filter: drop-shadow(0 4px 12px rgba(212, 168, 71, 0.3));
}
.jcr-welcome-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  color: #e8eaed;
  font-style: italic;
}
.jcr-welcome-sub {
  font-size: 13px;
  color: #a8b0bd;
  line-height: 1.6;
  max-width: 280px;
}

/* MESSAGES */
.jcr-message {
  display: flex;
  max-width: 88%;
  animation: jcr-fadeIn 0.3s ease;
}
@keyframes jcr-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.jcr-msg-user {
  align-self: flex-end;
}
.jcr-msg-user .jcr-msg-content {
  background: linear-gradient(135deg, #d4a847, #f0c55a);
  color: #0a0c10;
  padding: 10px 14px;
  border-radius: 12px 12px 4px 12px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}
.jcr-msg-assistant {
  align-self: flex-start;
}
.jcr-msg-assistant .jcr-msg-content {
  background: #1a1f29;
  color: #e8eaed;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  border: 1px solid rgba(168, 176, 189, 0.1);
  font-size: 14px;
  line-height: 1.6;
}

/* TYPING INDICATOR */
.jcr-typing {
  display: inline-flex;
  gap: 4px;
  padding: 14px 14px;
}
.jcr-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a8b0bd;
  animation: jcr-typing 1.2s infinite;
}
.jcr-typing span:nth-child(2) { animation-delay: 0.2s; }
.jcr-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes jcr-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* SUGGESTIONS */
.jcr-chat-suggestions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0 20px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.jcr-chat-suggestions::-webkit-scrollbar { display: none; }
.jcr-suggestion {
  background: transparent;
  border: 1px solid rgba(212, 168, 71, 0.25);
  color: #d4a847;
  padding: 6px 12px;
  border-radius: 100px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.jcr-suggestion:hover {
  background: rgba(212, 168, 71, 0.08);
  border-color: #d4a847;
  color: #f0c55a;
}

/* INPUT */
.jcr-chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 14px 20px;
  background: #161b24;
  border-top: 1px solid rgba(168, 176, 189, 0.08);
}
#jcr-chat-input {
  flex: 1;
  background: #1a1f29;
  border: 1px solid rgba(168, 176, 189, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  color: #e8eaed;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  min-height: 40px;
  transition: border-color 0.15s ease;
}
#jcr-chat-input:focus {
  border-color: #d4a847;
}
#jcr-chat-input::placeholder { color: #6b7280; }

#jcr-chat-send {
  background: linear-gradient(135deg, #d4a847, #f0c55a);
  border: none;
  color: #0a0c10;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#jcr-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 168, 71, 0.35);
}

/* DISCLAIMER */
.jcr-chat-disclaimer {
  padding: 10px 20px 14px;
  background: #161b24;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #6b7280;
  text-align: center;
  border-top: 1px solid rgba(168, 176, 189, 0.05);
}
.jcr-chat-disclaimer a {
  color: #a8b0bd;
  text-decoration: none;
}
.jcr-chat-disclaimer a:hover { color: #d4a847; }
