@font-face {
  font-family: "Tajawal";
  src: url("/assets/wahba_furniture/fonts/Tajawal-400-ar.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tajawal";
  src: url("/assets/wahba_furniture/fonts/Tajawal-700-ar.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.wahba-ai,
.wahba-ai * {
  box-sizing: border-box;
}

.wahba-ai {
  direction: rtl;
  font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  position: fixed;
  inset-inline-start: 24px;
  bottom: 24px;
  z-index: 140;
}

.wahba-ai__launcher {
  align-items: center;
  background: #3e2a20;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 16px 38px rgba(41, 27, 18, 0.24);
  color: #fffdf9;
  cursor: pointer;
  display: flex;
  gap: 12px;
  min-height: 58px;
  padding: 8px 10px 8px 18px;
  text-align: start;
}

.wahba-ai__launcher:hover {
  transform: translateY(-2px);
}

.wahba-ai__launcher:focus-visible,
.wahba-ai button:focus-visible,
.wahba-ai textarea:focus-visible {
  outline: 3px solid #ef6c28;
  outline-offset: 3px;
}

.wahba-ai__launcher-mark {
  align-items: center;
  background: #ef6c28;
  border-radius: 50%;
  display: inline-flex;
  font-size: 21px;
  font-weight: 700;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.wahba-ai__launcher strong,
.wahba-ai__launcher small {
  display: block;
}

.wahba-ai__launcher strong {
  font-size: 16px;
  line-height: 1.4;
}

.wahba-ai__launcher small {
  color: #e8dccb;
  font-size: 12px;
  line-height: 1.5;
}

.wahba-ai__panel {
  background: #fffdf9;
  border-radius: 32px;
  bottom: 72px;
  box-shadow: 0 30px 80px rgba(61, 42, 29, 0.2);
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto auto;
  height: min(680px, calc(100dvh - 120px));
  inset-inline-start: 0;
  overflow: hidden;
  position: absolute;
  width: min(420px, calc(100vw - 32px));
}

.wahba-ai__panel[hidden] {
  display: none;
}

.wahba-ai__header {
  align-items: center;
  background: #3e2a20;
  color: #fffdf9;
  display: flex;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 18px;
}

.wahba-ai__header > div {
  align-items: center;
  display: flex;
  gap: 10px;
}

.wahba-ai__header h2,
.wahba-ai__header p {
  margin: 0;
}

.wahba-ai__header h2 {
  font-size: 21px;
  line-height: 1.35;
}

.wahba-ai__header p {
  color: #e8dccb;
  font-size: 12px;
  margin-top: 2px;
}

.wahba-ai__header button {
  background: transparent;
  border: 1px solid rgba(255, 253, 249, 0.35);
  border-radius: 999px;
  color: #fffdf9;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

.wahba-ai__status-dot {
  background: #3c7158;
  border: 3px solid rgba(255, 253, 249, 0.2);
  border-radius: 50%;
  height: 14px;
  width: 14px;
}

.wahba-ai__messages {
  background: #f3ede3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  scrollbar-color: #c7ab8a transparent;
}

.wahba-ai__message {
  max-width: 88%;
}

.wahba-ai__message p {
  margin: 0;
  white-space: pre-wrap;
}

.wahba-ai__message--assistant,
.wahba-ai__message--user {
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.75;
  padding: 12px 14px;
}

.wahba-ai__message--assistant {
  align-self: flex-start;
  background: #fffdf9;
  color: #241b16;
  border-end-start-radius: 5px;
}

.wahba-ai__message--user {
  align-self: flex-end;
  background: #6b4934;
  color: #fffdf9;
  border-end-end-radius: 5px;
}

.wahba-ai__message--loading {
  color: #74675e;
}

.wahba-ai__products {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.wahba-ai__product {
  align-items: center;
  background: #fffdf9;
  border-radius: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: 64px minmax(0, 1fr);
  overflow: hidden;
  padding: 8px;
}

.wahba-ai__product img {
  background: #e8dccb;
  border-radius: 12px;
  height: 64px;
  object-fit: cover;
  width: 64px;
}

.wahba-ai__product h3,
.wahba-ai__product p {
  margin: 0;
}

.wahba-ai__product h3 {
  color: #241b16;
  font-size: 12px;
  line-height: 1.5;
}

.wahba-ai__product p {
  color: #74675e;
  font-size: 12px;
  line-height: 1.5;
}

.wahba-ai__product-actions {
  display: flex;
  gap: 7px;
  grid-column: 1 / -1;
}

.wahba-ai__product-actions button {
  background: transparent;
  border: 1px solid rgba(107, 73, 52, 0.25);
  border-radius: 999px;
  color: #6b4934;
  cursor: pointer;
  flex: 1;
  min-height: 38px;
  padding: 0 10px;
}

.wahba-ai__product-actions button[data-wahba-add-product] {
  background: #ef6c28;
  border-color: #ef6c28;
  color: #fffdf9;
}

.wahba-ai__product-actions button:disabled {
  background: #e8dccb;
  border-color: #e8dccb;
  color: #74675e;
  cursor: not-allowed;
}

.wahba-ai__prompts {
  background: #fffdf9;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  scrollbar-width: none;
}

.wahba-ai__prompts::-webkit-scrollbar {
  display: none;
}

.wahba-ai__prompts button {
  background: transparent;
  border: 1px solid rgba(107, 73, 52, 0.2);
  border-radius: 999px;
  color: #6b4934;
  cursor: pointer;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  white-space: nowrap;
}

.wahba-ai__composer {
  background: #fffdf9;
  border-top: 1px solid rgba(107, 73, 52, 0.12);
  padding: 12px 14px 14px;
}

.wahba-ai__composer > label {
  display: none;
}

.wahba-ai__composer > div {
  align-items: flex-end;
  display: flex;
  gap: 8px;
}

.wahba-ai__composer textarea {
  background: #fffdf9;
  border: 1px solid rgba(107, 73, 52, 0.24);
  border-radius: 12px;
  color: #241b16;
  flex: 1;
  font: inherit;
  line-height: 1.55;
  max-height: 110px;
  min-height: 48px;
  padding: 12px 13px;
  resize: none;
}

.wahba-ai__composer button[type="submit"] {
  background: #ef6c28;
  border: 0;
  border-radius: 999px;
  color: #fffdf9;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  min-width: 70px;
  padding: 0 16px;
}

.wahba-ai__composer button[type="submit"]:hover {
  background: #c94f14;
}

.wahba-ai__composer button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.65;
}

.wahba-ai__notice,
.wahba-ai__error {
  font-size: 12px;
  line-height: 1.55;
  margin: 7px 2px 0;
}

.wahba-ai__notice {
  color: #74675e;
}

.wahba-ai__error {
  background: #e8dccb;
  border-radius: 12px;
  color: #3e2a20;
  padding: 8px 10px;
}

.wahba-ai__honeypot {
  height: 1px;
  inset-inline-start: -10000px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

@media (max-width: 760px) {
  .wahba-ai {
    bottom: calc(74px + env(safe-area-inset-bottom));
    inset-inline-start: 12px;
  }

  .wahba-ai__launcher {
    min-height: 52px;
    padding: 6px 7px 6px 13px;
  }

  .wahba-ai__launcher-mark {
    height: 38px;
    width: 38px;
  }

  .wahba-ai__launcher small {
    display: none;
  }

  .wahba-ai__panel {
    bottom: 62px;
    height: min(74dvh, 650px);
    width: calc(100vw - 24px);
  }
}

@media (max-width: 360px) {
  .wahba-ai__launcher > span:last-child {
    display: none;
  }

  .wahba-ai__launcher {
    padding: 7px;
  }

  .wahba-ai__panel {
    border-radius: 16px;
  }

  .wahba-ai__composer button[type="submit"] {
    min-width: 62px;
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .wahba-ai__launcher,
  .wahba-ai__panel {
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}
