/* Sahi — content.css
 * Everything here is chrome sitting on top of somebody else's product, so it
 * stays quiet: hairline borders, one weight of shadow, no brand colour except
 * in the underlines, where colour is the only thing carrying meaning.
 *
 * All rules are namespaced and all values are literal — no custom properties,
 * because the host page's :root is not ours to read from.
 */

#sahi-underline-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
}

.sahi-mark {
  position: fixed;
  height: 2px;
  pointer-events: auto;
  cursor: pointer;
  border-radius: 2px;
}
.sahi-mark::after {
  content: '';
  position: absolute;
  inset: -10px -2px -2px;
}
.sahi-mark--spelling    { background: #e5484d; }
.sahi-mark--grammar     { background: #f5a524; }
.sahi-mark--punctuation { background: #f5a524; }
.sahi-mark--clarity     { background: #3e63dd; }
.sahi-mark--tone        { background: #8e4ec6; }

.sahi-mirror {
  position: absolute;
  top: -9999px;
  left: -9999px;
  visibility: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ---- suggestion card ---- */

.sahi-card,
.sahi-menu {
  position: fixed;
  z-index: 2147483001;
  background: #ffffff;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #101828;
}

.sahi-card {
  width: 296px;
  padding: 12px 14px 12px;
}

.sahi-card__head { margin-bottom: 8px; }

.sahi-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  background: #f2f4f7;
  color: #667085;
}
.sahi-tag--spelling { background: #fdeced; color: #b42318; }
.sahi-tag--grammar,
.sahi-tag--punctuation { background: #fdf3e2; color: #a15c07; }
.sahi-tag--clarity { background: #eef2ff; color: #3538cd; }
.sahi-tag--tone { background: #f6edfb; color: #6c2bb9; }

/* The correction reads as a diff — struck original, arrow, replacement.
   Monospace here so the two halves line up and the change is unmissable. */
.sahi-diff {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  word-break: break-word;
}
.sahi-diff__from  { color: #b42318; text-decoration: line-through; }
.sahi-diff__arrow { color: #98a2b3; }
.sahi-diff__to    { color: #101828; font-weight: 600; }

.sahi-card__msg {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #475467;
}

.sahi-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sahi-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid #e4e7ec;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
}
.sahi-btn:hover { background: #f9fafb; }
.sahi-btn:focus-visible { outline: 2px solid #3e63dd; outline-offset: 1px; }
.sahi-btn--primary {
  background: #101828;
  border-color: #101828;
  color: #ffffff;
}
.sahi-btn--primary:hover { background: #1d2939; }

.sahi-card__more {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f2f4f7;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sahi-chip {
  font: inherit;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #e4e7ec;
  background: #ffffff;
  color: #475467;
  cursor: pointer;
}
.sahi-chip:hover { border-color: #d0d5dd; background: #f9fafb; }

/* ---- badge ---- */

.sahi-badge {
  position: fixed;
  z-index: 2147483001;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: #e5484d;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.24);
  cursor: pointer;
}
.sahi-badge--clean { background: #0f9d58; }
.sahi-badge--clean::after { content: '✓'; font-size: 13px; }
.sahi-badge--busy { background: #98a2b3; }
.sahi-badge--busy::after {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: sahi-spin 0.7s linear infinite;
}
@keyframes sahi-spin { to { transform: rotate(360deg); } }

.sahi-menu {
  width: 190px;
  padding: 5px;
}
.sahi-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #344054;
  cursor: pointer;
}
.sahi-menu__item:hover { background: #f2f4f7; }

/* ---- toast ---- */

.sahi-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483002;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.24);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.sahi-toast--error { background: #b42318; }
.sahi-toast--out { opacity: 0; transform: translateY(6px); }

@media (prefers-reduced-motion: reduce) {
  .sahi-toast { transition: none; }
  .sahi-badge--busy::after { animation: none; }
}
