/* Mira: example AI assistant panel (earthy, hairline style) */

.mira-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 58px;
  padding: 9px 24px 9px 9px;
  border: 1px solid rgba(251, 248, 243, .25); border-radius: 999px;
  background: var(--olive, #5B5A3A); color: #FBF8F3;
  font-family: var(--sans, sans-serif);
  font-size: .6875rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 18px 40px -18px rgba(46, 43, 37, .6);
  transition: transform .3s var(--ease, ease), background-color .3s var(--ease, ease), opacity .2s;
}
.mira-launcher img { width: 38px; height: 38px; border-radius: 50%; }
.mira-launcher:hover { transform: translateY(-2px); background: var(--olive-ink, #44432A); }
.mira-launcher:focus-visible { outline: 2px solid var(--olive, #5B5A3A); outline-offset: 4px; }
.mira-launcher[aria-expanded="true"] { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.9); }
@media (max-width: 560px) {
  .mira-launcher { right: 16px; bottom: 16px; padding: 7px 18px 7px 7px; min-height: 52px; }
}

.mira-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 70;
  width: min(400px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 48px));
  height: min(640px, calc(100dvh - 48px));
  display: flex; flex-direction: column;
  background: var(--surface, #FBF8F3);
  border: 1px solid var(--line, #D8CDBC);
  border-radius: 4px;
  box-shadow: 0 30px 80px -30px rgba(46, 43, 37, .5);
  overflow: hidden;
  transform-origin: bottom right;
  font-family: var(--sans, sans-serif);
}
.mira-panel[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .mira-panel.is-entering { animation: mira-in .36s var(--ease, ease) both; }
  @keyframes mira-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

.mira-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 12px 16px 18px;
  border-bottom: 1px solid var(--line, #D8CDBC);
  background: var(--stone, #EEE7DC);
}
.mira-head img { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.mira-head > div { flex: 1; min-width: 0; }
.mira-head h2 { font-family: var(--serif, serif); font-size: 1.5rem; font-weight: 400; line-height: 1.1; }
.mira-head p { margin-top: 2px; font-size: .5625rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted, #696257); }
.mira-close {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink, #2E2B25);
  cursor: pointer;
}
.mira-close:hover { background: rgba(46, 43, 37, .07); }

.mira-log {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.mira-log:focus-visible { outline-offset: -3px; }
.mira-msg {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: .9375rem; line-height: 1.55;
  overflow-wrap: anywhere;
}
.mira-msg p + p, .mira-msg p + ul, .mira-msg ul + p { margin-top: 8px; }
.mira-msg ul { margin: 6px 0 0; padding-left: 18px; }
.mira-msg li + li { margin-top: 3px; }
.mira-msg a { color: inherit; font-weight: 600; text-underline-offset: 3px; }
.mira-bot { align-self: flex-start; background: var(--stone, #EEE7DC); color: var(--ink, #2E2B25); border-bottom-left-radius: 3px; }
.mira-user { align-self: flex-end; background: var(--olive, #5B5A3A); color: #FBF8F3; border-bottom-right-radius: 3px; }
/* Safety messages stay clearly distinct */
.mira-alert { background: #F7E6DF; border: 1px solid #C98A72; color: #5A2112; }
.mira-alert a { color: #7A2A15; }
.mira-care { background: var(--sage-soft, #E4E3D3); }

.mira-typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.mira-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted, #696257); opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .mira-typing span { animation: mira-dot 1s infinite ease-in-out; }
  .mira-typing span:nth-child(2) { animation-delay: .15s; }
  .mira-typing span:nth-child(3) { animation-delay: .3s; }
  @keyframes mira-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
}

.mira-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 6px 16px 12px;
}
.mira-chips:empty { display: none; }
.mira-chip {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--olive, #5B5A3A);
  border-radius: 999px;
  background: transparent;
  color: var(--olive, #5B5A3A);
  font-size: .8125rem; font-weight: 500;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.mira-chip:hover { background: var(--olive, #5B5A3A); color: #FBF8F3; }

.mira-form {
  display: flex; gap: 8px;
  padding: 12px 12px 8px 16px;
  border-top: 1px solid var(--line, #D8CDBC);
}
.mira-form input {
  flex: 1; min-width: 0;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--line, #D8CDBC);
  border-radius: 999px;
  background: var(--cream, #F6F2EB);
  font-size: 1rem;
}
.mira-form input:focus { outline: none; border-color: var(--olive, #5B5A3A); box-shadow: 0 0 0 3px rgba(91, 90, 58, .15); background: #FFFDF9; }
.mira-send {
  width: 46px; height: 46px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: var(--olive, #5B5A3A); color: #FBF8F3;
  cursor: pointer;
}
.mira-send:hover { background: var(--olive-ink, #44432A); }
.mira-foot { padding: 0 16px 12px; font-size: .75rem; color: var(--muted, #696257); line-height: 1.45; }

@media (max-width: 560px) {
  .mira-panel {
    inset: 0;
    width: 100%; height: 100%;
    border-radius: 0; border: 0;
  }
  .mira-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .mira-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  body.mira-open { overflow: hidden; }
}

/* Small screens: icon-only launcher so it never covers the Book button (label kept for screen readers) */
@media (max-width: 560px) {
  .mira-launcher { padding: 6px; min-height: 0; gap: 0; }
  .mira-launcher-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}
