﻿/* Prof THC Widget - Dark Theme */
#profthc-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Floating button */
#profthc-btn {
  width: 60px;
  height: 60px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  overflow: hidden;
  border: 2px solid #28a745;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(40, 167, 69, 0.5);
  animation: profthc-pulse 2.5s infinite;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

#profthc-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(40, 167, 69, 0.7);
  animation: none;
}

#profthc-btn.hidden {
  display: none;
}

@keyframes profthc-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(40, 167, 69, 0.5); }
  50% { box-shadow: 0 4px 28px rgba(40, 167, 69, 0.9), 0 0 0 8px rgba(40, 167, 69, 0.15); }
}

/* Chat modal */
#profthc-modal {
  display: none;
  flex-direction: column;
  width: 340px;
  height: 500px;
  background: #1a1a2e;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  border: 1px solid #28a745;
  position: absolute;
  bottom: 0;
  right: 0;
  animation: profthc-slideup 0.25s ease;
}

#profthc-modal.open {
  display: flex;
}

@keyframes profthc-slideup {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#profthc-header {
  background: #28a745;
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#profthc-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.85;
  transition: opacity 0.15s;
}

#profthc-close:hover {
  opacity: 1;
}

/* Messages area */
#profthc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#profthc-messages::-webkit-scrollbar {
  width: 5px;
}
#profthc-messages::-webkit-scrollbar-track {
  background: #16213e;
}
#profthc-messages::-webkit-scrollbar-thumb {
  background: #28a745;
  border-radius: 3px;
}

/* Message bubbles */
.profthc-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: profthc-fadein 0.2s ease;
}

@keyframes profthc-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profthc-msg-bot {
  background: #16213e;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.profthc-msg-user {
  background: #28a745;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.profthc-typing-indicator {
  padding: 6px 16px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.profthc-typing-indicator span {
  width: 7px;
  height: 7px;
  background: #28a745;
  border-radius: 50%;
  display: inline-block;
  animation: profthc-bounce 1.2s infinite;
}

.profthc-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.profthc-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes profthc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
#profthc-input-area {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #16213e;
  border-top: 1px solid #28a745;
  gap: 8px;
  flex-shrink: 0;
}

#profthc-input {
  flex: 1;
  background: #1a1a2e;
  border: 1px solid #28a745;
  border-radius: 20px;
  color: #e0e0e0;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#profthc-input::placeholder {
  color: #666;
}

#profthc-input:focus {
  border-color: #5cb85c;
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

#profthc-input:disabled {
  opacity: 0.6;
}

#profthc-send {
  width: 36px;
  height: 36px;
  background: #28a745;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

#profthc-send:hover:not(:disabled) {
  background: #34ce57;
  transform: scale(1.08);
}

#profthc-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #profthc-container {
    bottom: 16px;
    right: 16px;
  }

  #profthc-modal {
    width: calc(100vw - 32px);
    height: 70vh;
    max-height: 520px;
    bottom: 0;
    right: 0;
  }
}
#profthc-btn img { width: 100%; height: 100%; object-fit: cover; }

#profthc-messages a {
  color: #1a733a;
  text-decoration: underline;
  font-weight: bold;
}
#profthc-messages a:hover {
  color: #0d4a25;
}
