/* ========================================
   NRP v2 — AI Chat Assistant Styles
   ======================================== */

/* ---- CHAT TOGGLE BUTTON ---- */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 250;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AF37 0%, #B8956A 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(184, 149, 106, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(184, 149, 106, 0.55);
}
.chat-toggle:active {
  transform: scale(0.95);
}
.chat-toggle--hidden {
  display: none;
}

/* ---- CHAT OVERLAY ---- */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.chat-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* ---- CHAT WINDOW ---- */
.chat-window {
  width: 400px;
  max-height: 520px;
  background: var(--color-white, #FFFFFF);
  border-radius: var(--radius, 12px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.chat-overlay--visible .chat-window {
  transform: translateY(0);
}

/* ---- HEADER ---- */
.chat-window__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1E1914 0%, #2C2420 100%);
  color: #fff;
  flex-shrink: 0;
}
.chat-window__title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-window__title i {
  color: #D4AF37;
}
.chat-window__close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.chat-window__close:hover {
  color: #fff;
}

/* ---- CHAT HISTORY ---- */
.chat-window__history {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 360px;
  background: var(--color-bg, #FDFBF8);
}

/* ---- MESSAGES ---- */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg p {
  margin: 0;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--color-marine, #B8956A);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg--bot {
  align-self: flex-start;
  background: var(--color-white, #FFFFFF);
  color: var(--color-text, #2C2420);
  border: 1px solid var(--color-border, #E0D6CC);
  border-bottom-left-radius: 4px;
}
.chat-msg--error {
  align-self: flex-start;
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  border-bottom-left-radius: 4px;
  font-size: 13px;
}
.chat-msg--typing {
  align-self: flex-start;
  background: var(--color-white, #FFFFFF);
  border: 1px solid var(--color-border, #E0D6CC);
  border-bottom-left-radius: 4px;
  color: var(--color-text-light, #7A6E64);
  font-style: italic;
}

/* ---- INPUT AREA ---- */
.chat-window__input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border, #E0D6CC);
  background: var(--color-white, #FFFFFF);
  flex-shrink: 0;
}
.chat-window__input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--color-border, #E0D6CC);
  border-radius: 8px;
  background: var(--color-bg, #FDFBF8);
  color: var(--color-text, #2C2420);
  outline: none;
  transition: border-color 0.3s ease;
}
.chat-window__input:focus {
  border-color: var(--color-marine, #B8956A);
  box-shadow: 0 0 0 3px rgba(184, 149, 106, 0.15);
}
.chat-window__send {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #D4AF37 0%, #B8956A 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}
.chat-window__send:hover {
  transform: scale(1.05);
}
.chat-window__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---- MOBILE ---- */
@media (max-width: 767px) {
  .chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
    font-size: 22px;
  }
  .chat-overlay {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .chat-window {
    width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .chat-window__history {
    min-height: 0;
    max-height: none;
    flex: 1;
  }
}

/* ---- PRINT ---- */
@media print {
  .chat-toggle, .chat-overlay { display: none !important; }
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  .chat-toggle, .chat-overlay, .chat-window {
    transition-duration: 0.01ms !important;
  }
}
