/* favorites.css */
/* Styles for the favorites extension */

/* Favorites Button */
.favorites-button-container {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  margin-top: 10px;
  margin-right: 10px;
}

/* Position the button with the title */
.quarto-title-banner, .title-block, .quarto-title-block {
  position: relative;
}

/* Special class added by our JavaScript */
.favorites-title-container .favorites-button-container {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
  z-index: 100;
}

.favorites-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 50%; /* Makes the button round */
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.favorites-button:hover {
  background-color: #e9ecef;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.favorites-icon {
  width: 20px;
  height: 20px;
  stroke: #6c757d; /* Gray outline for the heart icon */
  stroke-width: 2;
  fill: none; /* No fill by default */
  transition: all 0.2s ease;
}

.favorites-button.favorited .favorites-icon {
  stroke: #dc3545; /* Red outline when favorited */
  fill: #dc3545; /* Red fill when favorited */
}

/* Navbar icon styling moved to styles.css */

/* Text element removed, using title attribute for tooltip instead */

/* Favorites List */
.favorites-list-container {
  margin: 20px 0;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

/* Header with actions */
.favorites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.favorites-header h2 {
  margin: 0;
  color: #212529;
}

.favorites-actions {
  display: flex;
  gap: 8px;
}

.favorites-action-button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #495057;
}

.favorites-action-button:hover {
  background-color: #e9ecef;
  border-color: #ced4da;
}

.favorites-action-button svg {
  width: 16px;
  height: 16px;
}

.no-favorites-message {
  color: #6c757d;
  font-style: italic;
}

.favorites-items {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

/* Override default styles - these are replaced by new styles below */

.favorites-items a {
  text-decoration: none;
  color: var(--bs-link-color, var(--bs-primary, #0d6efd));
  flex-grow: 1;
}

.favorites-items a:hover {
  text-decoration: underline;
  color: var(--bs-link-hover-color, var(--bs-primary-dark, #0a58ca));
}

.remove-favorite {
  background: none;
  border: none;
  font-size: 18px;
  color: #6c757d;
  cursor: pointer;
  padding: 0 5px;
}

.remove-favorite:hover {
  color: #dc3545;
}

/* External link styles */
.external-favorite {
  background-color: #fff8f8; /* Very light pink background */
  border-left: 3px solid #dc3545; /* Red left border */
}

.external-warning {
  margin-right: 5px;
  font-size: 14px;
  opacity: 0.8;
}

.external-link {
  display: flex;
  align-items: center;
  color: #dc3545; /* Red text color */
}

.external-link:hover {
  color: #a71d2a; /* Darker red on hover */
}

/* Drag and drop styles */
.draggable-item {
  position: relative;
  cursor: move;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  padding: 0 8px;
  color: #adb5bd;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.draggable-item:hover .drag-handle {
  opacity: 1;
}

.draggable-item.dragging {
  opacity: 0.6;
  background-color: #e9ecef;
  z-index: 1000;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.draggable-item.drag-over {
  border-top: 2px solid var(--bs-primary, #0d6efd);
}

.drag-animation {
  transition: transform 0.2s ease;
}

.favorites-items li {
  display: flex;
  align-items: center;
  padding: 10px;
  margin-bottom: 5px;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.favorites-items li:last-child {
  margin-bottom: 0;
}

.favorite-link-container {
  flex-grow: 1;
  padding: 0 10px;
}

.reorder-message {
  margin-top: 15px;
  font-size: 14px;
  color: #6c757d;
  font-style: italic;
  text-align: center;
}

/* Section Divider Styles */
.section-divider {
  display: flex;
  align-items: center;
  margin: 15px 0;
  cursor: move;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 8px 12px;
  position: relative;
}

/* Help section styles */
.favorites-help {
  margin-top: 30px;
  padding: 15px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  color: #495057;
}

.favorites-help h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: #212529;
  margin-bottom: 10px;
}

.favorites-help p {
  margin-bottom: 10px;
}

.favorites-help ul {
  padding-left: 20px;
  margin-bottom: 0;
}

.section-divider-title {
  flex-grow: 1;
  font-weight: 500;
  color: #495057;
  margin: 0;
  font-size: 0.95rem;
}

.section-divider-edit {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 2px 5px;
  margin-right: 5px;
  font-size: 14px;
  opacity: 0.7;
}

.section-divider-edit:hover {
  opacity: 1;
}

.section-divider-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  padding: 0 8px;
  color: #adb5bd;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.section-divider:hover .section-divider-handle {
  opacity: 1;
}

/* Sidebar Favorites Styles */
.sidebar-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
  margin-bottom: 1.5rem; /* Add space at bottom */
}

/* Ensure compatibility with Quarto margin blocks */
.margin-sidebar .sidebar-section {
  margin-top: 2rem;
}

/* Sidebar Header with toggle */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  cursor: pointer;
  padding: 0.25rem 0;
  user-select: none;
  transition: color 0.2s ease;
}

.sidebar-header:hover .sidebar-title,
.sidebar-header:hover .sidebar-toggle-icon {
  color: var(--bs-link-hover-color, var(--bs-primary-dark, #0a58ca));
}

.sidebar-title {
  font-size: 0.875rem;
  font-weight: 400;
  color: #495057;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

/* Toggle icon styling */
.sidebar-toggle-icon {
  color: #6c757d;
  font-size: 0.75rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.3s ease, color 0.2s ease;
}

/* Collapsed state styling */
.sidebar-favorites-content {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-favorites-content.collapsed {
  max-height: 0;
}

.sidebar-header.collapsed .sidebar-toggle-icon {
  transform: rotate(-90deg);
}

.sidebar-favorites {
  margin-bottom: 0.75rem;
}

.sidebar-no-favorites {
  color: #6c757d;
  font-style: italic;
  font-size: 0.875rem;
  line-height: 1.4;
}

.sidebar-favorites-items {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.sidebar-favorite-item {
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.sidebar-favorite-item:last-child {
  margin-bottom: 0;
}

.sidebar-favorite-link {
  display: inline-block;
  text-decoration: none;
  color: var(--bs-link-color, var(--bs-primary, #0d6efd));
  font-size: 0.875rem;
  line-height: 1.4;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-favorite-link:hover {
  text-decoration: underline;
  color: var(--bs-link-hover-color, var(--bs-primary-dark, #0a58ca));
}

.sidebar-external-warning {
  margin-right: 4px;
  font-size: 10px;
  opacity: 0.8;
}

.sidebar-external-favorite .sidebar-favorite-link {
  color: #dc3545;
}

.sidebar-external-favorite .sidebar-favorite-link:hover {
  color: #a71d2a;
}

.sidebar-favorites-footer {
  margin-top: 0.75rem;
  text-align: left;
}

.sidebar-favorites-view-all {
  font-size: 0.75rem;
  color: #6c757d;
  text-decoration: none;
  display: inline-block;
  padding-left: 0;
}

.sidebar-favorites-view-all:hover {
  color: var(--bs-link-color, var(--bs-primary, #0d6efd));
  text-decoration: underline;
}