/* ═══════════════════════════════════════════════════════════════
   ZARA WIDGET — Markhor Properties
   Inherits: Outfit font, #050505 bg, #ffffff text, minimal dark aesthetic
   All selectors prefixed with #zara- / .zara- to avoid collisions
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

/* ── CONTAINER (anchors all states, never affects layout) ── */
#zara-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none; /* re-enabled on children */
}

/* ════════════════════════════════════════
   STATE 1 — CHAT ICON
   ════════════════════════════════════════ */
#zara-icon-btn {
  pointer-events: all;
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

#zara-icon-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 32px rgba(0,0,0,0.6);
}

#zara-icon-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #050505;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Green dot shown before notification fires */
#zara-icon-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  background: #4ade80;
  border-radius: 50%;
  border: 2px solid #050505;
  display: none;
}

#zara-icon-btn.has-dot #zara-icon-dot {
  display: block;
}

/* ════════════════════════════════════════
   STATE 2 — PROACTIVE NOTIFICATION CARD
   ════════════════════════════════════════ */
#zara-notification {
  pointer-events: all;
  width: 300px;
  background: #111111;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Slide-up entrance */
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1),
              opacity 0.4s cubic-bezier(0.16,1,0.3,1);
}

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

#zara-notification.zara-hidden {
  display: none;
}

.zara-notif-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zara-notif-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,0.1);
}

.zara-notif-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.zara-notif-name {
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
}

.zara-notif-online {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #aaaaaa;
}

.zara-notif-online::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  flex-shrink: 0;
}

#zara-notif-dismiss {
  background: none;
  border: none;
  color: #777777;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px 4px;
  margin-left: auto;
  flex-shrink: 0;
  transition: color 0.2s;
  font-family: 'Outfit', sans-serif;
}

#zara-notif-dismiss:hover { color: #ffffff; }

.zara-notif-message {
  font-size: 13px;
  color: #cccccc;
  line-height: 1.55;
}

#zara-notif-cta {
  width: 100%;
  padding: 10px 16px;
  background: #ffffff;
  color: #050505;
  border: none;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

#zara-notif-cta:hover {
  background: #e6e6e6;
  transform: scale(1.02);
}

#zara-notif-later {
  width: 100%;
  padding: 6px 16px;
  background: transparent;
  color: #777777;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: color 0.2s;
}

#zara-notif-later:hover { color: #cccccc; }

/* ════════════════════════════════════════
   STATE 3 — FULL CHAT WINDOW
   ════════════════════════════════════════ */
#zara-chat-window {
  pointer-events: all;
  width: 370px;
  height: 560px;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  box-shadow: 0 12px 60px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Entrance animation */
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1),
              opacity 0.35s cubic-bezier(0.16,1,0.3,1);
}

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

#zara-chat-window.zara-hidden {
  display: none;
}

/* ── Chat Header ── */
#zara-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: #111111;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.zara-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.zara-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.zara-header-name {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
}

.zara-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #aaaaaa;
}

.zara-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  flex-shrink: 0;
}

#zara-minimize-btn {
  background: none;
  border: none;
  color: #777777;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 20px;
  line-height: 1;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
}

#zara-minimize-btn:hover { color: #ffffff; }

/* ── Messages Area ── */
#zara-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 13px 6px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}

#zara-messages::-webkit-scrollbar { width: 3px; }
#zara-messages::-webkit-scrollbar-track { background: transparent; }
#zara-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
}

/* ── Message Bubbles ── */
.zara-msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 90%;
  animation: zaraFadeUp 0.22s ease;
}

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

.zara-msg.bot  { align-self: flex-start; }
.zara-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.zara-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 100%;
  word-break: break-word;
}

.zara-msg.bot  .zara-bubble {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.08);
  color: #ffffff;
  border-bottom-left-radius: 4px;
}

.zara-msg.user .zara-bubble {
  background: #ffffff;
  color: #050505;
  border-bottom-right-radius: 4px;
}

/* ── Typing Indicator ── */
.zara-msg.typing .zara-bubble { padding: 12px 14px; }

.zara-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 14px;
}

.zara-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #888888;
  animation: zaraBounce 1.2s infinite ease-in-out;
}

.zara-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.zara-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Quick Replies ── */
#zara-quick-replies {
  padding: 4px 13px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.zara-qr-btn {
  padding: 7px 13px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50px;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}

.zara-qr-btn:hover {
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.32);
}

.zara-qr-btn:active { transform: scale(0.96); }

/* ── Input Bar ── */
#zara-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: #0d0d0d;
  flex-shrink: 0;
}

#zara-text-input {
  flex: 1;
  min-width: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  padding: 9px 14px;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
}

#zara-text-input::placeholder { color: #444444; }
#zara-text-input:focus { border-color: rgba(255,255,255,0.28); }

#zara-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

#zara-send-btn:hover  { background: #e0e0e0; transform: scale(1.06); }
#zara-send-btn:active { transform: scale(0.93); }

#zara-send-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #050505;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Powered-by line ── */
#zara-powered {
  text-align: center;
  font-size: 10px;
  color: #2a2a2a;
  padding: 0 0 4px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ════════════════════════════════════════
   MOBILE — 768px and below
   ════════════════════════════════════════ */
@media (max-width: 768px) {
  #zara-widget-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    align-items: flex-end;
  }

  #zara-notification {
    width: 100%;
    max-width: 340px;
  }

  #zara-chat-window {
    width: calc(100vw - 32px);
    max-width: 400px;
    height: 72vh;
    max-height: 560px;
  }
}

/* ════════════════════════════════════════
   NARROW MOBILE — 420px and below
   Covers 375px / 390px / 360px
   ════════════════════════════════════════ */
@media (max-width: 420px) {
  #zara-widget-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }

  #zara-chat-window {
    width: calc(100vw - 24px);
    height: 76vh;
    border-radius: 16px;
  }

  #zara-notification {
    width: calc(100vw - 24px);
    max-width: none;
  }

  #zara-icon-btn {
    width: 50px;
    height: 50px;
  }

  /* Prevent iOS zoom on input */
  #zara-text-input {
    font-size: 16px !important;
  }

  .zara-qr-btn {
    font-size: 12px;
    padding: 6px 11px;
  }
}
