/* ============================================================
   SportHub Progress — sidebar with Comments / Bug-reports tabs
   and per-item Mark-done.
   ============================================================ */

.sh-progress {
  --sh-acc: #2563eb;
  --sh-acc-d: #1d4ed8;
  --sh-hi: rgba(253, 224, 71, .45);
  --sh-hi-strong: rgba(253, 186, 0, .85);
  --sh-bd: #e5e7eb;
  --sh-text: #111827;
  --sh-muted: #6b7280;
  --sh-bg: #ffffff;
  --sh-bg-soft: #f9fafb;
  --sh-ok: #059669;
  --sh-ok-bg: #d1fae5;
  --sidebar-w: 380px;

  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: var(--sh-text);
  position: relative;
}

/* ---------- top toolbar ---------- */
.sh-progress-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(255,255,255,1) 70%, rgba(255,255,255,0));
  padding-bottom: .5rem;
}
body.admin-bar .sh-progress-toolbar { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .sh-progress-toolbar { top: 46px; }
}
.sh-progress-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--sh-bg);
  border: 1px solid var(--sh-bd);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .9rem;
  cursor: pointer;
  color: var(--sh-text);
  transition: background .15s, border-color .15s;
}
.sh-progress-toggle:hover { background: var(--sh-bg-soft); border-color: #cbd5e1; }
.sh-progress-toggle-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sh-acc);
  color: white;
  border-radius: 999px;
  padding: 0 8px;
  font-size: .75rem;
  font-weight: 600;
  min-width: 22px;
  height: 20px;
}
.sh-progress-toggle-count[data-count="0"] { display: none; }

/* ---------- markdown body ---------- */
.sh-progress-body {
  max-width: 820px;
  margin: 0 auto;
}
.sh-progress-body h1 { font-size: 2rem; margin-top: 0; }
.sh-progress-body h2 { font-size: 1.4rem; margin-top: 2rem; border-bottom: 1px solid var(--sh-bd); padding-bottom: .3rem; }
.sh-progress-body h3 { font-size: 1.1rem; margin-top: 1.4rem; }
.sh-progress-body ul, .sh-progress-body ol { padding-left: 1.5rem; }
.sh-progress-body li { margin: .25rem 0; }
.sh-progress-body code { background: #f3f4f6; padding: 1px 6px; border-radius: 3px; font-size: 0.9em; }
.sh-progress-body table { border-collapse: collapse; margin: 1rem 0; }
.sh-progress-body th, .sh-progress-body td { border: 1px solid var(--sh-bd); padding: 6px 12px; text-align: left; vertical-align: top; }
.sh-progress-body th { background: var(--sh-bg-soft); }
.sh-progress-body blockquote {
  border-left: 3px solid var(--sh-acc);
  margin: 1rem 0;
  padding: .25rem 0 .25rem 1rem;
  color: var(--sh-text);
  background: rgba(37, 99, 235, .05);
}

/* Annotation highlight */
.sh-progress-body mark.sh-progress-mark {
  background: var(--sh-hi);
  color: inherit;
  cursor: pointer;
  border-radius: 2px;
  padding: 0 1px;
  transition: background .15s;
}
.sh-progress-body mark.sh-progress-mark.is-active {
  background: var(--sh-hi-strong);
  outline: 2px solid var(--sh-acc);
  outline-offset: 1px;
}

/* ---------- selection popover ---------- */
.sh-progress-selpop {
  position: absolute;
  z-index: 30;
  transform: translate(-50%, -100%);
  margin-top: -8px;
}
.sh-progress-selpop[hidden] { display: none; }
.sh-progress-selpop-btn {
  background: var(--sh-text);
  color: white;
  border: 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .85rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  white-space: nowrap;
}
.sh-progress-selpop-btn:hover { background: #000; }

/* ---------- sidebar ---------- */
.sh-progress-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sh-bg);
  border-left: 1px solid var(--sh-bd);
  box-shadow: -8px 0 24px rgba(0,0,0,.06);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sh-progress-sidebar.is-open { transform: translateX(0); }
body.admin-bar .sh-progress-sidebar { top: 32px; height: calc(100vh - 32px); }
.sh-progress-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--sh-bd);
  background: var(--sh-bg-soft);
}
.sh-progress-sidebar-header h2 { margin: 0; font-size: 1.05rem; }
.sh-progress-sidebar-close {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--sh-muted);
  padding: 0 4px;
}

/* ---------- tabs ---------- */
.sh-progress-tabs {
  display: flex;
  border-bottom: 1px solid var(--sh-bd);
  background: var(--sh-bg);
}
.sh-progress-tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 12px 14px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--sh-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}
.sh-progress-tab:hover { color: var(--sh-text); background: var(--sh-bg-soft); }
.sh-progress-tab.is-active {
  color: var(--sh-acc);
  border-bottom-color: var(--sh-acc);
  background: var(--sh-bg);
}
.sh-progress-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sh-bd);
  color: var(--sh-muted);
  border-radius: 999px;
  padding: 0 7px;
  font-size: .7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
}
.sh-progress-tab.is-active .sh-progress-tab-count {
  background: var(--sh-acc);
  color: white;
}

.sh-progress-sidebar-empty {
  padding: 24px 18px;
  color: var(--sh-muted);
  font-size: .9rem;
  text-align: center;
}
.sh-progress-sidebar-empty b { color: var(--sh-text); }

.sh-progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.sh-progress-list[hidden] { display: none; }

/* ---------- thread item ---------- */
.sh-progress-thread {
  padding: 12px 18px;
  border-bottom: 1px solid var(--sh-bd);
  transition: background .15s, opacity .2s;
  position: relative;
}
.sh-progress-thread.is-active {
  background: rgba(37, 99, 235, .05);
  box-shadow: inset 3px 0 0 var(--sh-acc);
}
.sh-progress-thread[data-resolved="true"] {
  background: var(--sh-bg-soft);
  opacity: .65;
}
.sh-progress-thread[data-resolved="true"] .sh-progress-thread-body {
  text-decoration: line-through;
  color: var(--sh-muted);
}

.sh-progress-thread-quote {
  font-size: .8rem;
  background: var(--sh-hi);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sh-progress-thread-page {
  font-size: .72rem;
  color: var(--sh-muted);
  margin-bottom: 6px;
}
.sh-progress-thread-page code {
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--sh-text);
  word-break: break-all;
}
.sh-progress-thread-body {
  font-size: .95rem;
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.sh-progress-thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  color: var(--sh-muted);
}
.sh-progress-thread-done-badge {
  background: var(--sh-ok-bg);
  color: var(--sh-ok);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
}

/* replies */
.sh-progress-replies {
  list-style: none;
  margin: 8px 0 0 16px;
  padding: 0;
  border-left: 2px solid var(--sh-bd);
}
.sh-progress-reply { padding: 8px 12px; }
.sh-progress-reply-body {
  font-size: .9rem;
  white-space: pre-wrap;
  margin-bottom: 2px;
  word-break: break-word;
}
.sh-progress-reply-time { font-size: .7rem; color: var(--sh-muted); }

/* reply form */
.sh-progress-reply-form,
.sh-progress-newform {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sh-progress-reply-form textarea,
.sh-progress-newform textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--sh-bd);
  border-radius: 4px;
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  box-sizing: border-box;
}
.sh-progress-reply-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sh-progress-reply-actions button[type="submit"] {
  background: var(--sh-acc);
  color: white;
  border: 0;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
}
.sh-progress-reply-actions button[type="submit"]:hover { background: var(--sh-acc-d); }
.sh-progress-reply-actions button:disabled { opacity: .5; cursor: not-allowed; }

/* resolve button */
.sh-progress-thread-resolve {
  background: transparent;
  border: 1px solid var(--sh-bd);
  color: var(--sh-muted);
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .8rem;
  font-family: inherit;
}
.sh-progress-thread-resolve:hover {
  background: var(--sh-ok-bg);
  color: var(--sh-ok);
  border-color: var(--sh-ok);
}
.sh-progress-thread[data-resolved="true"] .sh-progress-thread-resolve {
  background: var(--sh-ok-bg);
  color: var(--sh-ok);
  border-color: var(--sh-ok);
}
.sh-progress-thread[data-resolved="true"] .sh-progress-thread-resolve:hover {
  background: var(--sh-bg);
  color: var(--sh-muted);
  border-color: var(--sh-bd);
}

.sh-progress-newform {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sh-bd);
  background: var(--sh-bg-soft);
}
.sh-progress-newform-quote {
  font-size: .8rem;
  background: var(--sh-hi);
  padding: 4px 8px;
  border-radius: 4px;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sh-progress-newform-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.sh-progress-newform-cancel {
  background: transparent;
  color: var(--sh-muted);
  border: 1px solid var(--sh-bd);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
}
.sh-progress-newform button[type="submit"] {
  background: var(--sh-acc);
  color: white;
  border: 0;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
}

.sh-progress-msg {
  font-size: .8rem;
  color: #dc2626;
  margin-top: 2px;
}

/* ---------- backdrop (mobile drawer) ---------- */
.sh-progress-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sh-progress-backdrop.is-shown { opacity: 1; pointer-events: auto; }
.sh-progress-backdrop[hidden] { display: none; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .sh-progress { --sidebar-w: 100vw; padding: .5rem; }
  .sh-progress-sidebar {
    width: 100vw;
    height: 80vh;
    top: auto;
    bottom: 0;
    right: 0;
    border-left: 0;
    border-top: 1px solid var(--sh-bd);
    border-radius: 14px 14px 0 0;
    transform: translateY(100%);
  }
  .sh-progress-sidebar.is-open { transform: translateY(0); }
}

@media (min-width: 721px) {
  body.sh-progress-sidebar-open .sh-progress {
    padding-right: calc(1rem + var(--sidebar-w));
    transition: padding-right .25s ease;
  }
}

.sh-progress-error {
  padding: 1rem;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 4px;
}
