/* Bookshelf and Book page styles */

/* =============================================================================
   BOOKSHELF OVERVIEW PAGE
   ============================================================================= */

.bookshelf-container {
    max-width: 600px;
    margin: 0 auto;
    color: #333;
}

.bookshelf-header {
    text-align: center;
    margin-bottom: 2rem;
}

.bookshelf-header-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.bookshelf-header-icon svg {
    width: 40px;
    height: 40px;
    stroke: var(--accent-brown, #8b7355);
}

.bookshelf-header h1 {
    font-family: var(--serif-font, Georgia, serif);
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    color: #333;
}

.bookshelf-subtitle {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* Bookshelf Section */
.bookshelf-section {
    margin-bottom: 2rem;
}

.bookshelf-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.bookshelf-section-title {
    font-family: var(--serif-font, Georgia, serif);
    font-size: 1.25rem;
    color: #333;
    margin: 0;
}

/* Create Book Button */
.bookshelf-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #d4a537;
    border-radius: 6px;
    color: #d4a537;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bookshelf-create-btn:hover {
    background: #fff8e8;
}

/* Books List */
.bookshelf-books-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Book item with reorder arrows */
.bookshelf-book-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

/* Reorder Arrows for Books */
.bookshelf-book-reorder {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex-shrink: 0;
    padding-left: 0.75rem;
}

.bookshelf-book-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    padding-left: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

/* When there are no reorder arrows, add left padding */
.bookshelf-book-item:not(:has(.bookshelf-book-reorder)) .bookshelf-book-link {
    padding-left: 1rem;
}

.bookshelf-book-item:hover {
    border-color: #d4a537;
    background: #fefef9;
}

.bookshelf-book-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.bookshelf-book-icon svg {
    width: 100%;
    height: 100%;
}

/* Featured book icon colors */
.bookshelf-icon-favorites {
    color: #d4a537;
}

.bookshelf-icon-recent {
    color: #5b8fa8;
}

.bookshelf-icon-history {
    color: #8b7355;
}

.bookshelf-icon-history svg {
    fill: currentColor;
}

/* Featured book name (bold) */
.bookshelf-book-name-featured {
    font-weight: 600;
}

.bookshelf-book-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.bookshelf-book-name {
    font-weight: 500;
    color: #333;
}

.bookshelf-book-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.3;
}

.bookshelf-book-count {
    font-size: 0.8rem;
    color: #999;
}

.bookshelf-book-arrow {
    color: #ccc;
    font-size: 1rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.bookshelf-book-link:hover .bookshelf-book-arrow {
    color: #d4a537;
    transform: translateX(3px);
}

/* Empty State */
.bookshelf-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.bookshelf-empty-hint {
    font-size: 0.9rem;
    color: #888;
    margin-top: 0.5rem;
}

/* =============================================================================
   INDIVIDUAL BOOK PAGE
   ============================================================================= */

.book-container {
    max-width: 600px;
    margin: 0 auto;
    color: #333;
}

/* =============================================================================
   CENTERED BOOK HEADER (shared by list and feed views)
   ============================================================================= */

.book-header-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.book-header-centered .book-header-icon {
    margin-bottom: 0.5rem;
}

.book-header-centered .book-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 0.25rem 0;
}

.book-header-centered .book-subtitle,
.book-header-centered .book-description {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem 0;
}

.book-header-centered .book-count {
    margin: 0;
}

/* Actions row with delete button and toggle */
.book-header-actions-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Compact delete button for centered layout */
.book-header-actions-row .book-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 1px solid #ddd;
    border-radius: 20px;  /* Match toggle pill shape */
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.book-header-actions-row .book-delete-btn:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.book-header-actions-row .book-delete-btn svg {
    width: 14px;
    height: 14px;
}

/* View toggle in centered header - align with delete button */
.book-header-centered .book-header-actions-row .view-toggle-pill {
    position: static !important;
    transform: none !important;
    display: inline-flex;
    align-items: center;
    margin: 0;
    margin-top: -1px;  /* Visual alignment nudge */
    padding: 3px;
    background-color: #f0f3f6;
    border-radius: 20px;
}

/* Book Header (legacy - keep for backwards compatibility) */
.book-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.book-header-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.book-icon-favorites {
    background: linear-gradient(135deg, #fff5e0 0%, #fff9ee 100%);
    color: #d4a537;
}

.book-icon-recent {
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f8ff 100%);
    color: #5b8fa8;
}

.book-icon-custom {
    background: linear-gradient(135deg, #f0f0f0 0%, #f8f8f8 100%);
    color: #666;
}

.book-header-icon svg {
    width: 28px;
    height: 28px;
}

.book-header-text {
    flex: 1;
    min-width: 0;
}

.book-title {
    font-family: var(--serif-font, Georgia, serif);
    font-size: 1.75rem;
    margin: 0 0 0.25rem 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-title-editable .book-title-text {
    /* Allow text to wrap */
}

.book-edit-title-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
}

.book-edit-title-btn:hover {
    color: #d4a537;
}

.book-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 0.25rem 0;
}

/* Book Description (custom books only) */
.book-description {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
}

.book-description-text {
    color: #666;
}

.book-description-placeholder {
    color: #aaa;
    font-style: italic;
}

.book-edit-desc-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    background: none;
    border: none;
    color: #bbb;
    cursor: pointer;
    transition: color 0.2s ease;
}

.book-edit-desc-btn:hover {
    color: #d4a537;
}

.book-count {
    color: #999;
    font-size: 0.85rem;
    margin: 0;
}

.book-header-actions {
    flex-shrink: 0;
}

.book-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.book-delete-btn:hover {
    border-color: #dc3545;
    color: #dc3545;
}

/* Articles List */
.book-articles-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.book-article-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.book-article-item:hover {
    border-color: #ddd;
}

.book-article-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

/* Reorder Arrows */
.book-article-reorder {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex-shrink: 0;
}

.reorder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    padding: 0;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 4px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s ease;
}

.reorder-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #ddd;
    color: #333;
}

.reorder-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Article Main Content */
.book-article-main {
    flex: 1;
    min-width: 0;
}

.book-article-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.book-article-title {
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.book-article-title:hover {
    color: #d4a537;
}

.book-article-practices {
    display: inline-flex;
    gap: 0.25rem;
}

.book-practice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #8b7355;
}

.book-practice-icon svg {
    width: 100%;
    height: 100%;
}

.book-practice-icon {
    position: relative;
    cursor: pointer;
}

/* Practice icon tooltip */
.book-practice-tooltip {
    display: none;
    position: fixed;
    padding: 0.4rem 0.7rem;
    background-color: #f5f2ee;
    color: #5a6a7a;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    border: 1px solid #e8e4df;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    pointer-events: none;
}

.book-article-context {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #888;
}

.book-article-context .context-link {
    color: #888;
    text-decoration: none;
}

.book-article-context .context-link:hover {
    color: #d4a537;
}

.context-separator {
    color: #ccc;
}

.reading-state-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.reading-state-badge.finished {
    background: #d4edda;
    color: #155724;
}

.reading-state-badge.in-progress {
    background: #fff3cd;
    color: #856404;
}

/* Article Actions */
.book-article-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.book-article-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #999;
    cursor: pointer;
    transition: all 0.2s ease;
}

.book-article-remove-btn:hover {
    background: #fff5f5;
    border-color: #f5c6cb;
    color: #dc3545;
}

/* History button for recent reads */
.book-article-history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    fill: #999;
    text-decoration: none;
    transition: all 0.2s ease;
}

.book-article-history-btn:hover {
    background: rgba(91, 143, 168, 0.1);
    border-color: rgba(91, 143, 168, 0.3);
    fill: #5b8fa8;
}

/* Empty State */
.book-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.book-empty-hint {
    font-size: 0.9rem;
    color: #888;
    margin-top: 0.5rem;
}

.book-cta {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #d4a537;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.book-cta:hover {
    background: #c49428;
}

/* Publish State Badges */
.publish-state-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.publish-state-badge.early {
    background: #ffeeba;
    color: #856404;
}

.publish-state-badge.preview {
    background: #d1ecf1;
    color: #0c5460;
}

/* =============================================================================
   MODAL ADDITIONS
   ============================================================================= */

.modal-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 0.875rem;
}

.modal-hint {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
}

/* =============================================================================
   FORM ELEMENTS
   ============================================================================= */

/* Optional label hint */
.form-label-optional {
    color: #999;
    font-weight: 400;
    font-size: 0.85em;
}

/* Character count for textareas */
.form-char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

/* Textarea styling in modals */
.modal-form textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-form textarea:focus {
    outline: none;
    border-color: #d4a537;
    box-shadow: 0 0 0 2px rgba(212, 165, 55, 0.15);
}

.modal-form textarea::placeholder {
    color: #aaa;
}

/* =============================================================================
   BOOK PICKER MODAL
   ============================================================================= */

.book-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10002;  /* Above feed modal (9998) and unfavorite confirm (10000) */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.book-picker-overlay:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
}

.book-picker-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 360px;
    max-height: 80vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 10003;  /* Above book picker overlay */
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.book-picker-modal:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
}

.book-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
}

.book-picker-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.book-picker-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.book-picker-close:hover {
    background-color: #f8f9fa;
    color: #2c3e50;
}

.book-picker-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.book-picker-loading {
    padding: 2rem;
    text-align: center;
    color: #6c757d;
}

.book-picker-list {
    display: flex;
    flex-direction: column;
}

.book-picker-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease;
}

.book-picker-item:hover {
    background-color: #f8f9fa;
}

.book-picker-item-check {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #3498db;
}

.book-picker-item-check svg {
    width: 18px;
    height: 18px;
}

.book-picker-item-check:not(.checked) {
    color: #dee2e6;
}

.book-picker-item-check.checked {
    color: #3498db;
}

.book-picker-item-name {
    flex: 1;
    font-size: 0.95rem;
    color: #2c3e50;
}

.book-picker-item.in-book .book-picker-item-name {
    font-weight: 500;
}

/* Books section with list and action buttons */
.book-picker-books-section {
    padding: 0 1.25rem 0.75rem;
}

.book-picker-empty {
    padding: 1.5rem 0;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Action buttons container (Done/Cancel) */
.book-picker-actions {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

.book-picker-hint {
    margin: 0 0 0.75rem 0;
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
}

.book-picker-actions-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Shared button styles */
.book-picker-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.book-picker-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.book-picker-btn-primary {
    background-color: #d4a537;
    color: #fff;
}

.book-picker-btn-primary:hover:not(:disabled) {
    background-color: #c49428;
}

.book-picker-btn-secondary {
    background-color: #f8f9fa;
    color: #6c757d;
}

.book-picker-btn-secondary:hover:not(:disabled) {
    background-color: #e9ecef;
}

/* Divider between books list and create section */
.book-picker-divider {
    margin: 0.5rem 1.25rem;
    border: none;
    border-top: 1px solid #e9ecef;
}

/* Create new book section */
.book-picker-create {
    padding: 0.5rem 1.25rem 1rem;
}

.book-picker-create-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px dashed #dee2e6;
    background: transparent;
    border-radius: 8px;
    color: #6c757d;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.book-picker-create-btn:hover {
    border-color: #3498db;
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.book-picker-create-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.book-picker-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.book-picker-create-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
}

.book-picker-create-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.book-picker-create-submit,
.book-picker-create-cancel {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.book-picker-create-submit {
    background-color: #3498db;
    color: #fff;
}

.book-picker-create-submit:hover {
    background-color: #2980b9;
}

.book-picker-create-cancel {
    background-color: #f8f9fa;
    color: #6c757d;
}

.book-picker-create-cancel:hover {
    background-color: #e9ecef;
}

.book-picker-error {
    padding: 0.75rem 1.25rem;
    color: #dc3545;
    font-size: 0.9rem;
}

/* =============================================================================
   COMPACT BOOK TOGGLE (for list views)
   ============================================================================= */

/* Compact book toggle for book pages and history list */
.book-toggle-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.book-toggle-compact:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.book-toggle-compact.in-books {
    color: #3498db;
}

.book-toggle-compact.in-books:hover {
    background: rgba(52, 152, 219, 0.15);
}

/* Inline book toggle with label (for article timeline view) */
.book-toggle-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.book-toggle-inline:hover {
    color: #3498db;
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.book-toggle-inline.in-books {
    color: #3498db;
    border-color: #3498db;
}

.book-toggle-inline .bookmark-icon {
    flex-shrink: 0;
}

.book-toggle-inline .book-toggle-label {
    white-space: nowrap;
}

/* =============================================================================
   FAVORITE TOGGLE (for book pages - Recent Reads and Custom Books)
   ============================================================================= */

/* Compact Favorite Toggle (matches history.css pattern) */
.book-article-actions .favorite-toggle-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.book-article-actions .favorite-toggle-compact:hover {
    color: #d4a537;
    background: rgba(212, 165, 55, 0.1);
}

.book-article-actions .favorite-toggle-compact.favorited {
    color: #d4a537;
}

.book-article-actions .favorite-toggle-compact.favorited:hover {
    color: #b8922f;
    background: rgba(212, 165, 55, 0.15);
}

.book-article-actions .favorite-toggle-compact .star-icon {
    transition: transform 0.15s ease;
}

.book-article-actions .favorite-toggle-compact:active .star-icon {
    transform: scale(0.9);
}

/* Pulse animation for favorite toggle */
@keyframes bookshelf-favorite-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.book-article-actions .favorite-toggle-compact.animating .star-icon {
    animation: bookshelf-favorite-pulse 0.3s ease;
}

/* =============================================================================
   VIEW TOGGLE (List/Feed switch)
   ============================================================================= */

/* Header layout when toggle is present */
.book-header.book-header-with-toggle {
    flex-wrap: wrap;
    justify-content: space-between;
}

.book-header-main {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

/* View toggle pill - override toc.css absolute positioning */
.book-container .view-toggle-pill,
.book-feed-container .view-toggle-pill {
    position: static;
    transform: none;
    display: inline-flex;
    align-items: center;
    background-color: #f0f3f6;
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
    margin-top: 0.5rem;
}

.view-toggle-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border-radius: 16px;
    color: #95a5a6;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.view-toggle-option:hover:not(.active) {
    color: #5a6a7a;
    background-color: rgba(0, 0, 0, 0.05);
}

.view-toggle-option.active {
    background-color: #ffffff;
    color: #3498db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: default;
}

.view-toggle-option svg {
    flex-shrink: 0;
}

/* =============================================================================
   BOOK FEED VIEW
   ============================================================================= */

.book-feed-container {
    max-width: 600px;
    margin: 0 auto;
    color: #333;
}

.book-feed-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.book-feed-header-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.book-feed-header-text {
    flex: 1;
    min-width: 0;
}

.book-feed-title {
    font-family: var(--serif-font, Georgia, serif);
    font-size: 1.75rem;
    margin: 0 0 0.25rem 0;
    color: #333;
}

.book-feed-count {
    color: #999;
    font-size: 0.85rem;
    margin: 0;
}

/* Feed content area */
.book-feed-container .feed-content {
    /* Inherit from toc-feed.css */
}

.book-feed-container .feed-container {
    /* Inherit from toc-feed.css */
}

/* Feed end marker for books */
.book-feed-container .feed-end-marker {
    text-align: center;
    padding: 2rem 1rem;
    color: #999;
    font-size: 0.9rem;
}

/* Feed empty state styling */
.book-feed-container .feed-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* Tablet and mobile optimizations */
@media (max-width: 768px) {
    /* Tighter article card layout */
    .book-article-card {
        gap: 0.25rem;
        padding: 0.5rem;
    }

    /* Smaller action buttons */
    .book-article-actions {
        gap: 0;
        margin-left: 0.125rem;
    }

    .book-article-remove-btn,
    .book-article-history-btn,
    .book-toggle-compact,
    .book-article-actions .favorite-toggle-compact {
        width: 22px;
        height: 22px;
    }

    .book-article-remove-btn svg,
    .book-article-history-btn svg,
    .book-toggle-compact svg,
    .book-article-actions .favorite-toggle-compact svg {
        width: 14px;
        height: 14px;
    }

    /* Tighter title row */
    .book-article-title-row {
        gap: 0.1875rem;
    }

    .book-article-title {
        font-size: 0.875rem;
    }

    /* Smaller reading state badge */
    .reading-state-badge {
        font-size: 0.55rem;
        padding: 0.0625rem 0.25rem;
    }

    /* Smaller practice icons */
    .book-practice-icon {
        width: 12px;
        height: 12px;
    }

    .book-article-practices {
        gap: 0.0625rem;
    }

    /* Smaller publish state badge */
    .publish-state-badge {
        font-size: 0.5rem;
        padding: 0.0625rem 0.1875rem;
    }

    /* Smaller reorder buttons */
    .book-article-reorder {
        gap: 0;
    }

    .reorder-btn {
        width: 22px;
        height: 18px;
    }

    .reorder-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Tighter context row */
    .book-article-context {
        font-size: 0.75rem;
        margin-top: 0.125rem;
    }
}

/* View toggle responsive */
@media (max-width: 768px) {
    .view-toggle-pill {
        padding: 2px;
    }

    .view-toggle-option {
        width: 28px;
        height: 24px;
    }

    .view-toggle-option svg {
        width: 14px;
        height: 14px;
    }

    .book-feed-title {
        font-size: 1.5rem;
    }
}

/* Narrow mobile - additional layout changes */
@media (max-width: 480px) {
    .bookshelf-header h1,
    .book-title {
        font-size: 1.5rem;
    }

    .book-header:not(.book-header-with-toggle) {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* When toggle is present, keep header horizontal but stack toggle below */
    .book-header-with-toggle {
        gap: 0.75rem;
    }

    .book-feed-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .book-header-icon {
        width: 40px;
        height: 40px;
    }

    .book-header-icon svg {
        width: 24px;
        height: 24px;
    }

    .book-header-actions {
        width: 100%;
    }

    .book-delete-btn {
        width: 100%;
        justify-content: center;
    }

    .bookshelf-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* =============================================================================
   PUBLISH STATE STYLING (Early/Preview content)
   ============================================================================= */

/* Combined: Background Tint + Left Border Accent */
.book-article-item.state-early {
    background: linear-gradient(135deg, #f6faf5 0%, #eef4ec 100%);
    border-left: 4px solid #9ab392;
}

.book-article-item.state-preview {
    background: linear-gradient(135deg, #f4faf9 0%, #e8f4f2 100%);
    border-left: 4px solid #7dbdb4;
}
