/* ==========================================================================
   SecurityCipher Researcher Workspace Shelf Stylesheet
   Specification: Phase 4 & Phase 5E User Experience Architecture
   Strict adherence to DESIGN_SYSTEM.md tokens
   ========================================================================== */

/* 1. Global Navigation Shelf Trigger Button */
.sc-nav-shelf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #c6ccd8;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sc-nav-shelf-btn:hover {
  border-color: #1fdeaf;
  background: rgba(31, 222, 175, 0.08);
  color: #fff;
  box-shadow: 0 0 14px rgba(31, 222, 175, 0.15);
}

.sc-shelf-icon {
  font-size: 16px;
  line-height: 1;
}

.sc-shelf-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #1fdeaf;
  color: #080c15;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(31, 222, 175, 0.6);
}

/* 2. Page Bookmark Toggle Pill */
.sc-bookmark-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #78838f;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  vertical-align: middle;
}

.sc-bookmark-toggle-btn:hover {
  border-color: rgba(31, 222, 175, 0.4);
  color: #fff;
  background: rgba(31, 222, 175, 0.08);
}

.sc-bookmark-toggle-btn.is-bookmarked {
  border-color: #1fdeaf;
  color: #1fdeaf;
  background: rgba(31, 222, 175, 0.12);
}

.sc-bookmark-icon {
  font-size: 12px;
  line-height: 1;
}

/* 3. Sliding Shelf Drawer Overlay */
.sc-shelf {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  justify-content: flex-end;
}

.sc-shelf[hidden] {
  display: none !important;
}

body.sc-shelf-open {
  overflow: hidden;
}

.sc-shelf-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 21, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sc-shelf-drawer {
  position: relative;
  width: min(480px, 100%);
  height: 100%;
  background: #0d131f;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  animation: scShelfSlideIn 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes scShelfSlideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-shelf-drawer {
    animation: none !important;
  }
}

/* Header */
.sc-shelf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sc-shelf-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1fdeaf;
  margin-bottom: 4px;
}

.sc-kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: #1fdeaf;
  box-shadow: 0 0 6px #1fdeaf;
}

.sc-shelf-title {
  margin: 0;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.sc-shelf-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #78838f;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  transition: all 0.15s ease;
}

.sc-shelf-close-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Tabs */
.sc-shelf-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(8, 12, 21, 0.5);
  overflow-x: auto;
}

.sc-shelf-tab {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #78838f;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-shelf-tab:hover {
  color: #c6ccd8;
}

.sc-shelf-tab.is-active {
  color: #1fdeaf;
  background: rgba(31, 222, 175, 0.12);
  border-color: rgba(31, 222, 175, 0.3);
}

/* Body & Panes */
.sc-shelf-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.sc-shelf-pane {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.sc-shelf-pane.is-active {
  display: flex;
}

/* Bookmark Filter Bar */
.sc-shelf-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.sc-shelf-filter-pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #78838f;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.sc-shelf-filter-pill:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.sc-shelf-filter-pill.is-active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* Shelf Lists & Items */
.sc-shelf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sc-shelf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.15s ease;
}

.sc-shelf-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(31, 222, 175, 0.3);
}

.sc-shelf-item-link {
  flex: 1;
  min-width: 0;
  text-decoration: none !important;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sc-shelf-item-badge {
  align-self: flex-start;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  line-height: 1;
}

.sc-shelf-item-badge.sc-badge-cve {
  color: #ff5a5f;
  background: rgba(255, 90, 95, 0.12);
  border-color: rgba(255, 90, 95, 0.3);
}

.sc-shelf-item-badge.sc-badge-chk {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.sc-shelf-item-badge.sc-badge-lab {
  color: #1fdeaf;
  background: rgba(31, 222, 175, 0.12);
  border-color: rgba(31, 222, 175, 0.3);
}

.sc-shelf-item-title {
  color: #fff;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-shelf-item-meta {
  color: #78838f;
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
}

.sc-shelf-item-remove {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #78838f;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 11px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sc-shelf-item-remove:hover {
  border-color: rgba(255, 90, 95, 0.3);
  background: rgba(255, 90, 95, 0.1);
  color: #ff5a5f;
}

/* History Controls */
.sc-shelf-hist-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sc-shelf-hist-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  color: #c6ccd8;
}

.sc-hist-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
}

.sc-hist-dot.is-active {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.sc-hist-dot.is-paused {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.sc-shelf-hist-actions {
  display: flex;
  gap: 6px;
}

.sc-shelf-sub-btn {
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c6ccd8;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.sc-shelf-sub-btn:hover {
  border-color: rgba(31, 222, 175, 0.4);
  color: #1fdeaf;
  background: rgba(31, 222, 175, 0.08);
}

.sc-shelf-sub-btn-danger:hover {
  border-color: rgba(255, 90, 95, 0.4);
  color: #ff5a5f;
  background: rgba(255, 90, 95, 0.1);
}

/* Progress Pane (Checklists & Labs) */
.sc-shelf-section-title {
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1fdeaf;
  margin: 12px 0 4px;
}

.sc-shelf-section-title:first-child {
  margin-top: 0;
}

.sc-shelf-item-prog {
  align-items: center;
}

.sc-shelf-chk-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.sc-shelf-resume-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(31, 222, 175, 0.3);
  background: rgba(31, 222, 175, 0.1);
  color: #1fdeaf;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sc-shelf-resume-btn:hover {
  background: rgba(31, 222, 175, 0.2);
  color: #fff;
  border-color: #1fdeaf;
}

/* Privacy & Sovereign Data Box */
.sc-shelf-privacy-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sc-privacy-badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sc-privacy-heading {
  margin: 0;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.sc-privacy-desc {
  margin: 0;
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 12.5px;
  line-height: 1.6;
  color: #78838f;
}

.sc-privacy-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.sc-privacy-metric {
  padding: 10px;
  border-radius: 8px;
  background: rgba(8, 12, 21, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sc-metric-val {
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: #1fdeaf;
}

.sc-metric-lbl {
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 10.5px;
  color: #78838f;
}

.sc-privacy-actions {
  margin-top: 4px;
}

.sc-privacy-hint {
  margin: 0;
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
  line-height: 1.5;
  color: #78838f;
}

/* Empty State */
.sc-shelf-empty {
  padding: 40px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sc-shelf-empty-icon {
  font-size: 28px;
  opacity: 0.6;
  margin-bottom: 4px;
}

.sc-shelf-empty-title {
  margin: 0;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 14.5px;
  font-weight: 600;
  color: #c6ccd8;
}

.sc-shelf-empty-desc {
  margin: 0;
  max-width: 340px;
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 12.5px;
  line-height: 1.55;
  color: #78838f;
}

.sc-shelf-empty-desc a {
  color: #38bdf8;
  text-decoration: underline;
}

/* Footer & Actions */
.sc-shelf-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 21, 0.8);
}

.sc-shelf-btn {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c6ccd8;
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.sc-shelf-btn:hover {
  border-color: rgba(31, 222, 175, 0.4);
  color: #1fdeaf;
  background: rgba(31, 222, 175, 0.1);
}

.sc-shelf-btn-import {
  cursor: pointer;
}

.sc-shelf-btn-danger {
  color: #ff5a5f;
  border-color: rgba(255, 90, 95, 0.2);
  background: rgba(255, 90, 95, 0.05);
  flex: 0 0 auto;
}

.sc-shelf-btn-danger:hover {
  border-color: #ff5a5f;
  color: #fff;
  background: rgba(255, 90, 95, 0.2);
}

/* Screen reader announcement utility */
.sc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Mobile Responsive Enhancements (Phase 5E Mobile Hardening) */
@media (max-width: 640px) {
  .sc-shelf-drawer {
    width: 100% !important;
    max-width: 100vw !important;
    border-left: none !important;
  }

  .sc-shelf-header {
    padding: 16px 16px 12px;
  }

  .sc-shelf-close-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    font-size: 15px;
  }

  .sc-shelf-tabs {
    padding: 8px 12px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }

  .sc-shelf-tab {
    flex: 0 0 auto;
    min-width: auto;
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  .sc-shelf-filter-bar {
    padding: 8px 12px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }

  .sc-shelf-filter-pill {
    flex-shrink: 0;
    min-height: 30px;
  }

  .sc-shelf-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .sc-shelf-btn {
    min-height: 38px;
    height: 38px;
    font-size: 12px;
  }

  .sc-bookmark-toggle-btn {
    min-width: 36px;
    min-height: 36px;
  }
}
