/* MVP: keep minimal; Tailwind via CDN */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

/* iOS: prevent auto-zoom on small font inputs */
@media (max-width: 640px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Dialog baseline (some pages use <dialog>) */
dialog {
  max-width: calc(100vw - 24px);
  border-radius: 16px;
}

/* Lightweight "prose" for report views (Tailwind typography plugin isn't loaded via CDN) */
.prose {
  color: #0f172a;
  font-size: 15px;
  line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3 {
  font-weight: 700;
  line-height: 1.25;
  margin: 1.1em 0 0.6em;
}

.prose h1 {
  font-size: 1.35rem;
}

.prose h2 {
  font-size: 1.15rem;
}

.prose h3 {
  font-size: 1.05rem;
}

.prose p {
  margin: 0.75em 0;
}

.prose ul,
.prose ol {
  margin: 0.75em 0;
  padding-left: 1.25rem;
}

.prose li {
  margin: 0.25em 0;
}

.prose a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
  background: rgba(15, 23, 42, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.prose pre {
  overflow-x: auto;
  background: rgba(15, 23, 42, 0.06);
  padding: 12px;
  border-radius: 12px;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

/* ---------------------------
   Marllen Assistant polish
   --------------------------- */

.marllen-md {
  color: #0f172a;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.6;
}

.marllen-md p {
  margin: 0.6em 0;
}

.marllen-md h1,
.marllen-md h2,
.marllen-md h3,
.marllen-md h4 {
  font-weight: 700;
  line-height: 1.25;
  margin: 0.9em 0 0.5em;
}

.marllen-md h1 { font-size: 1.05rem; }
.marllen-md h2 { font-size: 0.98rem; }
.marllen-md h3 { font-size: 0.94rem; }
.marllen-md h4 { font-size: 0.90rem; }

.marllen-md ul,
.marllen-md ol {
  margin: 0.6em 0;
  padding-left: 1.2rem;
}

.marllen-md li {
  margin: 0.2em 0;
}

.marllen-md a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.marllen-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
  background: rgba(15, 23, 42, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.marllen-md pre {
  overflow-x: auto;
  background: rgba(15, 23, 42, 0.06);
  padding: 10px;
  border-radius: 12px;
}

.marllen-md pre code {
  background: transparent;
  padding: 0;
}

.marllen-chart {
  /* ensure crisp chart rendering on translucent bg */
  background: #ffffff;
}

.marllen-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@keyframes marllenTypingDot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.marllen-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.85); /* slate-500-ish */
  animation: marllenTypingDot 1.15s infinite ease-in-out;
}

.marllen-typing-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.marllen-typing-dot:nth-child(3) {
  animation-delay: 0.24s;
}

/* Subtle scrollbar for the assistant message list */
#marllenAssistantMessages,
#marllenAssistantThreadsList {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

#marllenAssistantMessages::-webkit-scrollbar {
  width: 10px;
}

#marllenAssistantMessages::-webkit-scrollbar-track {
  background: transparent;
}

#marllenAssistantMessages::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

#marllenAssistantMessages:hover::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.26);
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* Brand logo (from Marllen assistant share floating button) */
.marllen-logo {
  display: inline-block;
  background: #000;
  /* Use relative URL so it works even if the app is mounted under a path prefix. */
  -webkit-mask-image: url("./marllen_clover.png");
  mask-image: url("./marllen_clover.png");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Better pointer handling for draggable assistant */
#marllenAssistantFab,
#marllenAssistantHeader {
  touch-action: none;
}

/* Mobile perf: backdrop blur + inner scroll can feel janky on iOS */
@media (max-width: 640px) {
  #marllenAssistantPanel,
  #marllenAssistantHeader,
  #marllenAssistantThreadsOverlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(255, 255, 255, 0.98) !important;
  }
}
