/* 
 * Zara AI Chat Widget Styles
 * Uses root variables from the Zenkaizen site (var(--black), var(--white), var(--yellow), var(--font))
 */

#zara-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font, 'Glacial Indifference', sans-serif);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* Let clicks pass through empty space */
}

#zara-widget-container > * {
  pointer-events: auto; /* Re-enable clicks on widget elements */
}

/* ── STATE 1: ICON BUTTON ── */
.zara-icon-btn {
  width: 56px;
  height: 56px;
  background: var(--black, #090909);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
  overflow: hidden;
}

.zara-icon-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.zara-icon-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center; /* Focus on the face */
}

/* ── STATE 2: NOTIFICATION CARD ── */
.zara-notification {
  position: absolute;
  bottom: 72px; /* Above the icon */
  right: 0;
  width: 280px;
  background: var(--white, #fff);
  color: var(--black, #000);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px);
  visibility: hidden;
  transition: opacity 0.4s ease-out, transform 0.4s ease-out, visibility 0.4s;
}

.zara-notification.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.zara-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zara-notif-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 14px;
}

.zara-notif-avatar img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--black);
  object-fit: cover;
}

.zara-notif-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 0;
}

.zara-notif-close:hover {
  color: #333;
}

.zara-notif-text {
  font-size: 14px;
  line-height: 1.5;
  color: #444;
}

.zara-notif-btn {
  background: var(--yellow, #c9a84c);
  color: var(--black, #000);
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}

.zara-notif-btn:hover {
  background: #b8963e;
}

/* ── STATE 3: FULL CHAT WINDOW ── */
.zara-chat-window {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 340px;
  height: 520px;
  max-height: calc(100vh - 40px);
  background: var(--white, #fff);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  transform-origin: bottom right;
}

.zara-chat-window.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.zara-chat-header {
  background: var(--black, #090909);
  color: var(--white, #fff);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zara-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zara-chat-header-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #222;
  object-fit: cover;
}

.zara-chat-header-text h3 {
  font-size: 15px;
  margin: 0 0 2px 0;
  font-weight: 600;
}

.zara-chat-header-text span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}

.zara-chat-header-text span::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
}

.zara-chat-minimize {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 4px;
}
.zara-chat-minimize:hover { opacity: 1; }
.zara-chat-minimize svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }

.zara-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #faf9f7; /* Slight cream tint */
}

.zara-msg {
  max-width: 85%;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 12px;
  animation: fadeInMsg 0.3s ease;
  word-wrap: break-word;
}

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

.zara-msg-bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--black);
  border: 1px solid rgba(0,0,0,0.05);
  border-bottom-left-radius: 4px;
}

.zara-msg-user {
  align-self: flex-end;
  background: var(--black);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.zara-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.zara-typing span {
  display: block;
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}
.zara-typing span:nth-child(2) { animation-delay: 0.2s; }
.zara-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Quick Replies */
.zara-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  animation: fadeInMsg 0.4s ease;
}

.zara-quick-reply-btn {
  background: var(--white);
  border: 1px solid var(--yellow);
  color: var(--black);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.zara-quick-reply-btn:hover {
  background: var(--yellow);
}

/* Input Area */
.zara-chat-input-area {
  padding: 12px;
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  gap: 8px;
}

.zara-chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.zara-chat-input-area input:focus {
  border-color: var(--yellow);
}
.zara-chat-input-area input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.zara-chat-send {
  background: var(--yellow);
  color: var(--black);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.zara-chat-send:hover:not(:disabled) { background: #b8963e; }
.zara-chat-send:disabled { background: #eee; color: #aaa; cursor: not-allowed; }
.zara-chat-send svg { width: 18px; height: 18px; fill: currentColor; }


/* Mobile adjustments */
@media (max-width: 480px) {
  #zara-widget-container {
    bottom: 16px;
    right: 16px;
  }
  
  .zara-notification {
    width: 260px;
    bottom: 64px;
  }
  
  .zara-chat-window {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    z-index: 10000;
  }
  
  /* When chat is open on mobile, hide the launcher button */
  .zara-chat-window.show ~ .zara-icon-btn {
    display: none;
  }
}
