/* ================= BOOKMARKS STYLES ================= */

/* Bookmarks Panel - Slides from right */
.bookmarks-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  z-index: 2000;
  transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
}

.bookmarks-panel.active {
  right: 0;
}

.bookmarks-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.bookmarks-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.bookmarks-header h2 i {
  color: var(--accent);
  font-size: 18px;
}

#close-bookmarks {
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

#close-bookmarks:hover {
  color: var(--accent);
  background: var(--bg-hover);
  transform: rotate(90deg);
}

.bookmarks-stats {
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

#bookmark-count {
  color: var(--accent);
  font-weight: 600;
}

.bookmarks-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Bookmark Item */
.bookmark-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  animation: slideInRight 0.3s ease;
}

.bookmark-item:hover {
  transform: translateX(-4px) translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.bookmark-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-soft));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bookmark-item:hover::before {
  opacity: 1;
}

.bookmark-book {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.bookmark-book-cover {
  width: 30px;
  height: 40px;
  background: var(--bg-hover);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.bookmark-book-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.bookmark-chapter {
  font-size: 12px;
  color: var(--accent);
  background: rgba(255, 159, 28, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 10px;
}

.bookmark-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border-left: 2px solid var(--accent);
  font-style: italic;
  max-height: 100px;
  overflow: hidden;
  position: relative;
  word-break: break-word;
}

.bookmark-text::after {
  content: '...';
  position: absolute;
  bottom: 0;
  right: 12px;
  background: var(--bg-secondary);
  padding: 0 4px;
  color: var(--text-muted);
}

.bookmark-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.bookmark-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.bookmark-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 11px;
}

.bookmark-actions button:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* Empty State */
.bookmarks-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.bookmarks-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.bookmarks-empty h3 {
  font-size: 18px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.bookmarks-empty p {
  font-size: 14px;
  margin-bottom: 24px;
}

.bookmarks-empty .hint {
  font-size: 12px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 30px;
  display: inline-block;
  border: 1px solid var(--border);
}

/* Reader Bookmark Button */
.bookmark-reader-btn {
  position: fixed;
  right: 30px;
  bottom: 100px;
  width: 50px;
  height: 50px;
  border-radius: 30px;
  background: var(--accent);
  border: none;
  color: #000000;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 159, 28, 0.3);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bookmark-reader-btn:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 8px 24px rgba(255, 159, 28, 0.4);
}

.bookmark-reader-btn.active {
  background: var(--accent-soft);
  animation: pulse 2s infinite;
}

/* Bookmark Toast Notification */
.bookmark-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 50px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 2500;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bookmark-toast.show {
  transform: translateX(-50%) translateY(0);
}

.bookmark-toast i {
  color: var(--accent);
  font-size: 18px;
}

.bookmark-toast span {
  color: var(--text-main);
  font-size: 14px;
}

/* Selection Tooltip */
.bookmark-tooltip {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease;
  pointer-events: auto;
}

.bookmark-tooltip i {
  color: var(--accent);
}

.bookmark-tooltip:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

/* Selection Menu (Custom) */
.selection-menu {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 40px;
  padding: 5px;
  display: flex;
  gap: 5px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  backdrop-filter: blur(10px);
  animation: menuPop 0.2s ease;
  transform-origin: bottom center;
  pointer-events: auto;
}

@keyframes menuPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.selection-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-radius: 30px;
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.selection-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.selection-btn i {
  font-size: 14px;
}

.selection-btn#custom-bookmark i {
  color: var(--accent);
}

.selection-btn#custom-highlight i {
  color: #ffd700;
}

.selection-btn#custom-copy i {
  color: var(--text-muted);
}

/* Highlight styles */
.bookmark-highlight {
  background-color: rgba(255, 215, 0, 0.3);
  border-radius: 3px;
  padding: 2px 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.bookmark-highlight:hover {
  background-color: rgba(255, 215, 0, 0.5);
}

/* Animations */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 16px rgba(255, 159, 28, 0.3);
  }
  50% {
    box-shadow: 0 8px 24px rgba(255, 159, 28, 0.6);
  }
  100% {
    box-shadow: 0 4px 16px rgba(255, 159, 28, 0.3);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
  .bookmarks-panel {
    width: 100%;
    right: -100%;
  }
  
  .bookmark-reader-btn {
    right: 20px;
    bottom: 80px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  .selection-btn span {
    display: none;
  }
  
  .selection-btn {
    padding: 10px;
  }
  
  .selection-btn i {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .bookmarks-header {
    padding: 20px;
  }
  
  .bookmark-item {
    padding: 14px;
  }
}