:root {
  --highlight-yellow: #FFEB3B;
  --highlight-green: #4CAF50;
  --highlight-blue: #2196F3;
  --highlight-red: #E91E63;
  --highlight-purple: #5856D6;
  --highlight-white: #FFFFFF;
  --highlight-chat: #000000;
  --highlight-background-yellow: rgba(255, 235, 59, 0.15);
  --highlight-background-green: rgba(76, 175, 80, 0.15);
  --highlight-background-blue: rgba(33, 150, 243, 0.15);
  --highlight-background-red: rgba(233, 30, 99, 0.15);
  --highlight-background-purple: rgba(88, 86, 214, 0.18);
  --highlight-background-white: rgba(255, 255, 255, 0.15);
  --highlight-background-chat: rgba(0, 0, 0, 0.15);
}




.notes-grid {
  display: grid;
  grid-template-rows: 4rem 4rem  1fr;

  margin: 0; /* Remove any margin */
  width: 100%; /* Full width */
  height: 100%;
  overflow: hidden;
}

.notes-container {
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: 100%;
  height: calc(100vh - 4rem);
  overflow: hidden;
  background: var(--background);
  -webkit-user-select: none;
  user-select: none;
  border-top: 1px solid var(--border-color);
}




/* Adjust nav position for the full-width layout */
.appnav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  background: var(--background);
  border-bottom: 1px solid var(--border-color);
}

/* Adjust the lists to account for the nav height */


.highlight-position{
    font-size: 12px;
    color: var(--text-secondary);
}


.column {
  height: 100%;
  position: relative;
  overflow-y: auto;
  min-width: 0;
  background: var(--background);
}

.books-list {
  min-width: 250px;
  max-width: 350px;
  width: 300px;
  flex: 0 0 auto;
  border-right: 1px solid var(--border-color);
}

.highlights-list {
  min-width: 300px;
  max-width: 450px;
  width: 380px;
  flex: 0 0 auto;
  border-right: 1px solid var(--border-color);
}

.highlight-detail {
  flex: 1 1 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: top;
  -webkit-user-select: text !important; 
  user-select: text !important;
}

.highlight-detail.chat-detail-mode {
  align-items: stretch;
  padding-bottom: 4rem;
  overflow: hidden;
}

.highlight-detail.reader-detail-mode {
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

.highlight-detail .highlight-content,
.highlight-detail .heightlight-meta,
.highlight-detail .summary-content
{
  width: 100%;
  max-width: 75ch;
  text-align: left;
  align-content: left;
}

.highlight-detail .summary-content{
font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
user-select:text;
padding:0 0 4rem 0;
}

.highlight-detail .chat-detail-header,
.highlight-detail .chat-detail-note {
  width: 100%;
  max-width: 75ch;
}

.highlight-detail .chat-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.highlight-detail .embedded-chat-host {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 75ch;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.highlight-detail .reader-embed {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

.highlight-detail .reader-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.highlight-detail .chat-interface.embedded {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  max-width: 75ch;
  margin: 0 auto;
  background: transparent;
  backdrop-filter: none;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.highlight-detail .chat-interface.embedded .chat-grid {
  width: 100%;
  height: 100%;
  grid-template-columns: 1fr;
  position: relative;
  align-content: stretch;
  justify-content: stretch;
  align-items: stretch;
}

.highlight-detail .chat-interface.embedded .chat-book-cover {
  display: none;
}

.highlight-detail .chat-interface.embedded .chat {
  padding: 1rem .5rem;
  flex: 1 1 auto;
  min-height: 0;
}

.highlight-detail .chat-interface.embedded #chatMessages {
  padding: 0.5rem 0;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: flex-start;
  overflow-y: auto;
}

.highlight-detail .chat-interface.embedded #chatInput {
  padding: 0.5rem 0 1rem;
  margin-top: auto;
}

.message-citations {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-start;
  align-items: center;
}

.citation-link {
  width: auto !important;
  background: none;
  border: none;
  padding: 0;
  margin: 0 .5rem ;
  color: var(--theme-color);
  cursor: pointer;
  font-size: 0.8rem;
}

.citation-link:hover {
  text-decoration: underline;
}

.notes-container .book-item {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  min-height: 4rem;
}

.notes-container .book-item .book-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0; /* Enable text truncation */
}

.notes-container .book-item .book-title {
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.notes-container .book-item .book-author {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-container .book-item img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;

}

.book-item img{
  border:1px solid var(--border-color) !important;
}

.notes-container .book-item:hover {
  background: var(--gray-0);
}

.notes-container .book-item.selected {
  background: var(--selected-background);
}

.notes-container .highlights-list {
  background: var(--background);
}

.notes-container .highlight-item {
  display: flex;
  flex-direction: column;
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  min-height: 3.5rem;
}

.highlight-item .highlight-header {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

#libraryResults, 
#googleBooksResults{
  display: block;
  list-style-type: none;
  margin-block-start: 0;
  margin-block-end: 0;
  padding-inline-start: 0;
}

.highlight-item .highlight-text {
  display: flex;
  gap: 0.5rem;
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0 0 0;
  color: var(--text);
  text-overflow: ellipsis;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  max-height: 2.5rem;
  white-space: pre-wrap; 
  overflow: hidden;

}

.highlight-item .highlight-text strong {
  flex: 1 1 auto;
}

.highlight-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--text);
  flex: 0 0 auto;
  margin-top: .25rem
}

.highlight-item-icon svg {
  width: 100%;
  height: 100%;
}

.modal-content .highlight-text{
  color: var(--text);
  margin:0;
  text-align: left;
}

#closeCameraModalBtn{
  border:none;
  width: 2rem;
  height: 2rem;  
}

#closeChatBtn svg{
  color: var(--gray-1);
}



.highlight-item .highlight-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.highlight-content {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.highlight-content:hover {
    opacity: 0.9;
}

.highlight-content span {
    color: var(--text);
}

/* Update highlight colors to be applied to background */
.highlight-content.highlight-yellow {
    background: rgba(255, 235, 59, 0.15);
}

.highlight-content.highlight-green {
    background: rgba(76, 175, 80, 0.15);
}

.highlight-content.highlight-blue {
    background: rgba(33, 150, 243, 0.15);
}

.highlight-content.highlight-purple {
    background: rgba(88, 86, 214, 0.16);
}

.highlight-content.highlight-pink {
    background: rgba(233, 30, 99, 0.15);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .highlight-content.highlight-yellow {
        background: rgba(255, 235, 59, 0.1);
    }

    .highlight-content.highlight-green {
        background: rgba(76, 175, 80, 0.1);
    }

    .highlight-content.highlight-blue {
        background: rgba(33, 150, 243, 0.1);
    }

    .highlight-content.highlight-purple {
        background: rgba(88, 86, 214, 0.12);
    }

    .highlight-content.highlight-pink {
        background: rgba(233, 30, 99, 0.1);
    }
}

.highlight-detail .highlight-note {
    font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
    max-width: 75ch;
    width: 90%;
    font-size: 1rem;
    line-height: 1.5;
    padding: 16px;
    background: var(--note-background);
    border-radius: 8px;

}

.highlight-detail .highlight-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 16px;
}

.highlight-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-start;
  align-items: center;
  width: auto;
}

.highlight-action-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 50px;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
	transition: transform 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
  align-self: flex-start;
  width: auto;
}

.highlight-action-button:hover {
  background: var(--gray-0);
}

.highlight-action-button svg {
  width: 14px;
  height: 12px;
  fill: var(--gray-1);
  vertical-align: middle;
  display: inline-block;
}

/* Empty state styles */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 24px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--text-tertiary);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-tertiary);
  margin: 0;
  padding: 0;
}

/* Resize handle styling */
.resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px; /* Reduced from 12px */
  cursor: col-resize;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
}

.resize-handle::after {
  content: "";
  position: relative; /* Changed from absolute */
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background-color 0.2s;
}

.resize-handle:hover::after,
.resize-handle.active::after {
  background-color: var(--border-color);
}

#books-resize-handle {
  left: 296px; /* Adjusted to account for the handle width */
}

#highlights-resize-handle {
  left: 676px; /* Adjusted to account for the handle width */
}

/* Prevent text selection while resizing */
.resizing,
.resizing * {
  cursor: col-resize !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
  .resize-handle {
    transform: none; /* Remove transform that was causing misalignment */
  }
  
  .notes-container {
    height: -webkit-fill-available;
  }
  
  .column {
    height: -webkit-fill-available;
  }
}

.highlight-color {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.highlight-color.white {
    background-color: #fff;
    border: 1px solid var(--border-color);
  }

.highlight-color.yellow {
  background-color: rgba(255, 235, 59, 0.7);
}

.highlight-color.green {
  background-color: rgba(76, 175, 80, 0.7);
}

.highlight-color.blue {
  background-color: rgba(33, 150, 243, 0.7);
}

.highlight-color.purple {
  background-color: rgba(88, 86, 214, 0.7);
}

.highlight-color.pink {
  background-color: rgba(233, 30, 99, 0.7);
}

/* Apply highlight colors to the highlight text */
.highlight-content .highlight-yellow {
  background-color: rgba(255, 235, 59, 0.3);
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
}

.highlight-content .highlight-green {
  background-color: rgba(76, 175, 80, 0.3);
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
}

.highlight-content .highlight-blue {
  background-color: rgba(33, 150, 243, 0.3);
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
}

.highlight-content .highlight-purple {
  background-color: rgba(88, 86, 214, 0.3);
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
}

.highlight-content .highlight-pink {
  background-color: rgba(233, 30, 99, 0.3);
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
}

/* Style for different highlight colors in the notes view */
.highlight-yellow { background: rgba(255, 235, 59, 0.2); }
.highlight-green { background: rgba(76, 175, 80, 0.2); }
.highlight-blue { background: rgba(33, 150, 243, 0.2); }
.highlight-purple { background: rgba(88, 86, 214, 0.2); }
.highlight-pink { background: rgba(233, 30, 99, 0.2); }

.context-menu {
    position: fixed;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 160px;
    z-index: 1000;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu li:hover {
    background: var(--background-secondary);
}

.context-menu .delete-button {
    color: var(--red);
}

.context-menu .delete-button:hover {
    background: var(--error-bg);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background-color: var(--background);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    width: 100%;
}

.modal-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    width: 100%;
    margin: 0;
    font-size: 1.2em;
    font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
    font-weight: 500;

}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    color: var(--gray-1);
}

.camera-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 4:3 aspect ratio */
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

#cameraPreview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.camera-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
    background: var(--background-secondary);
}

.primary-btn{
  color:#fff !important; 
  background: var(--theme-color);
}



.bookSearchResults{
  list-style-type: none;
  margin-block-start: 0;
  margin-block-end: 0;
  padding-inline-start: 0;
}



.book-select-modal{
 height:70vh;
 overflow-y: scroll;
}

.book-select-modal input{
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-lines);
  border-radius: 0.5rem;
  font-size: 1rem;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

.book-select-modal input:focus{
  outline: none;
}




/* Processing modal styles */
.processing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 0;
}

.processing-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--background-secondary);
    border-top-color: var(--theme-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Results modal styles */
.extracted-highlights {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    text-align: left;
}

.extracted-highlight {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    background-color: var(--note-background);
}

.highlight-text {
    margin: 0;
    font-size: 1em;
    line-height: 1.4;
}

.detected-books {
    max-height: 420px;
    overflow-y: auto;
    margin-bottom: 20px;
    text-align: left;
}

.detected-book-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 10px;
    background-color: var(--note-background);
    border: 1px solid var(--gray-lines);
}

.detected-book-item .book-cover-thumb {
    width: 54px;
    height: 76px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--background-secondary);
}

.detected-book-item .book-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.detected-book-item .book-info .author {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.detected-book-item .book-info .book-status {
    color: var(--text-secondary);
    font-size: 0.8em;
}

.remove-book-btn {
    background: var(--background-secondary);
    color: var(--text);
    border: 1px solid var(--gray-lines);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
}

.remove-book-btn:hover {
    background: var(--background-tertiary);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background-color: var(--background);
        border: 1px solid var(--gray-lines);
    }

    .close-btn {
        color: var(--text);
    }

    .secondary-btn {
        background-color: var(--background-secondary);
        color: var(--text);
    }

    .secondary-btn:hover {
        background-color: var(--background-tertiary);
    }

    .extracted-highlight {
        background-color: var(--background-secondary);
    }
}

/* Notification styles removed to use global styles from style.css */

.position-button {
    display: inline;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 16px;
    width: auto;
    padding: 0;
    background: none;
    border: none;
}

.position-button:hover {
    color: var(--text);
}

/* Remove the SVG icon */
.position-button svg {
    display: none;
}

.note-list-item {
    padding: 10px;
    margin: 5px 0;
    border-radius: 4px;
    border-left: 4px solid transparent;
}

.note-yellow { border-left-color: rgb(255, 235, 59); background-color: var(--highlight-yellow); }
.note-green { border-left-color: rgb(76, 175, 80); background-color: var(--highlight-green); }
.note-blue { border-left-color: rgb(33, 150, 243); background-color: var(--highlight-blue); }
.note-purple { border-left-color: rgb(88, 86, 214); background-color: var(--highlight-purple); }
.note-pink { border-left-color: rgb(233, 30, 99); background-color: var(--highlight-pink); }
.note-white { border-left-color: rgb(255, 255, 255); background-color: var(--highlight-white); }

/* Hover effects */
.note-yellow:hover { background-color: rgba(255, 235, 59, 0.5); }
.note-green:hover { background-color: rgba(76, 175, 80, 0.5); }
.note-blue:hover { background-color: rgba(33, 150, 243, 0.5); }
.note-purple:hover { background-color: rgba(88, 86, 214, 0.45); }
.note-pink:hover { background-color: rgba(233, 30, 99, 0.5); }
.note-white:hover { background-color: rgba(255, 255, 255, 0.5); }

@media (max-width: 900px) {
  .notes-grid {
    display: block;
    position: relative;
  }
  .notes-container {
    display: block;
    height: auto;
    min-height: 100vh;
  }
  .books-list,
  .highlights-list,
  .highlight-detail {
    display: none;
    width: 100% !important;
    max-width: none;
    min-width: 0;
    border: none;
    padding: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--background);
    z-index: 1;
  }
  .notes-grid.view-books .books-list {
    display: block;
    position: relative;
    z-index: 2;
  }
  .notes-grid.view-highlights .highlights-list {
    display: block;
    position: relative;
    z-index: 2;
  }
  .notes-grid.view-detail .highlight-detail {
    display: block;
    position: relative;
    z-index: 2;
    width: 100%;
  }
  .resize-handle {
    display: none;
  }

  .highlight-content,
  .highlight-note{
    max-width: 90%;
  }


}

/* Mobile-safe sizing for camera modal and controls */
@media (max-width: 900px) {
  .camera-modal {
    width: 100%;
    max-width: none;
    height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  .camera-modal .modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .camera-container {
    flex: 1;
    height: auto;
    min-height: 0;
    padding-bottom: 0; /* override 4:3 ratio on mobile to fit screen */
    margin-bottom: 12px;
  }

  .camera-controls {
    margin-top: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.appnav .mobile-back-btn {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  height: 40px;
  width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: left;
  z-index: 20;
}

.highlight-book-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 16px;
    /* Center with the content column */
    align-self: center;
    width: 100%;
    max-width: 75ch;
}

.highlight-book-info img {
    width: 48px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.highlight-book-info .book-info {
    flex: 1;
    min-width: 0;
}

.highlight-book-info .book-title {
    display: block !important;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px; /* tighter spacing to author */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.highlight-book-info .book-author {
    display: block !important;
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-container .book-item.color-filter {
  padding: 8px 12px;
  min-height: unset;
  display: flex;
  align-items: center;
}

.notes-container .book-item.color-filter img {
  margin-right: 12px;
}

/* Camera button styles */
.camera-button-container {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.camera-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;

  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
  z-index: 10;
}



.camera-btn svg {
  width: 24px;
  height: 24px;
}



/* Camera modal styles */
.camera-modal {
  max-width: 800px;
  width: 90%;
}

/* Mobile full screen modal */
@media (max-width: 768px) {
  .camera-modal {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  
  .modal.show {
    padding: 0;
  }
  
  .camera-modal .modal-header {
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
  }
  
  .camera-modal .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  
  .camera-container {
    flex: 1;
    border-radius: 0;
  }
  
  .camera-controls {
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    background: var(--background);
    border-top: 1px solid var(--border-color);
  }
}

.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

#cameraPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-guide {
  width: 80%;
  height: 80%;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.camera-controls {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  justify-content: center;
}

/* Processing modal styles */
.processing-modal {
  max-width: 400px;
}

.processing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
}

.processing-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Results modal styles */
.results-modal {
  max-width: 600px;
}

.extracted-highlights {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.extracted-highlight {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--gray-0);
}

.extracted-highlight.highlight-yellow {
  background: var(--highlight-background-yellow);
}

.extracted-highlight.highlight-green {
  background: var(--highlight-background-green);
}

.extracted-highlight.highlight-blue {
  background: var(--highlight-background-blue);
}

.extracted-highlight.highlight-purple {
  background: var(--highlight-background-purple);
}

.extracted-highlight.highlight-pink {
  background: var(--highlight-background-red);
}

.results-controls {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .camera-btn {
    background: var(--primary-dark);
  }
  
  .camera-btn:hover {
    background: var(--primary);
  }
  
  .extracted-highlight {
    background: var(--gray-1);
  }
}

.more-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Book selection modal styles */
.book-select-item, .google {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  transition: background 0.2s;
  text-align: left;
}


.extracted-highlights .empty-state{
  background: var(--note-background);
  border-radius: 8px;

}

.extracted-highlights .empty-state{
  margin: 1rem 0;
}

.cancelBookSelect{
  margin-top: 1rem;
}

.book-select-item:hover {
  background: var(--gray-0);
}

.book-select-item.selected {
  background: var(--selected-background);
}

.book-cover-thumb {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  background: #f5f5f7;
}

.book-select-item .book-info,
.book-select-item .google {
  display: flex;
  flex-direction: column;
  min-width: 0;
}



.book-select-item .book-info strong,
.book-select-item.google strong
{
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 2px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-select-item .book-info .author,
.book-select-item.google .author {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.highlight-item:hover {
    background-color: var(--gray-0);
}



/* --- Summary Detail View Styling --- */

.highlight-detail .summary-content h2 {
    font-size: 2em;
    border-bottom: 1px solid var(--gray-lines);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

.highlight-detail .summary-content .summary-text {
    max-width: 750px; /* Optimal reading width */
    margin: 0 1rem;
    font-size: 17px;
    line-height: 1.7;
    color: #333;
}

.highlight-detail .summary-content .summary-text h1,
.highlight-detail .summary-content .summary-text h2,
.highlight-detail .summary-content .summary-text h3,
.highlight-detail .summary-content .summary-text h4 {
    color: var(--text);
    font-weight: 600;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    line-height: 1.4;
}



.highlight-detail .summary-content .summary-text h1 {
    font-size: 1.8em;
    font-weight: 700;
}

.highlight-detail .summary-content .summary-text h2 {
    font-size: 1.5em;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
    Arial, sans-serif;

}

.highlight-detail .summary-content .summary-text hr {
    border: 0;
    height: 1px;
    background-color: #eee;
    margin: 2em 0;
}

.highlight-detail .summary-content .summary-text h3 {
    font-size: 1.3em;
}

.highlight-detail .summary-content .summary-text h4 {
    font-size: 1.1em;
    color: #555;
}

.highlight-detail .summary-content .summary-text p {
    margin-bottom: 1em;
    color: var(--text-secondary);
}

.highlight-detail .summary-content .summary-text ul,
.highlight-detail .summary-content .summary-text ol {
    padding-left: 2em;
    margin-bottom: 1em;
    color: var(--text-secondary);
}

.highlight-detail .summary-content .summary-text li {
    margin-bottom: 0.4em;
}

.highlight-detail .summary-content .summary-text strong {
    font-weight: 600;
}

.highlight-color.summary {
  background-color: var(--theme-color); /* fallback */
  display: none;
}

.loading-spinner {
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid var(--theme-color); /* theme color */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    padding: 20px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    margin: 10px;
}

.highlight-meta {
    font-size: 0.8em;
    color: #888;
}

/* Book Rating Styles */
.book-rating {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 0;
  justify-content: flex-start;
}

.rating-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

.rating-chat-button {
  margin-left: 1rem;
}

.rating-stars {
  display: flex;
  gap: 2px;
}

.rating-star {
  cursor: pointer;
  font-size: 16px;
  color: #ddd;
  transition: color 0.2s ease;
  user-select: none;
}

.rating-star:hover,
.rating-star.hover {
  color: var(--theme-color-1);
}

.rating-star.filled {
  color: var(--theme-color-1);
}

.rating-star.filled.hover {
  color: var(--theme-color-1);
}

.rating-value {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.rating-chat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  background: var(--background);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
  flex: 0 0 auto;
  width: auto;
  max-width: max-content;
  transition: background 0.2s ease;
}

.rating-chat-button:hover {
  background: var(--gray-0);
}

.rating-chat-button svg {
  width: 14px;
  height: 12px;
  display: inline-block;
  vertical-align: middle;
}



/* Summary content adjustments */
.summary-content {
  width: 100%;
  max-width: 800px;
}

.summary-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

.summary-text {
  line-height: 1.6;
  color: var(--text-primary);
}

.summary-text h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 24px 0 16px 0;
  color: var(--text-primary);
}

.summary-text h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 20px 0 12px 0;
  color: var(--text-primary);
}

.summary-text h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: var(--text-primary);
}

.summary-text p {
  margin-bottom: 16px;
}

.summary-text ul, .summary-text ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.summary-text li {
  margin-bottom: 8px;
}

/* Recommendations section */
.recommendations-section {
  margin:2rem 1rem;
}

.recommendations-title {
  font-size: 18px;
  font-weight: 600;
  margin: 6rem 0 1rem 0;
  color: var(--text);
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: 0.5rem;
}



.rec-item {
  max-width: 6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-decoration: none;
}

.rec-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  background: #f5f5f7;
}

.rec-meta {
  display: flex;
  flex-direction: column;
}

.rec-title {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
}

.rec-author {
  font-size: 12px;
  color: var(--text-secondary);
}
