/*!
 * Felicity — Nova LUXXE Executive Concierge  v2.0
 * Dark luxury AI chat interface.
 * All selectors prefixed .fl-  to avoid collisions.
 */

/* ── Reset scope ─────────────────────────────────────────── */
.fl-btn, .fl-btn *, .fl-panel, .fl-panel * {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════════
   FLOATING TRIGGER BUTTON
══════════════════════════════════════════════════════════ */
.fl-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.fl-btn-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a14a 0%, #8b6914 100%);
  box-shadow: 0 8px 32px rgba(201,161,74,.4), 0 2px 8px rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}

.fl-btn-circle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.fl-btn-label {
  font: 600 9px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .16em;
  color: #c9a14a;
  text-transform: uppercase;
}

.fl-btn:hover .fl-btn-circle {
  transform: scale(1.06);
  box-shadow: 0 12px 40px rgba(201,161,74,.55), 0 2px 8px rgba(0,0,0,.4);
}
.fl-btn:active .fl-btn-circle { transform: scale(.97); }

@keyframes fl-pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(201,161,74,.5); }
  70%  { box-shadow: 0 0 0 14px rgba(201,161,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,161,74,0); }
}
.fl-btn.thinking .fl-btn-circle { animation: fl-pulse-ring 1.4s ease infinite; }

.fl-btn-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e55;
  border: 2px solid #0c0b09;
  display: none;
}
.fl-btn.has-notif .fl-btn-dot { display: block; }


/* ══════════════════════════════════════════════════════════
   PANEL SHELL
══════════════════════════════════════════════════════════ */
.fl-panel {
  position: fixed;
  bottom: 108px;
  right: 28px;
  z-index: 9999;
  width: 460px;
  max-width: calc(100vw - 24px);
  height: min(680px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: #0c0b09;
  border: 1px solid rgba(201,161,74,.14);
  border-radius: 16px;
  box-shadow:
    0 40px 100px rgba(0,0,0,.75),
    0  2px  12px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
.fl-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}


/* ══════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════ */
.fl-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #151310 0%, #1d1a16 100%);
  border-bottom: 1px solid rgba(201,161,74,.1);
}

.fl-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a14a 0%, #8b6914 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 18px/1 Georgia, 'Times New Roman', serif;
  color: #fff;
  box-shadow: 0 2px 8px rgba(201,161,74,.35);
}

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

.fl-header-name {
  font: 700 13px/1.2 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #c9a14a;
}

.fl-header-sub {
  font: 400 11px/1.4 'Helvetica Neue', Arial, sans-serif;
  color: rgba(240,232,216,.4);
  margin-top: 2px;
}

.fl-mode-badge {
  font: 600 9px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.fl-mode-badge.customer  { background: rgba(201,161,74,.12); color: #c9a14a; }
.fl-mode-badge.affiliate { background: rgba(120,200,120,.12); color: #78c878; }
.fl-mode-badge.admin     { background: rgba(180,120,220,.12); color: #c084f0; }

.fl-header-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.fl-lang-select {
  background: rgba(201,161,74,.08);
  border: 1px solid rgba(201,161,74,.2);
  border-radius: 6px;
  color: rgba(240,232,216,.7);
  font: 600 10px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .08em;
  padding: 4px 6px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.fl-lang-select:hover { border-color: rgba(201,161,74,.5); }
.fl-lang-select option { background: #1c1814; color: #f0e8d8; }

.fl-hdr-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255,255,255,.05);
  border-radius: 6px;
  color: rgba(240,232,216,.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: background .15s, color .15s;
}
.fl-hdr-btn:hover { background: rgba(201,161,74,.12); color: #c9a14a; }


/* ══════════════════════════════════════════════════════════
   MESSAGES AREA
══════════════════════════════════════════════════════════ */
.fl-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.fl-msgs::-webkit-scrollbar            { width: 4px; }
.fl-msgs::-webkit-scrollbar-track      { background: transparent; }
.fl-msgs::-webkit-scrollbar-thumb      { background: rgba(201,161,74,.2); border-radius: 2px; }
.fl-msgs::-webkit-scrollbar-thumb:hover{ background: rgba(201,161,74,.4); }


/* ── Message wrapper ─────────────────────────────────────── */
.fl-msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 94%;
  align-self: flex-start;
}
.fl-msg-wrap.user {
  align-self: flex-end;
  max-width: 78%;
}

/* ── Bubble ──────────────────────────────────────────────── */
.fl-msg {
  padding: 12px 16px;
  border-radius: 2px 12px 12px 12px;
  background: #151310;
  border: 1px solid rgba(201,161,74,.12);
  color: #ede5d6;
  font: 14px/1.65 'Helvetica Neue', Arial, sans-serif;
}
.fl-msg-wrap.user .fl-msg {
  background: linear-gradient(135deg, #c9a14a 0%, #a5822c 100%);
  border: none;
  border-radius: 12px 2px 12px 12px;
  color: #0e0c09;
  font-weight: 500;
}

/* Streaming cursor */
.fl-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #c9a14a;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: fl-blink .7s step-end infinite;
}
@keyframes fl-blink { 0%,100%{opacity:1} 50%{opacity:0} }


/* ── Markdown content inside bot bubble ─────────────────── */
.fl-msg p            { margin: 0 0 .65em; }
.fl-msg p:last-child { margin-bottom: 0; }
.fl-msg ul, .fl-msg ol { margin: .4em 0 .65em 1.3em; padding: 0; }
.fl-msg li           { margin-bottom: .3em; }
.fl-msg h2           { font: 700 16px/1.3 Georgia, serif; color: #c9a14a; margin: .8em 0 .4em; }
.fl-msg h3           { font: 700 14px/1.3 'Helvetica Neue', Arial, sans-serif; color: #d4b46a; margin: .7em 0 .35em; }
.fl-msg h4           { font: 600 13px/1.3 'Helvetica Neue', Arial, sans-serif; color: rgba(240,232,216,.7); margin: .6em 0 .3em; }
.fl-msg strong       { color: #e8d5a8; font-weight: 600; }
.fl-msg em           { color: rgba(240,232,216,.8); font-style: italic; }
.fl-msg a            { color: #c9a14a; text-decoration: underline; text-underline-offset: 3px; }
.fl-msg code         { background: rgba(201,161,74,.1); border: 1px solid rgba(201,161,74,.2); border-radius: 4px; padding: 1px 5px; font: 12px/1 'SF Mono','Fira Code',Consolas,monospace; color: #c9a14a; }
.fl-msg pre.fl-code  { background: #0a0907; border: 1px solid rgba(201,161,74,.15); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: .6em 0; }
.fl-msg pre.fl-code code { background: none; border: none; padding: 0; font-size: 12.5px; color: #d4c8a8; }
.fl-msg blockquote   { border-left: 3px solid rgba(201,161,74,.4); padding-left: 12px; margin: .5em 0; color: rgba(240,232,216,.6); font-style: italic; }

/* ── Message action bar ──────────────────────────────────── */
.fl-msg-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
  padding: 0 2px;
}
.fl-msg-wrap:hover .fl-msg-actions { opacity: 1; }
.fl-msg-wrap.user .fl-msg-actions  { justify-content: flex-end; }

.fl-action-btn {
  background: rgba(201,161,74,.07);
  border: 1px solid rgba(201,161,74,.18);
  border-radius: 6px;
  color: rgba(201,161,74,.65);
  font: 600 10px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.fl-action-btn:hover { background: rgba(201,161,74,.17); color: #c9a14a; }
.fl-action-btn svg   { width: 11px; height: 11px; fill: currentColor; }

/* timestamp */
.fl-ts {
  font: 400 10px/1 'Helvetica Neue', Arial, sans-serif;
  color: rgba(240,232,216,.2);
  padding: 0 4px;
  align-self: flex-start;
}
.fl-msg-wrap.user .fl-ts { align-self: flex-end; }


/* ══════════════════════════════════════════════════════════
   TYPING INDICATOR
══════════════════════════════════════════════════════════ */
.fl-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #151310;
  border: 1px solid rgba(201,161,74,.1);
  border-radius: 2px 12px 12px 12px;
  align-self: flex-start;
  width: fit-content;
}
.fl-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9a14a;
  animation: fl-bounce 1.2s ease infinite;
}
.fl-typing-dot:nth-child(2) { animation-delay: .2s; }
.fl-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes fl-bounce {
  0%,80%,100% { transform: translateY(0); opacity: .4; }
  40%          { transform: translateY(-6px); opacity: 1; }
}


/* ══════════════════════════════════════════════════════════
   SUGGESTED PROMPTS
══════════════════════════════════════════════════════════ */
.fl-suggestions {
  padding: 4px 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.fl-chip {
  background: rgba(201,161,74,.07);
  border: 1px solid rgba(201,161,74,.22);
  border-radius: 20px;
  color: rgba(201,161,74,.8);
  font: 500 12px/1 'Helvetica Neue', Arial, sans-serif;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.fl-chip:hover { background: rgba(201,161,74,.16); border-color: rgba(201,161,74,.5); color: #c9a14a; }


/* ══════════════════════════════════════════════════════════
   FILE ATTACHMENT PREVIEWS (in input area)
══════════════════════════════════════════════════════════ */
.fl-attach-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 0;
  border-top: 1px solid rgba(201,161,74,.08);
}
.fl-attach-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(201,161,74,.08);
  border: 1px solid rgba(201,161,74,.2);
  border-radius: 8px;
  padding: 6px 10px;
  font: 500 12px/1 'Helvetica Neue', Arial, sans-serif;
  color: rgba(201,161,74,.85);
  max-width: 200px;
}
.fl-attach-chip img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.fl-attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.fl-attach-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(201,161,74,.4);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: color .15s;
}
.fl-attach-remove:hover { color: #e55; }

/* Image in chat message */
.fl-msg-img {
  max-width: 200px;
  border-radius: 8px;
  margin: 8px 0 0;
  display: block;
  cursor: pointer;
}


/* ══════════════════════════════════════════════════════════
   INPUT AREA
══════════════════════════════════════════════════════════ */
.fl-input-area {
  flex-shrink: 0;
  background: #111009;
  border-top: 1px solid rgba(201,161,74,.1);
}

.fl-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
}

.fl-input-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.fl-icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 8px;
  color: rgba(201,161,74,.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.fl-icon-btn:hover { background: rgba(201,161,74,.1); color: #c9a14a; }
.fl-icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.fl-icon-btn svg { width: 18px; height: 18px; }

.fl-icon-btn.fl-voice.listening {
  background: rgba(220,60,60,.12);
  color: #e55;
  animation: fl-voice-pulse 1s ease infinite;
}
@keyframes fl-voice-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,60,60,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(220,60,60,0); }
}

#flFileInput { display: none; }

.fl-textarea-wrap { flex: 1; }

.fl-textarea {
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(201,161,74,.18);
  border-radius: 10px;
  color: #ede5d6;
  font: 14px/1.55 'Helvetica Neue', Arial, sans-serif;
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s;
  overflow-y: auto;
  display: block;
}
.fl-textarea::placeholder { color: rgba(240,232,216,.28); }
.fl-textarea:focus { border-color: rgba(201,161,74,.45); }
.fl-textarea:disabled { opacity: .5; }
.fl-textarea::-webkit-scrollbar       { width: 3px; }
.fl-textarea::-webkit-scrollbar-thumb { background: rgba(201,161,74,.2); border-radius: 2px; }

.fl-send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  background: linear-gradient(135deg, #c9a14a 0%, #8b6914 100%);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(201,161,74,.3);
}
.fl-send-btn:hover   { opacity: .88; }
.fl-send-btn:active  { transform: scale(.94); }
.fl-send-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.fl-send-btn svg { width: 18px; height: 18px; fill: #fff; }

.fl-input-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px 8px;
  gap: 10px;
}
.fl-stop-btn {
  background: rgba(220,80,60,.1);
  border: 1px solid rgba(220,80,60,.25);
  border-radius: 6px;
  color: #e88;
  font: 600 10px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  padding: 4px 10px;
  cursor: pointer;
  transition: background .15s;
  display: none;
}
.fl-stop-btn.visible { display: block; }
.fl-stop-btn:hover   { background: rgba(220,80,60,.2); }


/* ══════════════════════════════════════════════════════════
   MISC
══════════════════════════════════════════════════════════ */
.fl-divider {
  text-align: center;
  font: 400 11px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .08em;
  color: rgba(201,161,74,.3);
  padding: 6px 0;
  position: relative;
}
.fl-divider::before, .fl-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: rgba(201,161,74,.12);
}
.fl-divider::before { left: 0; }
.fl-divider::after  { right: 0; }

.fl-msg.error { border-color: rgba(220,80,60,.3); background: rgba(220,80,60,.06); color: #e88; }


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  .fl-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    max-height: 100dvh; height: 100dvh;
    border-radius: 16px 16px 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
  .fl-btn { bottom: 20px; right: 20px; }
}
@media (max-width: 380px) {
  .fl-header-sub, .fl-mode-badge { display: none; }
}
