/* mikneri.dev AI chat widget — Code Hermit theme.
 * Authored MOBILE FIRST: base rules target the smallest screen, then
 * min-width media queries layer on tablet (>=768px) and desktop (>=1024px). */
:root {
  --chat-cyan: #00d4ff;
  --chat-green: #00ff88;
  --chat-bg: #0f1620;
  --chat-bg-2: #0b1118;
  --chat-ink: #060a0f;
  --chat-text: #d7e3ee;
  --chat-muted: #7b8ba0;
  --chat-line: rgba(0, 212, 255, 0.18);
}

/* =================================================================
   BASE = MOBILE (no media query). Phone-sized screens get these.
   ================================================================= */

/* ---- Launcher button ---- */
.mn-chat-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--chat-cyan);
  background: radial-gradient(120% 120% at 30% 25%, #15212e 0%, var(--chat-bg) 70%);
  color: var(--chat-cyan);
  cursor: pointer;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.45), 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, box-shadow 0.25s ease;
  animation: mn-pulse 2.8s ease-out infinite;
}
.mn-chat-btn:hover { transform: translateY(-2px) scale(1.04); }
.mn-chat-btn:focus-visible { outline: 2px solid var(--chat-green); outline-offset: 3px; }
.mn-chat-btn svg { width: 25px; height: 25px; }
.mn-chat-btn .mn-ico-close { display: none; }
.mn-chat-open .mn-chat-btn { animation: none; }
.mn-chat-open .mn-chat-btn .mn-ico-open { display: none; }
.mn-chat-open .mn-chat-btn .mn-ico-close { display: block; }

@keyframes mn-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.45), 0 8px 24px rgba(0,0,0,0.45); }
  70%  { box-shadow: 0 0 0 14px rgba(0, 212, 255, 0), 0 8px 24px rgba(0,0,0,0.45); }
  100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0), 0 8px 24px rgba(0,0,0,0.45); }
}

/* ---- Panel: mobile base = full-width bottom sheet ---- */
.mn-chat-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 82vh;
  max-height: 82vh;
  background: linear-gradient(180deg, var(--chat-bg) 0%, var(--chat-bg-2) 100%);
  border: 1px solid var(--chat-line);
  border-radius: 16px 16px 0 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.55);
  transform-origin: bottom center;
  transform: translateY(12px) scaleY(0.6);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
.mn-chat-open .mn-chat-panel {
  transform: translateY(0) scaleY(1);
  opacity: 1;
  pointer-events: auto;
}

.mn-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--chat-line);
  font-family: "Share Tech Mono", ui-monospace, monospace;
}
.mn-chat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chat-green);
  box-shadow: 0 0 8px var(--chat-green); }
.mn-chat-title { color: var(--chat-text); font-size: 14px; letter-spacing: 0.5px; }
.mn-chat-sub { color: var(--chat-muted); font-size: 11px; margin-left: auto; }

.mn-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-line) transparent;
  -webkit-overflow-scrolling: touch;
}
.mn-msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; font-size: 15px;
  line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.mn-msg a { color: var(--chat-cyan); }
.mn-msg-bot { align-self: flex-start; background: #16222f; color: var(--chat-text);
  border: 1px solid var(--chat-line); border-bottom-left-radius: 4px; }
.mn-msg-user { align-self: flex-end; background: rgba(0, 212, 255, 0.14);
  color: #eaf6ff; border: 1px solid var(--chat-cyan); border-bottom-right-radius: 4px; }

.mn-typing { display: inline-flex; gap: 4px; align-items: center; }
.mn-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--chat-muted);
  animation: mn-blink 1.2s infinite both; }
.mn-typing span:nth-child(2) { animation-delay: 0.2s; }
.mn-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mn-blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

.mn-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.mn-chip { font-size: 13px; color: var(--chat-cyan); background: transparent;
  border: 1px solid var(--chat-line); border-radius: 999px; padding: 8px 13px;
  cursor: pointer; transition: background 0.15s ease; }
.mn-chip:hover { background: rgba(0, 212, 255, 0.1); }

.mn-chat-foot { border-top: 1px solid var(--chat-line); padding: 10px; }
.mn-chat-form { display: flex; gap: 8px; align-items: flex-end; }
.mn-chat-input {
  flex: 1; resize: none; max-height: 96px; min-height: 44px;
  background: var(--chat-ink); color: var(--chat-text);
  border: 1px solid var(--chat-line); border-radius: 10px;
  padding: 11px 12px; font: inherit; font-size: 16px; line-height: 1.4;
}
/* 16px input font-size prevents iOS Safari auto-zoom on focus. */
.mn-chat-input:focus { outline: none; border-color: var(--chat-cyan); }
.mn-chat-send {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  border: 1px solid var(--chat-cyan); background: rgba(0, 212, 255, 0.12);
  color: var(--chat-cyan); cursor: pointer; display: grid; place-items: center;
}
.mn-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.mn-chat-cta {
  display: block; text-align: center; margin-top: 8px; font-size: 12px;
  color: var(--chat-green); text-decoration: none; letter-spacing: 0.3px;
}
.mn-chat-cta:hover { text-decoration: underline; }

/* =================================================================
   TABLET and up (>=768px): lift off the bottom into a floating panel
   anchored to the button at bottom-right.
   ================================================================= */
@media (min-width: 768px) {
  .mn-chat-btn { right: 24px; bottom: 24px; width: 58px; height: 58px; }
  .mn-chat-btn svg { width: 26px; height: 26px; }

  .mn-chat-panel {
    left: auto;
    right: 24px;
    bottom: 94px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 130px);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    transform-origin: bottom right;
  }
  .mn-msg { font-size: 14px; }
  .mn-chip { font-size: 12px; padding: 6px 11px; }
  .mn-chat-input { font-size: 14px; min-height: 40px; }
}

/* =================================================================
   DESKTOP / laptop (>=1024px): a touch more room to breathe.
   ================================================================= */
@media (min-width: 1024px) {
  .mn-chat-panel {
    width: 380px;
    height: 560px;
  }
}

/* Motion-sensitive users: drop the pulse and the reveal transform. */
@media (prefers-reduced-motion: reduce) {
  .mn-chat-btn { animation: none; }
  .mn-chat-panel { transition: opacity 0.12s ease; transform: none; }
}
