/* ASL AI Chat Modal — Phase 6.8-A
 * Self-contained styles. Uses `asl-chat-*` prefix to avoid clashes.
 * Mobile-responsive without touching site layout.
 */

.asl-chat-modal {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.asl-chat-modal.asl-chat-hidden { display: none; }

.asl-chat-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.asl-chat-window {
  position: relative;
  width: min(560px, 96vw);
  height: min(720px, 92vh);
  background: #14172A;
  color: #e2e8f0;
  border: 1px solid #2a2f4a;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.asl-chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #1a1d35, #14172A);
  border-bottom: 1px solid #2a2f4a;
  flex: none;
}
.asl-chat-avatar {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
  font-size: 22px;
  flex: none;
}
.asl-chat-info { flex: 1; min-width: 0; }
.asl-chat-title {
  margin: 0; font-size: 15px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asl-chat-status {
  margin: 2px 0 0; font-size: 12px; color: #94a3b8;
}
.asl-chat-close {
  background: transparent; border: none; cursor: pointer;
  color: #94a3b8; font-size: 18px; padding: 6px 10px;
  border-radius: 8px;
}
.asl-chat-close:hover { background: rgba(255,255,255,.06); color: #fff; }

.asl-chat-body {
  flex: 1; overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #2a2f4a transparent;
}
.asl-chat-body::-webkit-scrollbar { width: 6px; }
.asl-chat-body::-webkit-scrollbar-thumb { background: #2a2f4a; border-radius: 3px; }

.asl-chat-loading, .asl-chat-empty {
  margin: auto; color: #94a3b8; font-size: 14px; text-align: center;
}

.asl-chat-msg {
  display: flex; flex-direction: column;
  max-width: 85%;
  animation: aslChatFadeIn .2s ease;
}
@keyframes aslChatFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.asl-chat-msg-user { align-self: flex-end; align-items: flex-end; }
.asl-chat-msg-assistant { align-self: flex-start; align-items: flex-start; }

.asl-chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.asl-chat-msg-user .asl-chat-bubble {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.asl-chat-msg-assistant .asl-chat-bubble {
  background: #1a1d35;
  border: 1px solid #2a2f4a;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}
.asl-chat-meta {
  margin-top: 4px;
  font-size: 11px; color: #64748b;
}

.asl-chat-typing .asl-chat-bubble {
  display: inline-flex; gap: 4px; align-items: center;
  min-width: 50px;
}
.asl-chat-typing .asl-chat-bubble span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #64748b;
  animation: aslChatBounce 1.2s infinite ease;
}
.asl-chat-typing .asl-chat-bubble span:nth-child(2) { animation-delay: .2s; }
.asl-chat-typing .asl-chat-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes aslChatBounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

.asl-chat-error {
  background: rgba(220, 38, 38, .12);
  border: 1px solid rgba(220, 38, 38, .35);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.asl-chat-input-bar {
  display: flex; gap: 8px;
  padding: 10px 12px;
  background: #0f1220;
  border-top: 1px solid #2a2f4a;
  flex: none;
  align-items: flex-end;
}
.asl-chat-input {
  flex: 1;
  background: #14172A;
  border: 1px solid #2a2f4a;
  border-radius: 10px;
  color: #e2e8f0;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 140px;
}
.asl-chat-input:focus { border-color: #1d4ed8; }
.asl-chat-send {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 42px; height: 42px;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.asl-chat-send:disabled { opacity: .5; cursor: not-allowed; }
.asl-chat-send:hover:not(:disabled) { background: linear-gradient(135deg, #2563eb, #3b82f6); }

/* Mobile — full screen */
@media (max-width: 640px) {
  .asl-chat-window {
    width: 100vw; height: 100vh;
    max-width: none; max-height: none;
    border-radius: 0;
  }
}

/* RTL flips for send icon */
[dir="rtl"] .asl-chat-send-icon { display: inline-block; transform: rotate(180deg); }
