﻿/* =========================
   SilverSands AI Chat Widget
   ========================= */

.ai-chat{
  position: fixed;
  left: 20px;
  right: auto;
  bottom: 20px;
  z-index: 9999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Launcher */
.ai-chat__launcher{
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
}
.ai-chat__launcher:hover{ transform: translateY(-1px); }
.ai-chat__launcherIcon{ font-size: 22px; }

/* Panel */
.ai-chat__panel{
  position: absolute;
  left: 0;        /* anchored left now */
  right: auto;
  bottom: 100px;

  width: 360px;
  max-width: min(92vw, 420px);

  height: 520px;
  max-height: min(72vh, 620px);

  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  overflow: visible;

  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: all .18s ease;
}
.ai-chat__panel.is-open{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.ai-chat__header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 12px;
  background: #111;
  color: #fff;
}

.ai-chat__brand{
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0; /* prevents pushing close button out */
}

.ai-chat__brandDot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3cff7a;
  box-shadow: 0 0 0 4px rgba(60,255,122,.18);
}

.ai-chat__title{
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
  line-height: 1.15;
}

.ai-chat__subtitle{
  font-size: 12px;
  opacity: .85;
  margin-top: 2px;
  line-height: 1.15;
}

/* Close button (now visible) */
.ai-chat__close{
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;

  background: rgba(255,255,255,.14);
  color: #fff;

  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
}
.ai-chat__close:hover{
  background: rgba(255,255,255,.24);
}

/* Messages area */
.ai-chat__messages{
  padding: 14px;
  height: calc(100% - 56px - 92px - 34px); /* header + quick + composer/typing spacing */
  overflow-y: auto;
  background: #f6f7f9;
}

.ai-chat__row{ display:flex; margin: 10px 0; }
.ai-chat__row.user{ justify-content:flex-end; }
.ai-chat__row.bot{ justify-content:flex-start; }

.ai-chat__bubble{
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ai-chat__bubble--user{
  background: #111;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-chat__bubble--bot{
  background: #fff;
  color: #111;
  border-bottom-left-radius: 6px;
}

/* Quick reply chips */
.ai-chat__quick{
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.06);
}

.ai-chat__chip{
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ai-chat__chip:hover{ background:#f2f3f5; }

/* Composer */
.ai-chat__composer{
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.06);
}

.ai-chat__input{
  flex: 1;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}
.ai-chat__input:focus{ border-color: rgba(0,0,0,.35); }

.ai-chat__send{
  border: 0;
  background: #111;
  color: #fff;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
}
.ai-chat__send:hover{ opacity:.92; }

/* Typing indicator */
.ai-chat__typing{
  position: absolute;
  left: 14px;
  bottom: 78px;
  background: #fff;
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

.ai-chat__typing .dot{
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: #111;
  opacity: .25;
  animation: pulse 1s infinite ease-in-out;
}
.ai-chat__typing .dot:nth-child(2){ animation-delay:.15s; }
.ai-chat__typing .dot:nth-child(3){ animation-delay:.3s; }

@keyframes pulse{
  0%,100%{ transform: translateY(0); opacity:.25; }
  50%{ transform: translateY(-3px); opacity:.75; }
}

/* Small screens */
@media (max-width: 420px){
  .ai-chat{ left: 12px; bottom: 12px; }
  .ai-chat__panel{
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}
