/* MicroChat 3.0 Support Assistant - Sleek Minimalist Theme */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --ink: #0F1117;
  --muted: #6B7280;
  --muted-soft: #9CA3AF;
  --accent: #191641;
  --accent-dim: #EEF0FB;
  --line: #E5E7EB;
  --line-soft: #EFF0F3;
  --bg-page: #F6F7F8;
  --bg-panel: #FFFFFF;
  --bg-sunken: #FAFAFB;
  --radius: 10px;
  --radius-sm: 7px;
}

/* Shared WhatsApp Alignment on /help */
.chat-bubble {
  z-index: 998 !important;
  width: 58px !important;
  height: 58px !important;
  bottom: 30px !important;
  right: 30px !important;
}

/* Floating Launcher Button */
.mc-support-launcher {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.42);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, box-shadow 0.2s;
  z-index: 999;
  border: 2px solid rgba(255, 255, 255, 0.25);
  outline: none;
}

.mc-support-launcher .mc-launcher-icon {
  width: 30px;
  height: 30px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.mc-support-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 32px rgba(29, 78, 216, 0.52);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.mc-support-launcher:active {
  transform: scale(0.96);
}

.mc-support-launcher.mc-beside-wa {
  right: 102px !important;
  bottom: 30px !important;
}

.mc-support-launcher-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  background-color: #10b981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
}

/* ================= WIDGET SHELL (POPUP) ================= */
.widget {
  position: fixed;
  bottom: 96px;
  right: 30px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 115px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px -5px rgba(0, 0, 0, 0.14), 0 10px 18px -5px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  font-family: 'Lato', -apple-system, sans-serif;
  color: var(--ink);

  /* Pop-up open/close transition */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s ease, height 0.25s ease;
  transform-origin: bottom right;
}

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

/* Expanded state */
.widget.is-expanded {
  width: 500px;
  height: min(650px, calc(100vh - 115px));
  max-height: calc(100vh - 115px);
}

/* ---- Header ---- */
.w-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
  flex-shrink: 0;
}

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

.w-title h1 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.1px;
  color: var(--ink);
}

.w-actions {
  display: flex;
  gap: 3px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ---- Body / Scroll Area ---- */
.w-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-panel);
  scroll-behavior: smooth;
}

.w-body::-webkit-scrollbar {
  width: 6px;
}

.w-body::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
}

.msg-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  animation: fadeIn 0.2s ease-out;
}

.msg-col.user-msg {
  align-self: flex-end;
  max-width: 85%;
}

.msg-col.user-msg .user-bubble {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
  word-break: break-word;
}

/* ---- Trace disclosure ("Eksploruar me 1 mjet") ---- */
.trace {
  border-bottom: none;
  padding-bottom: 4px;
}

.trace summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-soft);
  cursor: pointer;
  user-select: none;
}

.trace summary::-webkit-details-marker {
  display: none;
}

.trace summary .chev {
  width: 12px;
  height: 12px;
  color: var(--muted-soft);
  transition: transform 0.15s ease;
}

.trace[open] summary .chev {
  transform: rotate(90deg);
}

.trace-body {
  padding: 10px 0 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.trace-step {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  align-items: center;
}

.trace-step .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted-soft);
  margin-top: 2px;
  flex-shrink: 0;
}

.trace-step code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--bg-sunken);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* ---- Structured Answer ---- */
.answer {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
  word-break: break-word;
}

.answer p {
  margin: 0 0 10px 0;
}

.answer p:last-child {
  margin-bottom: 0;
}

.answer strong {
  font-weight: 700;
  color: var(--ink);
}

.answer ul {
  margin: 0 0 10px 0;
  padding-left: 0;
  list-style: none;
}

.answer li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 7px;
  line-height: 1.55;
}

.answer li::before {
  content: "–";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--muted-soft);
}

/* ---- Context reference card ---- */
.context-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-sunken);
}

.context-card .doc-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-panel);
  color: var(--muted);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.context-card .doc-icon svg {
  width: 12px;
  height: 12px;
}

.context-card .doc-meta {
  min-width: 0;
  flex: 1;
}

.context-card .doc-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-card .doc-sub {
  font-size: 11.5px;
  color: var(--muted-soft);
}

.context-card .doc-remove {
  margin-left: auto;
  color: var(--muted-soft);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.context-card .doc-remove svg {
  width: 12px;
  height: 12px;
}

.context-card .doc-remove:hover {
  color: var(--ink);
}

/* ---- Suggested prompt pills ---- */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.pill {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.pill:hover {
  border-color: #C7CBD6;
  background: var(--bg-sunken);
}

/* ---- Typing loader ---- */
.w-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
}

.w-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-soft);
  animation: wBounce 1.4s infinite ease-in-out both;
}

.w-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.w-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes wBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ---- Footer / Composer ---- */
.w-footer {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--bg-panel);
  flex-shrink: 0;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 7px 7px 7px 16px;
  background: var(--bg-sunken);
  transition: border-color 0.15s, background 0.15s;
}

.composer:focus-within {
  border-color: #3b82f6;
  background: var(--bg-panel);
}

.composer input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: transparent;
  padding: 3px 0;
}

.composer input::placeholder {
  color: var(--muted-soft);
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #3b82f6;
  color: #ffffff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
  transition: all 0.2s ease;
}

.send-btn svg {
  width: 15px;
  height: 15px;
  stroke: #ffffff;
  stroke-width: 2.5;
  transition: transform 0.15s ease;
}

.send-btn:hover:not(:disabled) {
  background: #2563eb;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.send-btn:hover:not(:disabled) svg {
  stroke: #ffffff;
}

.send-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
  background: #e5e7eb;
  color: #ffffff;
  box-shadow: none;
}

.send-btn:disabled svg {
  stroke: #ffffff;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 640px) {
  .chat-bubble {
    bottom: 20px !important;
    right: 18px !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 1.3rem !important;
  }

  .mc-support-launcher {
    bottom: 20px !important;
    right: 18px !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 1.25rem !important;
  }

  .mc-support-launcher .mc-launcher-icon {
    width: 26px;
    height: 26px;
  }

  .mc-support-launcher.mc-beside-wa {
    right: 80px !important;
    bottom: 20px !important;
  }

  .widget {
    right: 14px;
    left: 14px;
    width: auto;
    max-width: calc(100vw - 28px);
    bottom: 82px;
    height: 500px;
    max-height: calc(100vh - 100px);
  }

  .widget.is-expanded {
    width: auto;
    height: calc(100vh - 100px);
  }
}
