@media (prefers-color-scheme: light) {
  :root {
    --text: #0a0a0a;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --background: rgb(255, 255, 255);
    --sidebar-background: #f5f5f7;
    --backdrop: rgba(245, 245, 247, 0.95);
    --gray-0: #EFEFEF;
    --gray-1: rgb(142, 142, 147);
    --gray-2: rgb(229, 229, 234);
    --border-color: #e5e5e7;
    --hover-background: #111128;
    --selected-background: #e5e5e7;
    --note-background: #f8f8fa;
    --gray-lines: #f0f0f0;
    --primary: rgb(88, 86, 214);
    --primary-color: rgb(88, 86, 214);
      --theme-color: rgb(88, 86, 214);
      --theme-color-1: #FF5A0E;
  --theme-color-dark: rgb(68, 66, 164);
  --red: rgb(255, 59, 48);
  --background-secondary: #f8f8fa;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-tertiary: #808080;
    --background: #1e1e1e;
    --sidebar-background: #252525;
    --backdrop: rgba(0, 0, 0, 0.85);
    --gray-1: rgb(152, 152, 157);
    --gray-2: rgb(44, 44, 46);
    --border-color: #333333;
    --hover-background: #2a2a2a;
    --selected-background: #333333;
    --note-background: #252525;

    --gray-lines: #343434;
      --theme-color: rgb(94, 92, 230);
  --theme-color-dark: rgb(74, 72, 180);
  --theme-color-1: #FF5A0E;
  --red: rgb(255, 69, 58);
  --orange: #FF6800; /* sRGB fallback */
  --orange:  color(display-p3 1 0.41 0 / 1);
  --background-secondary: #2a2a2a;
  }
}

@supports (color: color(display-p3 0 0 0)) {
  :root {
    --orange: color(display-p3 1 0.41 0 / 1);
  }
}


@supports (color: color(display-p3 0 0 0)) {
  :root {
    --orange: color(display-p3 1 0.41 0 / 1);
  }
}

@view-transition {
  navigation: auto;
}

/* * {  
  cursor: default;
  user-select: none;
  -webkit-user-select: none; 
} */

html,body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
    Arial, sans-serif;
  line-height: 150%;
  margin: 1rem auto;
  background-color: var(--background);
  color: var(--text);
  border: 2px solid transparent; /* Dashed border */
  border-radius: .5rem; /* Rounded corners */

}

body.hover {
  border: none;
  background-color: var(--background);
}



nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  height: 2rem;
  background-color: var(--background);
}

nav a {
  text-decoration: none;
  background-color: transparent;
  color: var(--text);
  padding: .5rem 1rem;
  border-radius: 50rem;
}

nav a.active {
  background-color: var(--gray-2);
  color: var(--text);
  padding: .5rem 1rem;
  border: none;
  border-radius: 50rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 3;
}




.more-menu {
  position: absolute;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.5rem;
}

.more-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.more-menu-btn svg {
  width: 24px;
  height: 24px;
  fill: var(--gray-1);
}

.more-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  background-color: var(--background);
  border: 1px solid var(--gray-lines);
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-width: 15rem;
  overflow: hidden;
}

.more-menu-dropdown.hidden {
  display: none;
}


header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

/* Removed legacy .book-count-indicator styles */

input,
button {
  width: 100%;
  -webkit-appearance: none;
  background: none;
  border: none;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2rem;
  padding: 2rem;
  width: calc(100% - 4rem);
  margin: 0 auto;
  min-height: 300px;
  position: relative;
  /* Safari-specific optimizations */
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  -webkit-perspective: 1000;
  will-change: transform;
}

.book{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content:flex-end;
  padding: 0.5rem;
  transition: transform 0.3s ease;
  /* Safari-specific optimizations */
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform;
}

.book:hover {
  transform: scale(1.05);
}

.book-cover {
  max-width: 100%;
  height: auto;
  object-fit: fill;
  transition: transform 0.4s ease-in-out;
  border-radius: .25rem;
  box-shadow: 0px 1px 1px rgba(3, 7, 18, 0.08), 0px 5px 4px rgba(3, 7, 18, 0.06),
    0px 12px 9px rgba(3, 7, 18, 0.05), 0px 20px 15px rgba(3, 7, 18, 0.03),
    0px 32px 24px rgba(3, 7, 18, 0.02);
    overflow: hidden;
  position: relative;
  /* Safari-specific optimizations */
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  will-change: transform;
}

.book-cover img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: .25rem;
  display: block;
}

.book-cover:hover {
  box-shadow: 0px 1px 1px rgba(3, 7, 18, 0.02), 0px 5px 4px rgba(3, 7, 18, 0.03),
    0px 12px 9px rgba(3, 7, 18, 0.05), 0px 20px 15px rgba(3, 7, 18, 0.06),
    0px 32px 24px rgba(3, 7, 18, 0.08);
}

/* Processing Indicator - Pulsing Book Cover */
.book.processing .book-cover {
  animation: pulse-opacity 2s ease-in-out infinite;
}

@keyframes pulse-opacity {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Plan Update Notification */
.plan-update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
}

.plan-update-notification .notification-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-update-notification .notification-icon {
  font-size: 18px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.book-title {
  font-weight: bold;
  margin-top: 10px;
  display: none;
}

.book-description {
  display: none;
}

.book-author {
  font-style: italic;
  margin-top: 5px;
  display: none;
}

.chat-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--backdrop);
  backdrop-filter: blur(8px);
  z-index: 2;
}




/* Chat */


.chat-interface {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--backdrop);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: auto;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
  backdrop-filter: blur(2rem);
}

.chat-interface.hidden {
  visibility: hidden;
  opacity: 0;
}


body.chat-open {
  overflow: hidden;
}

.chat-grid{
  position: sticky;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-content: center;
  align-content: center;
  justify-self: center;
  align-self: center;
  width: 100vw;
  height: 100%;
  overflow: hidden;

}

.chat-book-cover{
  display: flex;
  justify-content: center;
  align-items: center;
  display: flex;
  flex-direction: column;
}

.chat-book-cover-buttons{
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  max-width: 28rem;
}


.chat-book-cover-buttons button {
  background-color: var(--gray-2);
  border: 1px solid var(--gray-lines);
  color: var(--text);
  padding: .5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 3;
  margin: 1rem 0 ;
}

.chat-cover {
  width: 100%;
  max-width: 24rem;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  object-fit: cover;
}

.chat-cover:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}


.chat-interface.hidde,
.chat-backdrop.hidden {
  visibility: hidden;
  opacity: 0;
}



#chatHeader {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--gray-lines);
}

.chat-header-content {
  display: flex;
  align-items: center;
  flex-grow: 1;
}

#closeChatBtn {
  position: fixed;
  right: 1.5rem;
  top: .5rem;
  width: 2.5rem;
  height: 2.5rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  margin-left: auto; /* This will push the button to the right */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin-right: -0.5rem;
  z-index: 2;
}

#closeChatBtn svg {
  width: 20px;
  height: 20px;
  color: var(--gray-1);
  fill: var(--gray-1);
}

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

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

.book-info {
  flex-grow: 1;
}

#chatHeader h2 {
  font-size: 1.2rem;
  line-height: 120%;
  font-weight: 400;
  margin: 0.5rem 0 0.4rem 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

#chatHeader h3 {
  color: var(--gray-1);
  font-size: 1rem;
  line-height: 100%;
  font-weight: 400;
  margin: 0 0 0.5em 0;
}

.chat{
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  max-height: 100%;
  overflow: auto;
  padding:0 2rem;
}

#chatMessages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer and Edge */
}

#chatMessages::-webkit-scrollbar {
  display: none; /* Chrome, Safari, and Opera */
}

#chatInput {
  font-size: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  position: relative;
}

#chatInput input {
  -webkit-appearance: none;
  color: var(--text);
  font-size: 0.9rem;
  border: 1px solid var(--gray-lines);
  border-radius: 2rem;
  line-height: 1.6rem;
  padding: 0.5rem 3.5rem 0.5rem 1rem;
  background-color: var(--background);
  width: 100%;
}

#sendMessageBtn {
  position: absolute;
  right: 1.4rem;
  width: 2rem;
  height: 2rem;
  -webkit-appearance: none;
  border-radius: 50%;
  border: 1px solid var(--theme-color);
  background-color: var(--theme-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

#userMessage {
  flex-grow: 1;
  padding: 1rem 0.5rem;
  min-height: 1.5rem;
}

.message {
  line-height: 140%;
  padding: 1rem 1.2rem;
  border-radius: 1.5rem;
  width: fit-content;
  min-width: 20%;
  max-width: 70%;
  transition: all ease-in-out;
  position: relative;

}

.message.user {
  color: white;
  background-color: var(--theme-color);
  align-self: flex-end;
  margin-left: auto;
  margin-bottom: .5rem;
}

.message.assistant {
  background-color: var(--gray-2);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  max-width: 80%;
  align-self: flex-start;
  position: relative;
}

.message.assistant:empty {
  display: none;
}

/* Simple typing indicator */
.message.assistant.typing .message-text {
  color: var(--text-secondary);
  font-style: italic;
  animation: thinking-pulse 2s infinite ease-in-out;
}

@keyframes thinking-pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* animations */
@keyframes pulse {
  0% {
    opacity: 0.2;
  }

  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 0.2;
  }
}

.temp-book {
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.temp-book .pulsing {
  animation: pulse 1.5s infinite;
  opacity: 0.7;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 0.7; }
  100% { opacity: 0.4; }
}

.temp-book .book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 0.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

/* Add these styles at the end of your CSS file */

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--background);
  border: 1px solid var(--gray-lines);
  border-radius: 1rem;
  padding: 4rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h1, .card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: none;
}

#loginForm, #signup-form, #login-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 20rem;
}

.form-group {
  width: 100%;
}

#loginForm input, #signup-form input, #login-form 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;
}

#loginForm button, #signup-form button, #login-form button {
  background-color: var(--theme-color);
  color: white;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 100px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
  box-sizing: border-box;
}

#loginForm button:hover, #signup-form button:hover, #login-form button:hover {
  background-color: var(--theme-color-dark);
}

.card p {
  text-align: center;
  margin-top: 1rem;
}

.card a {
  color: var(--theme-color);
  text-decoration: none;
}

.card a:hover {
  text-decoration: underline;
}

.logout-btn {
  background-color: var(--theme-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.logout-btn:hover {
  background-color: var(--theme-color-dark);
}



footer {
  margin-top: 2rem;
}

.sign-out-btn {
  text-decoration: none;
  color: var(--gray-1);
}

.sign-out-btn:hover {
  color: var(--gray-2);
}

.footer-link {
  color: var(--gray-1);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-link:hover {
  color: var(--gray-2);
}

/* Context Menu Styles */
#contextMenu {
    position: fixed;
    background: var(--background);
    border: 1px solid var(--gray-lines);
    border-radius: .5rem;
    padding: 0.5rem 0;
    min-width: 150px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: var(--background);
    border: 1px solid var(--border-color);
    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);
}

/* Legacy context menu item styles (keeping for compatibility) */
.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text);
    transition: all 0.2s ease;
}

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

.context-menu-item:hover {
    background-color: var(--gray-2);
}

/* Add separator between menu items */
.context-menu-item:not(:last-child) {
    border-bottom: 1px solid var(--gray-lines);
}

/* Style for delete option */
#deleteBookOption {
    color: var(--red);
}

#deleteBookOption:hover {
    background-color: var(--red);
    color: white;
}

/* Confirmation Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--background);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 28rem;
    width: 90%;
    position: relative;
}


.modal-text{
  padding: 2rem 0
}

.modal-content h2,
.modal-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
    text-align: center;
}

.modal-content p {
    margin: 0 0 1.5rem 0;
    color: var(--gray-1);
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    padding-top: 1rem;
}

.modal-content button {
    color: var(--text);
    border: 1px solid var(--gray-lines);
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}


.modal-content button.btn-primary{
  color: var(--foreground);
  background-color: var(--theme-color);
  
}

#confirmDelete {
    color: var(--background);
    background-color: color-mix(in srgb, var(--red) 100%, transparent);
    font-weight: 500;
}

#confirmDelete:hover {
    background-color: color-mix(in srgb, var(--red) 90%, transparent);
}

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

#cancelDelete:hover {
    background-color: color-mix(in srgb, var(--gray-2) 50%, transparent);
}

.location-links {
  font-size: 0.8em;
  color: #666;
  margin-top: 5px;
  font-style: italic;
}

@media screen and (max-width: 768px) {
  .chat-interface {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1rem;
    width: calc(100% - 2rem);
  }

  .book {
    padding: 0.25rem;
  }

  #chatHeader {
    padding: 0.75rem 1rem;
  }

  #chatMessages {
    padding: 0.75rem;

  }

  #chatInput {
    padding: 0.75rem;
  }

  #chatInput input {
    font-size: 1rem;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
  }

  #chatInput button {
    right: 1rem;
  }
}


.more-menu-dropdown ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.more-menu-dropdown .dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text);
    transition: background-color 0.2s;
    font-size: 0.875rem !important;
}

.more-menu-dropdown .dropdown-item:hover {
    background-color: var(--gray-2);
}

.message-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 10px;
    position: relative;
}

.message-container .message {
    background-color: var(--gray-2);
}

.message-container .message.assistant {
    margin-right: 0; /* Remove the right margin since button is now below */
}



.play-button svg {
    width: 1.2rem;
    height: 1.2rem;
}




.play-button.active {
    opacity: 1;
    color: var(--theme-color);
}

/* Remove the speech icon styles */
.speech-icon {
    display: none;
}

.error-message {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    opacity: 0;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

.loading-icon {
    animation: spin 1s linear infinite;
    width: 1.2rem;
    height: 1.2rem;
}

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


.empty{
  color: var(--gray-1);
}


.empty-state{
  color: var(--gray-1);
  grid-column: 2 / 10;
  text-align: center;
}
.empty-state h3{
  font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
  color: var(--text);
}

.empty-state p{
  max-width: 25rem;
  margin: 0 auto;
}

.empty-state a{
  color: var(--gray-1);
  text-decoration: none;
  border-bottom: 1px solid var(--gray-2);
}

.empty-state a:hover{
  text-decoration: underline;
}

/* Empty State - Apple HIG compliant */
.empty-state-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
  text-align: center;
}

.empty-state-content {
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.empty-state-icon {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 80px;
  height: 40px;
}

.empty-state-title {
  font-family: -apple-system-ui-serif, ui-serif, "Georgia", serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.empty-state-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  max-width: 320px;
}

.empty-state-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  color: var(--text-secondary);
  border: none;
  padding: 0;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.2s ease;
  text-decoration: none;
}

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

.empty-state-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .empty-state-icon svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  }
}
/* Drop zone styles - placed with other book styles */
.drop-area {
    display: flex;
    align-content: center;
    justify-content: center ;
    align-self: flex-end;
    transition: all 0.3s ease;
    border:1px dashed var(--gray-2);
    border-radius: .125rem;
    width: 100%;
    height: 90%;
  cursor: grab;

}


.drop-area-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--gray-1);
}

.drop-area-content svg {
    width: 48px;
    height: 48px;
    transition: transform 0.3s ease;
}

.book.drop-area:hover .drop-area-content svg {
    transform: scale(1.1);
}

.drop-area-content p {
    margin: 0;
    font-size: 1.1rem;
    text-align: center;
    color: var(--text);
}

.book.drop-area.highlight .drop-area-content {
    color: var(--theme-color);
}

/* Smooth transitions for header and book section */
header,
#bookSection {
    transition: opacity 0.3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

.error-notification {
    animation: fadeInOut 3s ease-in-out;
}

/* Notification styles */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    pointer-events: none;
}

.notification {
    pointer-events: auto;
    position: relative;
    max-width: 20rem;
    margin-bottom: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(100%);
    opacity: 0;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards, fadeOutRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.7s forwards;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.notification:hover {
    transform: translateX(0) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.notification-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
}

.notification-content {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

/* Notification type variants */
.notification.success {
    background: rgba(34, 197, 94, 0.05);
    border-color: rgba(34, 197, 94, 0.15);
}

.notification.success .notification-icon,
.notification.success .notification-content {
    color: #16a34a;
}

.notification.error {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.15);
}

.notification.error .notification-icon,
.notification.error .notification-content {
    color: #dc2626;
}

.notification.info {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.15);
}

.notification.info .notification-icon,
.notification.info .notification-content {
    color: #2563eb;
}

.notification.warning {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.15);
}

.notification.warning .notification-icon,
.notification.warning .notification-content {
    color: #d97706;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Add missing keyframes for notes.css compatibility */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Annotation Modal */
.annotation-modal {
    position: absolute;
    z-index: 1000;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    padding: 16px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.annotation-colors {
    display: flex;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #000000;
    transform: scale(1.1);
}

.annotation-note {
    width: 100%;
    min-height: 80px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.annotation-note:focus {
    outline: none;
    border-color: var(--theme-color, #007AFF);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.annotation-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    padding-top: 4px;
}

.annotation-cancel,
.annotation-save {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
}

.annotation-cancel {
    color: #666666;
}

.annotation-cancel:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.annotation-save {
    color: var(--theme-color, #007AFF);
}

.annotation-save:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    .annotation-modal {
        background-color: #2c2c2e;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .annotation-colors {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .color-option.selected {
        border-color: #ffffff;
    }

    .annotation-note {
        background-color: #1c1c1e;
        border-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .annotation-note:focus {
        border-color: var(--theme-color, #0A84FF);
        box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.1);
    }

    .annotation-cancel {
        color: #999999;
    }

    .annotation-cancel:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .annotation-save {
        color: var(--theme-color, #0A84FF);
    }

    .annotation-save:hover {
        background-color: rgba(10, 132, 255, 0.1);
    }
}

/* Highlight styles */
.highlight {
    border-radius: 2px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.highlight:hover {
    opacity: 0.8;
}

/* Note Dialog */
.note-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: var(--background);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    padding: 20px;
    width: 90%;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
    border: 1px solid var(--gray-lines);
}

.note-dialog.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.note-dialog textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--gray-lines);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    margin-bottom: 16px;
    background-color: var(--background);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.note-dialog textarea:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 2px rgba(88, 86, 214, 0.1);
}

.note-dialog-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    border-top: 1px solid var(--gray-lines);
    padding-top: 16px;
    margin-top: 4px;
}

.note-dialog button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
}

.note-dialog .cancel-btn {
    color: var(--gray-1);
}

.note-dialog .cancel-btn:hover {
    background-color: var(--gray-2);
}

.note-dialog .save-btn {
    color: var(--theme-color);
}

.note-dialog .save-btn:hover {
    background-color: color-mix(in srgb, var(--theme-color) 10%, transparent);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .note-dialog {
        background-color: #2c2c2e;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .note-dialog textarea {
        background-color: #1c1c1e;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .note-dialog textarea:focus {
        border-color: var(--theme-color);
        box-shadow: 0 0 0 2px rgba(94, 92, 230, 0.1);
    }

    .note-dialog-buttons {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

.position-button {
    display: inline-flex;
    width: auto;
}

.loading-books {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 2rem;
    /* Safari-specific optimizations */
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    will-change: opacity;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-2);
    border-radius: 50%;
    border-top-color: var(--theme-color);
    animation: spin 1s linear infinite;
    /* Safari-specific optimizations */
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    will-change: transform;
}

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

/* Prevent layout shift during loading */
.book-grid {
    min-height: 300px;
    position: relative;
}

.upload-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--gray-1);
  transition: color 0.2s ease;
}

.upload-btn:hover {
  color: var(--theme-color);
}

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

.upload-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--backdrop);
  backdrop-filter: blur(1rem);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.upload-overlay:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.upload-overlay .close-btn {
  position: fixed;
  right: 1.5rem;
  top: .5rem;
  width: 2.5rem;
  height: 2.5rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  margin-left: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin-right: -0.5rem;
  z-index: 2;
}

.upload-overlay .close-btn svg {
  width: 20px;
  height: 20px;
  color: var(--gray-1);
  fill: var(--gray-1);
}

.upload-overlay .close-btn:hover svg {
  color: var(--gray-1);
  fill: var(--gray-1);
}

.upload-overlay .close-btn:hover {
  color: var(--gray-1);
}

.drop-zone {
  width: 80%;
  max-width: 600px;
  height: 300px;
  border-radius: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
}



.drop-zone-content {
  text-align: center;
  color: var(--text);
}

.drop-zone-content svg {
  margin-bottom: 1rem;
  color: var(--gray-1);
}

.drop-zone-content p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.upload-hint {
  font-size: 0.9rem;
  color: var(--gray-1);
}




/* Pricing Page Styles */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.plan {
    background-color: var(--sidebar-background);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.plan h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.plan .price {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.plan .price span {
    font-size: 1rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.plan ul {
    list-style: none;
    padding: 0;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.plan ul li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.plan ul li::before {
    content: '✔';
    color: var(--theme-color);
    position: absolute;
    left: 0;
}

.cta-button {
    background-color: var(--theme-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cta-button:hover {
    background-color: var(--theme-color-dark);
}

.cta-button[data-plan-name="free"] {
    background-color: transparent;
    color: var(--text);
    border: 1px solid var(--border-color);
    cursor: default;
}









@media (max-width: 576px) { 
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
    width: calc(100% - 1.5rem);
  }

  .book {
    padding: 0.125rem;
  }

  /* Removed legacy .book-count-indicator responsive styles */

  .current-indicator{
    color: var(--theme-color) !important;
    font-weight: 500 !important;
  }

  .empty-state{
    padding: 2rem 1rem;
  }

  .empty-state h3{
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .chat-grid{
    grid-template-columns: 1fr;
    width: 100vw;
    height: 100vh;
  }

  .chat-book-cover{
    display: none;
  }

  .chat-cover-container{
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 0;
  }

  .chat-cover-overlay{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
  }

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

  .chat-cover-overlay svg{
    width: 3rem;
    height: 3rem;
    color: white;
  }
}
  
/* User Plan Display in Dropdown */
.user-plan {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 4px;
  line-height: 1.4;
  cursor: help; /* Show that there's a tooltip */
}

.user-plan .current-indicator {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
  display: block;
  margin-top: 2px;
  cursor: help; /* Show that there's a tooltip */
}

/* Ensure tooltips are visible */
.user-plan[title]:hover::after,
.current-indicator[title]:hover::after {
  content: attr(title);
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  margin-top: -40px;
  margin-left: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Dashboard styles */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem; }
.stat-card { border: 1px solid var(--gray-lines); border-radius: 12px; padding: 1rem; background: var(--background); }
.stat-title { font-size: .9rem; color: var(--text-secondary); margin-bottom: .5rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; color: var(--text); }
.stat-sub { font-size: .8rem; color: var(--text-secondary); margin-top: .25rem; }
.section-title { margin: 1rem; font-weight: 600; }
  