

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

.title-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center; /* Center text in case of multi-line titles */
}

.title {
    text-align: center;
    font-weight: normal;
    font-size: 0.9rem;
    flex: 1 1 auto;
}

.home-icon {
    margin: 0;
    max-width: 30px;
    width: 100%;
}

.home-link {
    flex: 0 0 auto;    
}

.hello {
  flex: 0 0 auto; /* Keep the login link as its content size */
  align-self: flex-start;
  font-size: 10px;
}

.hello a {
    color: black;
}


#book-container {
    position: relative;
    margin: 0 auto;
}

.textLayer.unselectable,
.textLayer.unselectable * {
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Ensure the text selection layer behaves correctly under any global theme resets */
.textLayer, .textLayer * {
    letter-spacing: normal !important;
    word-spacing: normal !important;
    transform-origin: 0 0 !important;
    -webkit-transform-origin: 0 0 !important;
    font-variant-ligatures: none !important;
    font-feature-settings: normal !important;
    text-transform: none !important;
}

.textLayer span {
    white-space: pre !important;
}

.pagecontrols {
      display: flex;
      align-items: center; /* Centers items vertically */
      justify-content: space-between; /* Distributes items horizontally */
      width: 100%;
      max-width: 600px;
      height: 50px; /* Set height for the container */
      margin: 0 auto;
}

.pagecontrols img {
    cursor:pointer;
    width:33%;
    max-width: 250px;
}

.pagecontrols img:hover {
  filter: invert(20%);
}

.pagecontrols img:active {
  filter: invert(50%);
}

.pagecontrols .chapterpicker {
    width: 7%;
}

/* Chapter selection menu and comments consolidated book-drawer */
.book-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 350px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(110%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.book-drawer.show {
    transform: translateX(0);
}

.book-drawer ul {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.book-drawer ul li {
    margin: 8px 0;
    font-size: 1.1rem;
    text-align: left;
}

.book-drawer li:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.book-drawer li a {
    display: block;
    text-decoration: none;
    color: #334155;
    width: 100%;
    padding: 6px 10px;
    box-sizing: border-box;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: #475569;
    z-index: 10;
    line-height: 1;
}

.close-button:hover {
    color: #0f172a;
}

/* Tabs inside Drawer */
.drawer-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 1px solid #e2e8f0;
    margin-top: 25px;
    margin-bottom: 15px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    outline: none;
}

.tab-btn:hover {
    color: #0f172a;
}

.tab-btn.active {
    color: #0f172a;
    border-bottom-color: #0f172a;
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* mobile styles */
@media (width <= 600px) {
    .title {
        font-size: 0.7rem;
        margin: 8px 0 12px 0;
    }

    html, body {
        overflow-x: hidden;
        margin: 0;
    }

    .pagecontrols {
        margin-top: 10px;
    }

    .header {
        padding: 7.5px;
    }

    .home-icon {
        max-width: 15px;
    }

    .hello {
        font-size: 8px;
    }

    .book-drawer {
        width: 100%;
    }
}

/* desktop styles */
@media (width > 600px) {
    #book-container {
        margin: 20px auto;
    }

    .pagecontrols {
        margin-top: 20px;
    }
}

/* Comments and Emoji Reactions Styling */
.comments-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 5px;
    padding-right: 5px;
}

/* Comment Cards */
.comment-card {
    background: #fff;
    border: 1px solid #eef2f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    position: relative;
    transition: all 0.2s ease;
    text-align: left;
}

.comment-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.comment-card.orphaned {
    border-left: 4px solid #ff9800;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: bold;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.quote-text {
    font-size: 11px;
    font-style: italic;
    color: #64748b;
    background: #f8fafc;
    border-left: 2px solid #cbd5e1;
    padding: 4px 8px;
    margin: 4px 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-body {
    font-size: 13px;
    color: #0f172a;
    line-height: 1.4;
    word-break: break-word;
    margin-bottom: 6px;
}

/* Replies */
.replies-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.reply-card {
    font-size: 12px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
    margin-top: 6px;
    text-align: left;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}

.reply-author {
    font-weight: bold;
    color: #475569;
}

.reply-body {
    color: #334155;
}

/* Forms and Inputs */
.reply-form {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.reply-form input {
    flex: 1;
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
}

.reply-form input:focus {
    border-color: #94a3b8;
}

.reply-form button {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    background: #1e293b;
    color: #fff;
    cursor: pointer;
}

.reply-form button:hover {
    background: #0f172a;
}

/* Card buttons */
.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.card-actions button {
    font-size: 11px;
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 2px 6px;
}

.card-actions button:hover {
    color: #0f172a;
    text-decoration: underline;
}

/* Floating Toolbar */
.selection-toolbar {
    position: absolute;
    background: #1e293b;
    border-radius: 20px;
    padding: 6px 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: scale(0.9);
}

.selection-toolbar.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.selection-toolbar button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
    transition: transform 0.1s ease;
}

.selection-toolbar button:hover {
    transform: scale(1.2);
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background: #475569;
}

/* Comment/Reaction highlights */
.comment-highlight {
    background-color: rgba(255, 222, 100, 0.4);
    border-bottom: 1px dashed #ff9800;
    cursor: pointer;
    padding: 1px 0;
    color: transparent !important;
}

.reaction-highlight {
    background-color: rgba(147, 197, 253, 0.2);
    border-bottom: 2px dotted #3b82f6;
    cursor: pointer;
    padding: 1px 0;
    position: relative;
    color: transparent !important;
}

.textLayer mark {
    color: transparent !important;
}

/* New Comment Card in Sidebar */
.new-comment-card {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

.new-comment-card textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    resize: vertical;
    outline: none;
    margin-bottom: 8px;
}

.new-comment-card textarea:focus {
    border-color: #94a3b8;
}

.card-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.btn-save {
    background: #22c55e;
    color: #fff;
}

.btn-save:hover {
    background: #16a34a;
}

.btn-cancel {
    background: #e2e8f0;
    color: #475569;
}

.btn-cancel:hover {
    background: #cbd5e1;
}

/* Orphaned badge */
.orphaned-badge {
    background: #ffeebc;
    color: #b25e00;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: bold;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
}

/* Pulsing focus animation for selected comment card or reaction badge */
@keyframes pulse-highlight {
    0% {
        box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.4);
        background-color: rgba(254, 240, 138, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(234, 179, 8, 0.1);
        background-color: rgba(254, 240, 138, 0.2);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(234, 179, 8, 0);
    }
}

.comment-card.highlighted-active {
    animation: pulse-highlight 2s ease-in-out;
    border-color: #eab308 !important;
}

.reaction-badge.highlighted-active {
    animation: pulse-highlight 2s ease-in-out;
    border-color: #3b82f6 !important;
    background-color: #eff6ff !important;
}

