/*
 * SEBook bookmark and course-index pages.
 *
 * Content pages provide structure. This module owns presentation for the
 * personal bookmark manager plus the CS 130 / CS 35L bookmark indexes.
 */

#bookmarks-app {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 0 40px;
}

.bookmarks-controls {
  background: #f8f9fa;
  border: 1px solid #e1e4e8;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 24px;
}

.bookmarks-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.bookmarks-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bookmarks-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #555;
  color: #fff;
  border: none;
  padding: 0;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  user-select: none;
  margin-left: 4px;
  flex-shrink: 0;
}

.bookmarks-info-btn:hover,
.bookmarks-info-btn:focus {
  background: #333;
  outline: 3px solid #2774AE;
  outline-offset: 2px;
}

.bookmarks-info-btn:focus:not(:focus-visible) {
  outline: none;
}

.bookmarks-info-btn:focus-visible {
  outline: 3px solid #2774AE;
  outline-offset: 2px;
}

.bookmarks-info-tooltip {
  display: none;
  position: absolute;
  left: -20px;
  top: calc(100% + 8px);
  background: #333;
  color: #fff;
  font-size: 1.2em;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: 6px;
  width: 260px;
  max-width: 85vw;
  line-height: 1.4;
  z-index: 100;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.bookmarks-info-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 24px;
  border: 6px solid transparent;
  border-bottom-color: #333;
}

.bookmarks-info-btn:hover .bookmarks-info-tooltip,
.bookmarks-info-btn:focus .bookmarks-info-tooltip,
.bookmarks-info-btn:focus-within .bookmarks-info-tooltip,
.bookmarks-info-btn.active .bookmarks-info-tooltip {
  display: block;
}

#bookmarks-list-section h2 {
  color: #2774AE;
  font-weight: 700;
  border-bottom: 2px solid #e1e4e8;
  padding-bottom: 8px;
  margin-bottom: 16px;
  -webkit-text-stroke: 0;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fff;
  transition: background 0.2s;
}

.bookmark-item:hover {
  background: #f6f8fa;
}

.bookmark-item a,
.bookmark-item a:visited {
  color: #2774AE;
  text-decoration: none;
  font-weight: 500;
  flex: 1;
}

.bookmark-item a:hover {
  text-decoration: underline;
}

.bookmark-item-icon {
  margin-right: 8px;
  color: #2774AE;
}

.bookmark-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #767676;
  font-size: 1em;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  margin-left: 12px;
  flex-shrink: 0;
}

.bookmark-remove-btn:hover,
.bookmark-remove-btn:focus-visible {
  color: #8a1a13;
  background: #ffeef0;
}

#no-bookmarks-msg {
  color: #555;
  font-style: italic;
  margin: 0;
}

.bookmarks-intro,
.course-bookmarks-intro {
  color: #555;
  margin-bottom: 20px;
}

.course-bookmarks {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 0 40px;
}

.course-bookmarks-topic-group {
  margin-bottom: 8px;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  overflow: hidden;
}

.course-bookmarks-topic-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8f9fa;
  color: #2774AE;
  font-weight: 600;
  font-size: 1em;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.course-bookmarks-topic-link:hover,
.course-bookmarks-topic-link:focus-visible {
  background: #eef3f8;
  text-decoration: none;
  color: #1a5a9f;
}

.course-bookmarks-topic-link i {
  font-size: 0.9em;
  color: #2774AE;
  flex-shrink: 0;
}

.course-bookmarks-subtopic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #e1e4e8;
}

.course-bookmarks-subtopic-list li {
  border-bottom: 1px solid #f0f0f0;
}

.course-bookmarks-subtopic-list li:last-child {
  border-bottom: none;
}

.course-bookmarks-subtopic-list a,
.course-bookmarks-subtopic-list a:visited {
  display: block;
  padding: 9px 16px 9px 40px;
  color: #2774AE;
  text-decoration: none;
  font-size: 0.95em;
  transition: background 0.15s, color 0.15s;
}

.course-bookmarks-subtopic-list a:hover,
.course-bookmarks-subtopic-list a:focus-visible {
  background: #f0f4f8;
  text-decoration: none;
}

html.dark-mode .bookmarks-controls {
  background: #1e2a35;
  border-color: #3a4a5a;
}

html.dark-mode .bookmarks-intro,
html.dark-mode .course-bookmarks-intro {
  color: #b0b8c4;
}

html.dark-mode .bookmarks-info-btn {
  background: #666;
}

html.dark-mode .bookmarks-info-btn:hover,
html.dark-mode .bookmarks-info-btn:focus {
  background: #888;
}

html.dark-mode .bookmarks-info-btn:focus-visible {
  outline-color: #FFD100;
}

html.dark-mode .bookmark-item,
html.dark-mode .course-bookmarks-topic-link {
  background: #1e2a35;
  border-color: #3a4a5a;
}

html.dark-mode .bookmark-item:hover,
html.dark-mode .course-bookmarks-topic-link:hover,
html.dark-mode .course-bookmarks-topic-link:focus-visible,
html.dark-mode .course-bookmarks-subtopic-list a:hover,
html.dark-mode .course-bookmarks-subtopic-list a:focus-visible {
  background: #25343f;
}

html.dark-mode #no-bookmarks-msg {
  color: #aaa;
}

html.dark-mode #bookmarks-list-section h2 {
  border-bottom-color: #3a4a5a;
}

html.dark-mode .course-bookmarks-topic-group {
  border-color: #3a4a5a;
}

html.dark-mode .course-bookmarks-topic-link,
html.dark-mode .course-bookmarks-topic-link i,
html.dark-mode .course-bookmarks-subtopic-list a,
html.dark-mode .course-bookmarks-subtopic-list a:visited {
  color: #FFD100;
}

html.dark-mode .course-bookmarks-subtopic-list {
  border-top-color: #3a4a5a;
}

html.dark-mode .course-bookmarks-subtopic-list li {
  border-bottom-color: #2a3a4a;
}

@media print {
  .bookmarks-controls,
  .bookmark-item,
  .course-bookmarks-topic-group,
  .course-bookmarks-topic-link {
    background: #fff !important;
    border-color: #767676 !important;
    color: #111 !important;
    box-shadow: none !important;
  }

  .bookmarks-intro,
  .course-bookmarks-intro,
  #no-bookmarks-msg {
    color: #111 !important;
  }

  .bookmarks-info-tooltip {
    display: none !important;
  }
}
