/* ═══════════════════════════════════════════════════════
   Penta5 AI Chatbot v2 — Obsidian Gold Theme
   ═══════════════════════════════════════════════════════ */

/* ===== FAB BUTTON ===== */
.p5-chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #D4AF37, #B8962E);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.35), 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.p5-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(212, 175, 55, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.p5-chat-fab:active { transform: scale(0.95); }

.p5-chat-fab .p5-fab-icon {
  width: 28px;
  height: 28px;
  color: #fff;
  transition: all 0.3s ease;
}

.p5-chat-fab .p5-fab-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  transition: all 0.3s ease;
}

.p5-chat-fab:hover .p5-fab-logo {
  transform: scale(1.05);
}

.p5-chat-fab.open .p5-fab-icon-open { display: none; }
.p5-chat-fab .p5-fab-icon-close { display: none; }
.p5-chat-fab.open .p5-fab-icon-close { display: block; }

.p5-chat-fab .p5-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  font-family: 'Inter', sans-serif;
}

/* ===== CHAT WINDOW ===== */
.p5-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.p5-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ===== HEADER ===== */
.p5-chat-header {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  flex-shrink: 0;
}

.p5-chat-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #D4AF37, #E8C84A, #D4AF37, transparent);
}

.p5-chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
  border: 1px solid rgba(212, 175, 55, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.p5-chat-header-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.p5-chat-header-avatar svg {
  width: 22px;
  height: 22px;
  color: #D4AF37;
}

.p5-header-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ecc71;
  border: 2px solid #0a0a0a;
}

.p5-chat-header-info { flex: 1; min-width: 0; }

.p5-chat-header-info h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.p5-chat-header-info span {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  display: block;
  margin-top: 0.1rem;
}

.p5-chat-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.p5-chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.p5-chat-close svg { width: 16px; height: 16px; }

/* ===== MESSAGES AREA ===== */
.p5-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: #f8f8f8;
  scroll-behavior: smooth;
}

.p5-chat-messages::-webkit-scrollbar { width: 4px; }
.p5-chat-messages::-webkit-scrollbar-track { background: transparent; }
.p5-chat-messages::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.2); border-radius: 4px; }

/* ===== DATE SEPARATOR ===== */
.p5-date-sep {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.6rem 0;
}

.p5-date-sep::before,
.p5-date-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e8e8e8;
}

.p5-date-sep span {
  font-size: 0.6rem;
  font-weight: 600;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ===== MESSAGE BUBBLES ===== */
.p5-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 88%;
  animation: p5msgIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes p5msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.p5-msg.bot { align-self: flex-start; }
.p5-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.p5-msg-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.p5-msg.bot .p5-msg-avatar {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.04));
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.p5-msg.user .p5-msg-avatar {
  background: linear-gradient(135deg, #D4AF37, #B8962E);
}

.p5-msg-avatar svg { width: 15px; height: 15px; }
.p5-msg.bot .p5-msg-avatar svg { color: #D4AF37; }
.p5-msg.user .p5-msg-avatar svg { color: #fff; }

.p5-msg-content { min-width: 0; }

/* Bot bubble */
.p5-msg-bubble {
  padding: 0.7rem 1rem;
  border-radius: 16px;
  font-size: 0.84rem;
  line-height: 1.65;
  position: relative;
  word-wrap: break-word;
}

.p5-msg.bot .p5-msg-bubble {
  background: #fff;
  color: #333;
  border: 1px solid #e8e8e8;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.p5-msg.user .p5-msg-bubble {
  background: linear-gradient(135deg, #D4AF37, #B8962E);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* ===== RICH MESSAGE FORMATTING ===== */
.p5-msg.bot .p5-msg-bubble strong,
.p5-msg.bot .p5-msg-bubble b {
  font-weight: 700;
  color: #1a1a1a;
}

.p5-msg.bot .p5-msg-bubble em,
.p5-msg.bot .p5-msg-bubble i {
  color: #D4AF37;
  font-style: italic;
}

.p5-msg.bot .p5-msg-bubble h1,
.p5-msg.bot .p5-msg-bubble h2,
.p5-msg.bot .p5-msg-bubble h3,
.p5-msg.bot .p5-msg-bubble h4 {
  font-family: 'Space Grotesk', sans-serif;
  color: #1a1a1a;
  margin: 0.6rem 0 0.3rem;
  line-height: 1.3;
}

.p5-msg.bot .p5-msg-bubble h3 {
  font-size: 0.92rem;
  font-weight: 700;
}

.p5-msg.bot .p5-msg-bubble h4 {
  font-size: 0.84rem;
  font-weight: 600;
}

.p5-msg.bot .p5-msg-bubble ul,
.p5-msg.bot .p5-msg-bubble ol {
  margin: 0.4rem 0;
  padding-left: 1.2rem;
}

.p5-msg.bot .p5-msg-bubble li {
  margin-bottom: 0.25rem;
}

.p5-msg.bot .p5-msg-bubble code {
  background: rgba(212, 175, 55, 0.08);
  color: #b8860b;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.p5-msg.bot .p5-msg-bubble a {
  color: #D4AF37;
  text-decoration: underline;
  text-decoration-color: rgba(212, 175, 55, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

.p5-msg.bot .p5-msg-bubble a:hover {
  text-decoration-color: #D4AF37;
}

.p5-msg-time {
  font-size: 0.6rem;
  color: #bbb;
  margin-top: 0.25rem;
  padding: 0 0.2rem;
}

.p5-msg.user .p5-msg-time { text-align: right; }

/* ===== SERVICE CARD (inside bot messages) ===== */
.p5-service-card {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 0.8rem;
  margin-top: 0.5rem;
}

.p5-service-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.p5-service-card-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.04));
  border: 1px solid rgba(212, 175, 55, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.p5-service-card-icon svg {
  width: 16px;
  height: 16px;
  color: #D4AF37;
}

.p5-service-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a1a1a;
}

.p5-service-card-desc {
  font-size: 0.76rem;
  color: #777;
  line-height: 1.5;
  margin: 0;
}

.p5-service-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.p5-service-tag {
  font-size: 0.6rem;
  font-weight: 600;
  color: #b8860b;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.04);
}

/* ===== INLINE SUGGESTION CHIPS ===== */
.p5-suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f0f0f0;
}

.p5-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: #D4AF37;
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.p5-chip:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.15);
}

.p5-chip:active { transform: scale(0.97); }

.p5-chip svg {
  width: 12px;
  height: 12px;
}

/* ===== TYPING INDICATOR ===== */
.p5-typing {
  display: flex;
  gap: 0.5rem;
  align-self: flex-start;
  max-width: 88%;
  animation: p5msgIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.p5-typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.p5-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #D4AF37;
  animation: p5typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes p5typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ===== INPUT AREA ===== */
.p5-chat-input-area {
  padding: 0.75rem 1rem;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.p5-chat-input-wrap {
  flex: 1;
  position: relative;
}

.p5-chat-input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 0.84rem;
  font-family: 'Inter', sans-serif;
  color: #1a1a1a;
  background: #f5f5f5;
  border: 1.5px solid #e0e0e0;
  border-radius: 14px;
  outline: none;
  transition: all 0.2s;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}

.p5-chat-input::placeholder { color: #aaa; }

.p5-chat-input:focus {
  border-color: #D4AF37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
  background: #fff;
}

.p5-chat-send {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #D4AF37, #B8962E);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.p5-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.45);
}

.p5-chat-send:active { transform: scale(0.95); }

.p5-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.p5-chat-send svg { width: 18px; height: 18px; }

/* ===== WELCOME SCREEN ===== */
.p5-chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  background: #f8f8f8;
}

.p5-welcome-logo {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
  border: 1px solid rgba(212, 175, 55, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.p5-welcome-logo img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.p5-welcome-logo::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), transparent, rgba(212, 175, 55, 0.1));
  z-index: -1;
  animation: p5welcomeRing 3s ease-in-out infinite;
}

@keyframes p5welcomeRing {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.p5-welcome-logo svg {
  width: 32px;
  height: 32px;
  color: #D4AF37;
}

.p5-chat-welcome h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.3rem;
}

.p5-chat-welcome p {
  font-size: 0.82rem;
  color: #888;
  line-height: 1.6;
  max-width: 260px;
  margin-bottom: 1.5rem;
}

.p5-chat-welcome-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 300px;
}

.p5-suggestion-btn {
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #444;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: left;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.p5-suggestion-btn:hover {
  border-color: rgba(212, 175, 55, 0.3);
  color: #D4AF37;
  background: rgba(212, 175, 55, 0.03);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.p5-suggestion-btn-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.03));
  border: 1px solid rgba(212, 175, 55, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.p5-suggestion-btn-icon svg {
  width: 18px;
  height: 18px;
  color: #D4AF37;
}

.p5-suggestion-btn-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.p5-suggestion-btn-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: #1a1a1a;
}

.p5-suggestion-btn-sub {
  font-size: 0.68rem;
  color: #999;
  font-weight: 400;
}

/* ===== POWERED BY ===== */
.p5-chat-powered {
  padding: 0.45rem 1rem;
  text-align: center;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}

.p5-chat-powered span {
  font-size: 0.6rem;
  color: #ccc;
  letter-spacing: 0.04em;
}

.p5-chat-powered span strong {
  color: #D4AF37;
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .p5-chat-fab {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .p5-chat-fab .p5-fab-icon { width: 26px; height: 26px; }

  .p5-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    transform: translateY(100%);
  }

  .p5-chat-window.open { transform: translateY(0); }

  .p5-msg { max-width: 92%; }

  .p5-suggestion-chips { gap: 0.3rem; }

  .p5-chip { padding: 0.35rem 0.6rem; font-size: 0.68rem; }
}
