/**
 * Wallcano Tiles Ltd — Modern AI Agent Chatbot Styling
 * Scoped and tailored to Wallcano's luxury architectural aesthetic
 */

:root {
  --wc-bot-gold: #B79B6F;
  --wc-bot-gold-hover: #A88959;
  --wc-bot-gold-soft: #FBF8F3;
  --wc-bot-gold-glow: rgba(183, 155, 111, 0.25);
  --wc-bot-dark: #121820;
  --wc-bot-dark-surface: #1A222D;
  --wc-bot-dark-border: rgba(255, 255, 255, 0.1);
  --wc-bot-ink: #111111;
  --wc-bot-body: #2D3748;
  --wc-bot-muted: #718096;
  --wc-bot-line: #E2E8F0;
  --wc-bot-surface: #FFFFFF;
  --wc-bot-soft: #F8F7F4;
  --wc-bot-shadow: 0 20px 50px rgba(18, 24, 32, 0.18), 0 4px 15px rgba(0, 0, 0, 0.06);
  --wc-bot-radius: 18px;
  --wc-bot-font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --wc-bot-heading-font: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  --wc-bot-z: 999999;
}

#wallcano-chat-widget,
#wallcano-chat-launcher,
.wallcano-toast {
  box-sizing: border-box;
  font-family: var(--wc-bot-font);
  -webkit-font-smoothing: antialiased;
}

#wallcano-chat-widget *,
#wallcano-chat-launcher * {
  box-sizing: border-box;
}

/* Coordinate with site scroll progress button */
.scroll-progress-btn {
  bottom: 88px !important;
  right: 24px !important;
}

/* -------------------------------------------------------------
   Launcher Button
------------------------------------------------------------- */
#wallcano-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--wc-bot-z);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallcano-launcher-badge {
  background: var(--wc-bot-dark);
  color: #FFFFFF;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--wc-bot-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(10px) scale(0.95);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

/* Show badge on cursor hover */
#wallcano-chat-launcher:hover .wallcano-launcher-badge {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

#wallcano-chat-launcher.is-active .wallcano-launcher-badge {
  display: none !important;
}

.wallcano-launcher-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  flex-shrink: 0;
}

.wallcano-launcher-badge-text {
  user-select: none;
}

.wallcano-launcher-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wc-bot-dark) 0%, #1E293B 100%);
  border: 1.5px solid var(--wc-bot-gold);
  color: var(--wc-bot-gold);
  box-shadow: 0 6px 20px rgba(18, 24, 32, 0.28), 0 0 12px var(--wc-bot-gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallcano-launcher-btn:hover {
  transform: scale(1.08) rotate(4deg);
  border-color: #D4AF37;
  box-shadow: 0 12px 30px rgba(18, 24, 32, 0.4), 0 0 22px rgba(212, 175, 55, 0.4);
}

.wallcano-launcher-btn svg {
  transition: transform 0.3s ease;
}

.wallcano-launcher-btn.is-active svg.wc-icon-chat {
  display: none;
}

.wallcano-launcher-btn svg.wc-icon-close {
  display: none;
}

.wallcano-launcher-btn.is-active svg.wc-icon-close {
  display: block;
}

/* -------------------------------------------------------------
   Chat Widget Window
------------------------------------------------------------- */
#wallcano-chat-widget {
  position: fixed;
  right: 28px;
  bottom: 100px;
  width: 420px;
  height: 640px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  background: var(--wc-bot-surface);
  border-radius: var(--wc-bot-radius);
  box-shadow: var(--wc-bot-shadow);
  border: 1px solid var(--wc-bot-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--wc-bot-z);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#wallcano-chat-widget.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

#wallcano-chat-widget[data-mode="expanded"] {
  width: 680px;
  height: 820px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
}

/* -------------------------------------------------------------
   Header
------------------------------------------------------------- */
.wallcano-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--wc-bot-dark) 0%, #1A222D 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wallcano-header-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallcano-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wc-bot-dark-surface);
  border: 1.5px solid var(--wc-bot-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wc-bot-gold);
  font-weight: 700;
  font-size: 16px;
}

.wallcano-avatar-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  border: 2px solid var(--wc-bot-dark);
}

.wallcano-title-box {
  display: flex;
  flex-direction: column;
}

.wallcano-bot-name {
  font-family: var(--wc-bot-heading-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wallcano-bot-badge {
  font-size: 9px;
  text-transform: uppercase;
  background: rgba(183, 155, 111, 0.2);
  color: var(--wc-bot-gold);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.wallcano-bot-status {
  font-size: 11px;
  color: #94A3B8;
}

.wallcano-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wallcano-header-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wallcano-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

/* -------------------------------------------------------------
   Body & Messages Stream
------------------------------------------------------------- */
.wallcano-body {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  background: var(--wc-bot-soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Welcome Card */
.wallcano-welcome-card {
  background: #FFFFFF;
  border: 1px solid var(--wc-bot-line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.wallcano-welcome-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--wc-bot-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.wallcano-welcome-title {
  font-family: var(--wc-bot-heading-font);
  font-size: 17px;
  font-weight: 700;
  color: var(--wc-bot-ink);
  margin-bottom: 6px;
}

.wallcano-welcome-desc {
  font-size: 13px;
  color: var(--wc-bot-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

/* Quick Suggestion Chips */
.wallcano-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallcano-chip {
  background: var(--wc-bot-soft);
  border: 1px solid var(--wc-bot-line);
  color: var(--wc-bot-body);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.wallcano-chip:hover {
  background: #FFFFFF;
  border-color: var(--wc-bot-gold);
  color: var(--wc-bot-ink);
  box-shadow: 0 2px 8px rgba(183, 155, 111, 0.15);
  transform: translateY(-1px);
}

/* Dynamic Message Stream */
#wallcano-messages-stream {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Message Rows */
.wallcano-msg-row {
  display: flex;
  width: 100%;
  animation: wcMsgAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes wcMsgAppear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User Message: Aligned strictly to the Right */
.wallcano-msg-row.is-user {
  justify-content: flex-end;
  margin-left: auto;
}

.wallcano-msg-row.is-user .wallcano-msg-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 84%;
}

.wallcano-msg-row.is-user .wallcano-msg-bubble {
  background: var(--wc-bot-dark);
  color: #FFFFFF;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 14px rgba(18, 24, 32, 0.16);
  text-align: left;
}

/* Bot Message: Aligned strictly to the Left */
.wallcano-msg-row.is-bot {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  margin-right: auto;
}

.wallcano-msg-row.is-bot .wallcano-msg-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: calc(100% - 38px);
  gap: 8px;
}

.wallcano-msg-row.is-bot .wallcano-msg-bubble {
  background: #FFFFFF;
  border: 1px solid var(--wc-bot-line);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  color: var(--wc-bot-ink);
}

.wallcano-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--wc-bot-dark);
  color: var(--wc-bot-gold);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}

.wallcano-msg-bubble {
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.wallcano-msg-bubble p {
  margin: 0 0 8px 0;
}

.wallcano-msg-bubble p:last-child {
  margin-bottom: 0;
}

.wallcano-msg-bubble a {
  color: var(--wc-bot-gold-hover);
  text-decoration: underline;
  font-weight: 600;
}

.wallcano-msg-bubble strong {
  color: var(--wc-bot-ink);
}

.wallcano-msg-row.is-user .wallcano-msg-bubble strong {
  color: #FFFFFF;
}

.wallcano-msg-bubble ul, .wallcano-msg-bubble ol {
  margin: 6px 0 8px 20px;
  padding: 0;
}

.wallcano-msg-bubble li {
  margin-bottom: 4px;
}

/* Audio Player Pill */
.wallcano-audio-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--wc-bot-soft);
  border: 1px solid var(--wc-bot-line);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--wc-bot-body);
  margin-top: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wallcano-audio-pill:hover {
  background: #FFFFFF;
  border-color: var(--wc-bot-gold);
  color: var(--wc-bot-ink);
}

.wallcano-audio-pill.is-playing {
  background: var(--wc-bot-gold-soft);
  border-color: var(--wc-bot-gold);
  color: var(--wc-bot-gold-hover);
}

.wallcano-audio-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 12px;
}

.wallcano-audio-wave-bar {
  width: 2px;
  height: 100%;
  background: currentColor;
  border-radius: 2px;
}

.wallcano-audio-pill.is-playing .wallcano-audio-wave-bar {
  animation: wcWave 0.8s ease-in-out infinite alternate;
}

.wallcano-audio-pill.is-playing .wallcano-audio-wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wallcano-audio-pill.is-playing .wallcano-audio-wave-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes wcWave {
  from { height: 20%; }
  to { height: 100%; }
}

/* Typing Indicator */
.wallcano-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.wallcano-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wc-bot-muted);
  animation: wcTyping 1.4s infinite;
}

.wallcano-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wallcano-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes wcTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* -------------------------------------------------------------
   Product Cards Carousel / Grid
------------------------------------------------------------- */
.wallcano-products-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 2px 14px 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.wallcano-products-carousel::-webkit-scrollbar {
  height: 5px;
}

.wallcano-products-carousel::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 10px;
}

.wallcano-product-card {
  flex: 0 0 240px;
  scroll-snap-align: start;
  background: #FFFFFF;
  border: 1px solid var(--wc-bot-line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.wallcano-product-card:hover {
  transform: translateY(-3px);
  border-color: var(--wc-bot-gold);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.wallcano-card-img-wrap {
  width: 100%;
  height: 140px;
  background: #F1F5F9;
  position: relative;
  overflow: hidden;
}

.wallcano-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.wallcano-product-card:hover .wallcano-card-img {
  transform: scale(1.05);
}

.wallcano-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(18, 24, 32, 0.85);
  backdrop-filter: blur(4px);
  color: var(--wc-bot-gold);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.wallcano-card-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.wallcano-card-title {
  font-family: var(--wc-bot-heading-font);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--wc-bot-ink);
  line-height: 1.35;
  margin-bottom: 4px;
}

.wallcano-card-specs {
  font-size: 11.5px;
  color: var(--wc-bot-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.wallcano-card-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wallcano-card-btn-view {
  background: var(--wc-bot-dark);
  color: #FFFFFF;
  text-align: center;
  padding: 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wallcano-card-btn-view:hover {
  background: var(--wc-bot-gold);
  color: var(--wc-bot-ink);
}

.wallcano-card-btn-sample {
  background: var(--wc-bot-soft);
  color: var(--wc-bot-body);
  border: 1px solid var(--wc-bot-line);
  text-align: center;
  padding: 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.wallcano-card-btn-sample:hover {
  background: #FFFFFF;
  border-color: var(--wc-bot-gold);
  color: var(--wc-bot-ink);
}

/* -------------------------------------------------------------
   Footer & Composer Input
------------------------------------------------------------- */
.wallcano-footer {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid var(--wc-bot-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Attachment preview */
.wallcano-attach-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--wc-bot-soft);
  border: 1px solid var(--wc-bot-line);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11.5px;
}

.wallcano-attach-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.wallcano-attach-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.wallcano-attach-name {
  font-weight: 600;
  color: var(--wc-bot-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.wallcano-attach-remove {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #EF4444;
}

/* Input Form */
.wallcano-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--wc-bot-soft);
  border: 1px solid var(--wc-bot-line);
  border-radius: 12px;
  padding: 6px 10px;
  transition: border-color 0.2s ease;
}

.wallcano-chat-form:focus-within {
  border-color: var(--wc-bot-gold);
  box-shadow: 0 0 0 2px var(--wc-bot-gold-glow);
}

.wallcano-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--wc-bot-ink);
  resize: none;
  max-height: 90px;
  padding: 4px 0;
}

.wallcano-textarea::placeholder {
  color: #94A3B8;
}

.wallcano-composer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wallcano-tool-btn {
  background: transparent;
  border: none;
  color: #64748B;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wallcano-tool-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--wc-bot-ink);
}

.wallcano-voice-btn {
  background: transparent;
  border: none;
  color: #64748B;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.wallcano-voice-btn:hover {
  color: var(--wc-bot-gold);
}

.wallcano-voice-btn.is-recording {
  color: #EF4444;
}

.wallcano-voice-ring {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 2px solid #EF4444;
  display: none;
}

.wallcano-voice-btn.is-recording .wallcano-voice-ring {
  display: block;
  animation: wcVoicePulse 1.2s infinite;
}

@keyframes wcVoicePulse {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.wallcano-send-btn {
  background: var(--wc-bot-dark);
  color: var(--wc-bot-gold);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wallcano-send-btn:hover {
  background: var(--wc-bot-gold);
  color: var(--wc-bot-dark);
}

.wallcano-disclaimer {
  font-size: 10.5px;
  color: #94A3B8;
  text-align: center;
  margin-top: 2px;
}

/* -------------------------------------------------------------
   Toast Notifications
------------------------------------------------------------- */
.wallcano-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--wc-bot-dark);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 12.5px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--wc-bot-gold);
  z-index: calc(var(--wc-bot-z) + 10);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallcano-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------------
   Responsive Mobile
------------------------------------------------------------- */
@media (max-width: 640px) {
  #wallcano-chat-widget {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  #wallcano-chat-launcher {
    right: 18px;
    bottom: 18px;
  }

  .wallcano-launcher-badge {
    display: none;
  }
}
