/* =========================================================
   FixAlways — Claude Chat Widget
========================================================= */

#fa-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
}

/* ─── Toggle Button ─────────────────────────────────── */

#fa-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(240, 165, 74, 0.25);
  background: linear-gradient(135deg, rgba(240, 165, 74, 0.15), rgba(232, 115, 74, 0.12));
  backdrop-filter: blur(16px);
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(240, 165, 74, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fa-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 32px rgba(0, 0, 0, 0.5),
    0 0 32px rgba(240, 165, 74, 0.25);
  border-color: rgba(240, 165, 74, 0.4);
}

.fa-chat-pulse {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34d399;
  border: 2px solid #060a12;
  animation: fa-pulse 2s ease-in-out infinite;
}

@keyframes fa-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

/* ─── Chat Panel ────────────────────────────────────── */

#fa-chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-height: 520px;
  border-radius: 20px;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(240, 165, 74, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fa-chat-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

#fa-chat-panel.fa-chat-hidden {
  display: none;
}

@keyframes fa-chat-in {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── Header ────────────────────────────────────────── */

.fa-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.fa-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fa-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(240, 165, 74, 0.15), rgba(232, 115, 74, 0.12));
  border: 1px solid rgba(240, 165, 74, 0.2);
  display: grid;
  place-items: center;
}

.fa-chat-header-title {
  font-weight: 800;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.93);
}

.fa-chat-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.fa-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.fa-chat-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
}

/* ─── Messages ──────────────────────────────────────── */

.fa-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: 340px;
}

.fa-chat-messages::-webkit-scrollbar { width: 4px; }
.fa-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }

/* Welcome */
.fa-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 12px 12px;
  gap: 8px;
}

.fa-chat-welcome-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(240, 165, 74, 0.12), rgba(232, 115, 74, 0.1));
  border: 1px solid rgba(240, 165, 74, 0.15);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.fa-chat-welcome-title {
  font-weight: 800;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
}

.fa-chat-welcome-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
  max-width: 280px;
}

.fa-chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}

.fa-chat-quick {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(240, 165, 74, 0.15);
  background: rgba(240, 165, 74, 0.06);
  color: #f0a54a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.fa-chat-quick:hover {
  background: rgba(240, 165, 74, 0.12);
  border-color: rgba(240, 165, 74, 0.3);
}

/* Bubbles */
.fa-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  animation: fa-msg-in 0.25s ease;
  word-wrap: break-word;
}

@keyframes fa-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fa-chat-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(240, 165, 74, 0.2), rgba(232, 115, 74, 0.15));
  border: 1px solid rgba(240, 165, 74, 0.2);
  color: rgba(255, 255, 255, 0.93);
  border-bottom-right-radius: 6px;
}

.fa-chat-msg-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  border-bottom-left-radius: 6px;
}

/* Typing indicator */
.fa-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
}

.fa-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(240, 165, 74, 0.5);
  animation: fa-typing-dot 1.4s ease-in-out infinite;
}

.fa-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.fa-chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fa-typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Input ─────────────────────────────────────────── */

.fa-chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

#fa-chat-input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.93);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#fa-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#fa-chat-input:focus {
  border-color: rgba(240, 165, 74, 0.3);
  box-shadow: 0 0 0 3px rgba(240, 165, 74, 0.08);
}

#fa-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(240, 165, 74, 0.2);
  background: linear-gradient(135deg, rgba(240, 165, 74, 0.15), rgba(232, 115, 74, 0.12));
  color: #f0a54a;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

#fa-chat-send:hover {
  background: linear-gradient(135deg, rgba(240, 165, 74, 0.25), rgba(232, 115, 74, 0.2));
  border-color: rgba(240, 165, 74, 0.35);
  box-shadow: 0 0 12px rgba(240, 165, 74, 0.15);
}

/* ─── Mobile ────────────────────────────────────────── */

@media (max-width: 480px) {
  #fa-chat {
    bottom: 16px;
    right: 16px;
  }

  #fa-chat-panel {
    width: calc(100vw - 32px);
    max-height: 70vh;
    right: -8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #fa-chat-panel,
  .fa-chat-msg,
  .fa-chat-pulse,
  .fa-chat-typing span {
    animation: none !important;
  }
}
