/* Sookzaa AI sales assistant: floating button, nudge bubble and chat panel (assets/js/agent.js). */

.ag-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 64px);
  z-index: 41;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0 1.15rem 0 0.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink, #0b1220);
  box-shadow: 0 10px 30px rgba(11, 18, 32, 0.28);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 140ms var(--ease-out, ease);
}

.ag-fab:active {
  transform: scale(0.97);
}

.ag-fab-ic {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ff8a5c, #e8552b 60%, #c4421d);
}

.ag-fab-ic svg,
.ag-ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the dot that says "online" */
.ag-fab-ic {
  position: relative;
}

.ag-fab-ic::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink, #0b1220);
  border-radius: 50%;
  background: #22c55e;
}

.ag-nudge {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 128px);
  z-index: 41;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: min(300px, calc(100vw - 36px));
  padding: 0.85rem 0.9rem 0.85rem 1rem;
  border-radius: 18px 18px 4px 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(11, 18, 32, 0.18);
  color: var(--text, #0b1220);
  font-size: 0.92rem;
  line-height: 1.45;
  cursor: pointer;
  animation: ag-pop 360ms var(--ease-out, ease) both;
}

.ag-nudge button {
  flex: none;
  margin: -4px -4px 0 0;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--muted, #667085);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

@keyframes ag-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

/* ---------- panel ---------- */
.ag-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  background: #fff;
  box-shadow: -18px 0 50px rgba(11, 18, 32, 0.18);
  color: var(--text, #0b1220);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 320ms var(--ease-out, ease), visibility 0s 320ms;
}

.ag-open .ag-panel {
  transform: none;
  visibility: visible;
  transition: transform 320ms var(--ease-out, ease);
}

.ag-open .ag-fab,
.ag-open .ag-nudge,
.ag-open .line-fab {
  display: none;
}

.ag-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.9rem 1.15rem;
  border-bottom: 1px solid var(--stroke, #e6e8ee);
}

.ag-head .ag-fab-ic {
  width: 40px;
  height: 40px;
  color: #fff;
}

.ag-head .ag-fab-ic::after {
  border-color: #fff;
}

.ag-title {
  flex: 1;
  min-width: 0;
}

.ag-title b {
  display: block;
  font-size: 1rem;
}

.ag-title span {
  font-size: 0.8rem;
  color: var(--muted, #667085);
}

.ag-x {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text, #0b1220);
  cursor: pointer;
}

.ag-x:hover {
  background: #f2f3f6;
}

.ag-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem 1.1rem 0.6rem;
}

.ag-msg {
  max-width: 88%;
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  animation: ag-pop 260ms var(--ease-out, ease) both;
}

.ag-bot {
  color: var(--text, #0b1220);
}

.ag-me {
  margin-left: auto;
  padding: 0.6rem 0.95rem;
  border-radius: 16px 16px 4px 16px;
  background: #f1f2f5;
  width: fit-content;
}

.ag-msg a {
  color: var(--blue, #e8552b);
  font-weight: 700;
  text-decoration: underline;
}

.ag-card {
  margin: 0.2rem 0 0.8rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--stroke, #e6e8ee);
  border-radius: 14px;
  background: #fafbfc;
  font-size: 0.88rem;
  line-height: 1.6;
}

.ag-card .ag-line-btn {
  margin-top: 0.7rem;
}

.ag-line-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: #06c755;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none !important;
}

.ag-typing {
  display: inline-flex;
  gap: 4px;
  padding: 0.5rem 0;
}

.ag-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c3c8d2;
  animation: ag-dot 1s infinite ease-in-out;
}

.ag-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.ag-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ag-dot {
  50% {
    transform: translateY(-4px);
    background: #8b93a3;
  }
}

.ag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.3rem 1.1rem 0.7rem;
}

.ag-chips button,
.ag-chips a {
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: #ffe7dd;
  color: #9a3412;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.ag-chips button:hover,
.ag-chips a:hover {
  background: #ffd6c5;
}

.ag-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 1rem;
  padding: 0.35rem 0.35rem 0.35rem 0.95rem;
  border: 1px solid var(--stroke, #d9dce3);
  border-radius: 14px;
}

.ag-form:focus-within {
  border-color: var(--blue, #e8552b);
}

.ag-form input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 16px;
  color: inherit;
}

.ag-form button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text, #0b1220);
  cursor: pointer;
}

.ag-form .ag-send {
  background: var(--blue, #e8552b);
  color: #fff;
}

.ag-form .ag-send:disabled {
  background: #e4e6eb;
  color: #9aa1ad;
  cursor: default;
}

.ag-form .ag-mic.is-on {
  background: #fee2e2;
  color: #dc2626;
  animation: ag-pulse 1.2s infinite;
}

@keyframes ag-pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.15);
  }
}

.ag-fine {
  margin: 0;
  padding: 0.55rem 1.1rem calc(0.8rem + env(safe-area-inset-bottom));
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted, #667085);
  text-align: center;
}

@media (max-width: 640px) {
  .ag-fab {
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 62px);
    padding: 0 1rem 0 0.6rem;
  }

  .ag-nudge {
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 124px);
  }

  .ag-panel {
    width: 100vw;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-panel,
  .ag-open .ag-panel {
    transition: none;
  }

  .ag-msg,
  .ag-nudge {
    animation: none;
  }
}
