/* Page-share UI — floating "共有" button + popover. Only loaded on the
   authenticated site (index.html), never on the public /p/<token> page.
   Accent colour reuses docsify-themeable's --theme-color token. */

.kn-share {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  font-family: inherit;
}

.kn-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #2c3e50;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.kn-share__btn:hover { background: #f6f8fa; }
.kn-share__btn:focus-visible { outline: 2px solid var(--theme-color, #42b983); outline-offset: 2px; }

.kn-share__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0c4cc;
  flex: 0 0 auto;
}
.kn-share--on .kn-share__dot { background: var(--theme-color, #42b983); }

.kn-share__panel {
  position: absolute;
  top: 44px;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  display: none;
}
.kn-share--open .kn-share__panel { display: block; }

.kn-share__title { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: #2c3e50; }

.kn-share__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kn-share__row-label { font-size: 14px; color: #2c3e50; }

/* toggle switch — 44px tall hit area with a 44×24 visual track centered in it */
.kn-switch { position: relative; display: inline-block; width: 44px; height: 44px; flex: 0 0 auto; cursor: pointer; }
.kn-switch input { opacity: 0; width: 0; height: 0; }
.kn-switch__slider {
  position: absolute;
  left: 0;
  top: 10px;
  width: 44px;
  height: 24px;
  background: #c0c4cc;
  border-radius: 24px;
  transition: background 0.15s;
  cursor: pointer;
}
.kn-switch__slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.kn-switch input:checked + .kn-switch__slider { background: var(--theme-color, #42b983); }
.kn-switch input:checked + .kn-switch__slider::before { transform: translateX(20px); }
.kn-switch input:disabled + .kn-switch__slider { opacity: 0.5; cursor: default; }

.kn-share__link {
  margin-top: 12px;
  display: none;
}
.kn-share--on .kn-share__link { display: block; }
.kn-share__url-row { display: flex; gap: 6px; }
.kn-share__url {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  background: #f6f8fa;
  color: #2c3e50;
}
.kn-share__copy, .kn-share__open {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--theme-color, #42b983);
  background: var(--theme-color, #42b983);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.kn-share__open { background: #fff; color: var(--theme-color, #42b983); }

.kn-share__hint { margin: 10px 0 0; font-size: 11px; color: #7f8c8d; line-height: 1.5; }
.kn-share__msg { margin: 8px 0 0; font-size: 12px; min-height: 16px; }
.kn-share__msg--err { color: #e74c3c; }
.kn-share__msg--ok { color: var(--theme-color, #42b983); }
