/**
 * offline-tools.css
 * Styles for the Phase 10 tools: library search (in My Library), the page
 * setup preview, reading profiles, document comparison. Everything here is
 * scoped to ts- classes added by those tools, so the existing interface is
 * unchanged while their flags are off.
 */

/* ============================================
   LIBRARY SEARCH
   ============================================ */

.ts-lib-search {
  margin: 0.75rem 0 0.5rem;
}

.ts-lib-search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.ts-lib-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(127, 127, 127, 0.45);
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
}

.ts-lib-search-input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.ts-lib-search-status {
  margin: 0.4rem 0 0;
  font-size: 0.9em;
  opacity: 0.8;
}

.ts-lib-results {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  max-height: 55vh;
  overflow: auto;
}

.ts-lib-result {
  border: 1px solid rgba(127, 127, 127, 0.3);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
}

.ts-lib-result-head {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.ts-lib-result-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ts-lib-result-count {
  font-size: 0.85em;
  opacity: 0.75;
  white-space: nowrap;
}

.ts-lib-snippets {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.ts-lib-snippet {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
  line-height: 1.45;
}

.ts-lib-snippet:hover {
  background: rgba(37, 99, 235, 0.1);
}

.ts-lib-snippet:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.ts-lib-snippet mark {
  background: #fde047;
  color: #1a1a1a;
  border-radius: 2px;
  padding: 0 1px;
}

.ts-lib-snippet-kind {
  font-weight: 600;
  margin-right: 0.25rem;
}

/* ============================================
   PAGE SETUP PREVIEW
   ============================================ */

.ts-page-previews {
  margin-top: 0.5rem;
}

.ts-page-previews img {
  vertical-align: top;
}

/* ============================================
   READING PROFILES (quick menu)
   ============================================ */

.ts-profile-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.ts-profile-switch select {
  font: inherit;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  max-width: 100%;
}

.ts-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

/* ============================================
   COMPARE DOCUMENTS
   ============================================ */

.ts-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ts-cmp-summary {
  font-weight: 600;
}

.ts-cmp-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  align-items: center;
  margin: 0.5rem 0;
}

.ts-cmp-view {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid rgba(127, 127, 127, 0.35);
  border-radius: 8px;
  padding: 0.4rem;
}

.ts-cmp-view:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.ts-cmp-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-left: 4px solid transparent;
  margin: 0.15rem 0;
  border-radius: 4px;
}

.ts-cmp-marker {
  width: 1.2em;
  flex: none;
  font-weight: 700;
  text-align: center;
}

.ts-cmp-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ts-cmp-added { border-color: #1a7f37; background: rgba(26, 127, 55, 0.12); }
.ts-cmp-removed { border-color: #b42318; background: rgba(180, 35, 24, 0.10); }
.ts-cmp-removed > .ts-cmp-text { text-decoration: line-through; }
.ts-cmp-changed { border-color: #9a6700; background: rgba(154, 103, 0, 0.10); }
.ts-cmp-moved-in, .ts-cmp-moved-out { border-color: #1d4ed8; background: rgba(29, 78, 216, 0.10); }
.ts-cmp-h { font-weight: 700; }
.ts-cmp-h1 { font-size: 1.25em; }
.ts-cmp-h2 { font-size: 1.1em; }

.ts-cmp-view ins {
  background: rgba(26, 127, 55, 0.3);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.ts-cmp-view del {
  background: rgba(180, 35, 24, 0.25);
  text-decoration: line-through;
}

.ts-cmp-side .ts-cmp-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.ts-cmp-pair.ts-cmp-added,
.ts-cmp-pair.ts-cmp-removed,
.ts-cmp-pair.ts-cmp-changed,
.ts-cmp-pair.ts-cmp-moved-in,
.ts-cmp-pair.ts-cmp-moved-out {
  background: transparent;
  border: 0;
}

.ts-cmp-gap {
  text-align: center;
  font-size: 0.85em;
  opacity: 0.7;
  padding: 0.2rem;
}

.ts-cmp-current {
  outline: 3px solid #2563eb;
  outline-offset: 1px;
  border-radius: 4px;
}

@media (max-width: 700px) {
  .ts-cmp-side .ts-cmp-pair {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ts-lib-snippet {
    transition: none;
  }
}
