/* Custom CSS for Scrivibe style */

/* Responsive Header Styling */
.header-section {
    margin-bottom: 2rem !important;
}

.header-section h1 {
    color: #000000;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-shadow: none;
}

/* Mobile-specific header styling */
@media (max-width: 767.98px) {
    .header-section h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
        margin-bottom: 1rem !important;
    }
    
    .header-section .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

/* Desktop-specific header styling */
@media (min-width: 768px) {
    .header-section h1 {
        font-size: 2.2rem !important;
        line-height: 1.2;
    }
    
    .header-section .btn {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
}

/* Extra large screens */
@media (min-width: 1200px) {
    .header-section h1 {
        font-size: 2.5rem !important;
    }
}

/* Enhanced button styling for header */
.header-section .btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-section .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* CSS Counter for Token Display */
:root {
    --token-amount: 20000;
}

.token-counter::before {
    content: attr(data-formatted-value);
}

.token-counter[data-formatted-value]::before {
    content: attr(data-formatted-value);
}

/* Ebook-style streaming text effect */
.streaming-text {
    white-space: pre-wrap;
    font-family: 'Times New Roman', Times, serif;
    font-size: 18px;
    line-height: 1.8;
    color: #1a1a1a;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    text-indent: 2em;
    
    /* Smooth word-by-word streaming effects */
    transition: opacity 0.2s ease-in-out, transform 0.1s ease-out;
    transform: translateZ(0); /* Hardware acceleration */
}

/* Blinking cursor animation */
.blinking-cursor {
    display: inline-block;
    color: #F78166; /* Claude.ai orange color */
    font-weight: bold;
    animation: blink 0.8s infinite;
    position: relative;
    top: -1px;
}

/* Typing cursor for streaming text */
.typing-cursor {
    display: inline-block;
    line-height: inherit;
    font-family: inherit;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

/* Inline generation container Claude.ai styling */
#inline-generation-container {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

#inline-generation-container.generating {
    border-color: #F78166;
}

#inline-content-display {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    padding: 40px 50px;
    background-color: #fefefe;
    background-image: linear-gradient(135deg, #fefefe 0%, #fcfcfc 100%);
    border-radius: 0 0 12px 12px;
    line-height: 1.8;
    font-family: 'Times New Roman', Times, serif;
    font-size: 18px;
    color: #1a1a1a;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    text-indent: 2em;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.03);
}

/* Book formatting styles - professional academic book format with page-turn animations */
@keyframes page-flip {
    0% {
        transform: perspective(1000px) rotateY(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(1000px) rotateY(5deg);
        opacity: 0.9;
    }
    60% {
        transform: perspective(1000px) rotateY(-5deg);
        opacity: 1;
    }
    100% {
        transform: perspective(1000px) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Animation for new content */
.new-content {
    animation: page-flip 0.8s ease-out forwards;
    transform-origin: left center;
}

/* Claude.ai style shimmer effect for generating text */
.generating-text {
    background: linear-gradient(to right, #f0f0f0 8%, #f8f8f8 18%, #f0f0f0 33%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}
.book-format-container {
    padding: 2.5rem 3rem;
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.6;
    text-align: justify;
    color: #000;
    background-color: #fff;
    max-width: 800px;
    margin: 0 auto;
    hyphens: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    /* Paper texture background for realistic look */
    background-image: url('data:image/png;base64,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');
    position: relative;
    overflow: hidden;
}

/* Create page edges effect */
.book-format-container:before,
.book-format-container:after {
    content: "";
    position: absolute;
    width: 100%;
    height: 25px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0) 100%);
    top: 0;
    left: 0;
    pointer-events: none;
}

.book-format-container:after {
    top: auto;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0) 100%);
}

.book-chapter-title {
    font-size: 2.2rem;
    font-weight: bold;
    margin: 2rem 0 2.5rem;
    color: #000;
    text-align: center;
    font-family: 'Times New Roman', Times, serif;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
    position: relative;
}

/* Decorative element under chapter title */
.book-chapter-title:after {
    content: "§";
    font-size: 1.5rem;
    display: block;
    text-align: center;
    color: #555;
    margin-top: 0.7rem;
    font-weight: normal;
}

.book-section-title {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 2.5rem 0 1.5rem;
    color: #000;
    font-family: 'Times New Roman', Times, serif;
    text-align: left;
    padding-bottom: 0.3rem;
    border-bottom: 1px dotted #eee;
}

.book-subsection-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 1.8rem 0 1.2rem;
    color: #000;
    font-family: 'Times New Roman', Times, serif;
    position: relative;
    padding-left: 0.8rem;
}

/* Small decorative element for subsection titles */
.book-subsection-title:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2rem;
    height: 80%;
    width: 3px;
    background-color: #ddd;
}

.book-paragraph {
    margin: 0 0 0.6rem 0;
    text-indent: 2rem;
    line-height: 1.6;
    font-size: 1.1rem;
    font-family: 'Times New Roman', Times, serif;
    text-align: justify;
    padding: 0.2rem 0;
    color: #222;
    letter-spacing: 0.01rem;
    word-spacing: 0.05rem;
    hyphens: auto;
}

.book-paragraph:first-of-type,
.book-paragraph:first-child {
    text-indent: 0;
}

/* Special first dropcap paragraph */
.book-paragraph.first-paragraph::first-letter {
    font-size: 3.5rem;
    float: left;
    line-height: 0.8;
    margin-right: 0.1em;
    margin-top: 0.1em;
}

.book-list {
    margin: 0.5rem 0 1rem 2rem;
    font-size: 1.1rem;
    font-family: 'Times New Roman', Times, serif;
}

.book-list li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.book-quote {
    margin: 1.5rem 3rem;
    padding: 0.5rem 1rem;
    border-left: 2px solid #444;
    font-style: italic;
    color: #333;
    font-family: 'Times New Roman', Times, serif;
}

/* Footnote styling */
.book-footnote {
    font-size: 0.9rem;
    color: #444;
    vertical-align: super;
    margin: 0 0.2rem;
}

.book-footnote-list {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
    font-size: 0.9rem;
    color: #444;
}

/* New CSS for additional markdown elements */
.book-image-container {
    margin: 2rem auto;
    text-align: center;
    max-width: 100%;
}

.book-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #eee;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.book-image-container figcaption {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
}

.book-code-block {
    background-color: #f5f5f5;
    border: 1px solid #eee;
    border-radius: 3px;
    padding: 1rem;
    margin: 1.5rem 0;
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    overflow-x: auto;
}

.book-inline-code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9rem;
    color: #333;
}

.book-hr {
    margin: 2rem 0;
    border: 0;
    height: 1px;
    background-color: #ccc;
}

.book-table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    border: 1px solid #ddd;
}

.book-table th,
.book-table td {
    padding: 0.5rem 0.8rem;
    border: 1px solid #ddd;
    text-align: left;
}

.book-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.book-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.book-subsection-title-2 {
    font-size: 1.15rem;
    font-weight: bold;
    margin: 1.3rem 0 0.8rem;
    color: #333;
}

.book-subsection-title-3 {
    font-size: 1.05rem;
    font-weight: bold;
    margin: 1.1rem 0 0.7rem;
    color: #444;
}

/* Academic book needs proper blockquote styling */
blockquote.book-citation {
    margin: 1.5rem 3rem;
    padding: 1rem;
    font-style: italic;
    color: #333;
    border-left: none;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

/* Styles for superscript/reference citations */
.book-citation-ref {
    font-size: 0.75em;
    vertical-align: super;
    color: #555;
    text-decoration: none;
}

/* Styles for figures or images */
.book-figure {
    margin: 2rem auto;
    text-align: center;
}

.book-figure img {
    max-width: 100%;
    height: auto;
    margin-bottom: 0.5rem;
}

.book-figure-caption {
    font-size: 0.9rem;
    color: #555;
    text-align: center;
    font-style: italic;
}

/* Typography */
body {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Georgia', serif;
    font-weight: normal;
    margin-bottom: 1.2rem;
}

/* Header and Navigation */
.navbar {
    background-color: #fff !important;
    box-shadow: none;
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.navbar-brand {
    font-family: 'Georgia', serif;
    font-size: 1.5rem;
    color: #333 !important;
}

.nav-link {
    color: #333 !important;
    margin-left: 1.5rem;
    position: relative;
}

.nav-link.active {
    font-weight: bold;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #333;
}

/* Container */
.container {
    max-width: 800px;
    padding-top: 0;
}

.card {
    margin-top: 0.5rem;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
}

.breadcrumb-item a {
    color: #666;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #333;
}

/* Accordion Styling */
.accordion-button {
    background-color: #f1f3f5;
    border: none;
    padding: 1.2rem;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    border-left: 3px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.accordion-button:hover {
    background-color: #e9ecef;
    color: #000;
    border-left-color: #adb5bd;
    cursor: pointer;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(173, 181, 189, 0.15);
    border-color: #adb5bd;
    background-color: #e9ecef;
}

.accordion-button:not(.collapsed) {
    background-color: #e9ecef;
    color: #000;
    border-left-color: #333;
}

.accordion-button::after {
    transition: transform 0.3s ease;
    background-size: 1.4rem;
    opacity: 0.8;
    content: '';
}

.accordion-button:hover::after {
    opacity: 1;
}

/* Cards */
.card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 2rem;
    background-color: #fff;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #eee;
    padding: 0.75rem 0;
}

.card-body {
    padding: 0 0 0 0; /* Removed padding to eliminate extra space */
}

/* Examples Box */
.examples-box {
    background-color: #f8f9fa;
    border-left: 3px solid #dee2e6;
    padding: 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Ejemplos encima de los inputs */
.example-wrapper {
    display: flex;
    flex-direction: column;
}

.example-toggle-btn {
    position: relative;
    top: -2px;
    opacity: 0.5;
    font-size: 0.8rem;
    transition: opacity 0.2s ease;
}

.example-toggle-btn:hover {
    opacity: 0.8;
}

.example-toggle-btn i {
    font-size: 0.8rem;
}

/* Form Elements */
.form-control {
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 0.75rem;
    box-shadow: none;
    background-color: #f9f9f9;
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: #333;
    box-shadow: none;
}

/* Comprehensive placeholder styling for all form fields */
.form-control::placeholder {
    color: #999;
    font-style: italic;
    opacity: 1;
}

/* Placeholder styling for select elements */
.form-control option[value=""] {
    color: #999;
    font-style: italic;
}

/* When select has no value selected (shows placeholder) */
.form-control:invalid {
    color: #999;
    font-style: italic;
}

/* When select has a valid value selected */
.form-control:valid {
    color: #333;
    font-style: normal;
}

/* Additional styling for all input types */
input.form-control::placeholder,
textarea.form-control::placeholder,
select.form-control option[value=""] {
    color: #999;
    font-style: italic;
    opacity: 1;
}

/* Ensure selected values in all form controls are properly styled */
input.form-control:not(:placeholder-shown),
textarea.form-control:not(:placeholder-shown),
select.form-control:not([value=""]) {
    color: #333;
    font-style: normal;
}

.form-label {
    font-weight: 600;
    color: #222;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: 0;
    padding: 0.5rem 1.5rem;
    font-weight: normal;
    text-transform: none;
}

.btn-primary {
    background-color: #333;
    border-color: #333;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #444;
    border-color: #444;
}

.btn-secondary {
    background-color: #f5f5f5;
    border-color: #ddd;
    color: #333;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #e5e5e5;
    border-color: #ccc;
    color: #333;
}

.btn-danger {
    background-color: #f8f8f8;
    border-color: #ddd;
    color: #d9534f;
}

.btn-danger:hover, .btn-danger:focus {
    background-color: #fee;
    border-color: #d9534f;
    color: #c9302c;
}

/* Chapter Elements */
.chapter-card {
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0; /* Removed padding to eliminate extra space */
}

.chapter-content {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background-color: #fcfcfc;
    border-left: 3px solid #eee;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.regenerate-form {
    margin-top: 1.5rem;
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-left: 3px solid #eee;
}

/* Progress */
.progress-container {
    margin: 2.5rem 0;
}

.progress {
    height: 10px;
    border-radius: 0;
    background-color: #f5f5f5;
}

.progress-bar {
    background-color: #333;
}

/* Loading Overlay - Modified to be non-blocking for generation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999; /* Lower z-index so it doesn't interfere with UI */
    pointer-events: none; /* Allow interaction with elements underneath */
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    color: #333;
    /* Make the spinner have pointer events so it can be clicked through */
    pointer-events: none;
}

/* Alerts */
.alert {
    border-radius: 0;
    border: none;
    border-left: 3px solid;
    padding: 1rem 1.5rem;
}

.alert-info {
    background-color: #f8f9fa;
    border-left-color: #17a2b8;
    color: #333;
}

.alert-danger {
    background-color: #fff8f8;
    border-left-color: #dc3545;
    color: #333;
}

.alert-success {
    background-color: #f8fff8;
    border-left-color: #28a745;
    color: #333;
}

/* Book Details */
.book-details {
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

/* Enhanced Checkboxes */
.ai-checkbox-container {
    margin-top: 4px;
    display: flex;
    align-items: center;
}

/* Smaller form checks for more compact layout */
.form-check-sm .form-check-input {
    width: 14px !important;
    height: 14px !important;
    margin-top: 2px;
}

.form-check-sm .form-check-label {
    font-size: 0.85rem;
    line-height: 1.2;
}

/* Pulse animation for the checkbox input */
@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(51, 51, 51, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(51, 51, 51, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(51, 51, 51, 0);
    }
}

.pulse-animation .form-check-input {
    animation: pulse-border 1.5s ease-out;
}

/* Make all checkboxes more visible with consistent styling */
.form-check-input {
    cursor: pointer;
    position: relative;
    z-index: 2;
}

/* Target specific checkboxes that need enhanced visibility */
.ai-checkbox-container .form-check-input,
#confirm-generation {
    border: 2px solid #333;
}

.ai-checkbox-container .form-check-input:checked,
#confirm-generation:checked {
    background-color: #333;
    border-color: #333;
}

.ai-checkbox-container .form-check-input:focus,
#confirm-generation:focus {
    box-shadow: 0 0 0 0.25rem rgba(51, 51, 51, 0.25);
    border-color: #333;
}

/* Add a subtle outline to make checkboxes more noticeable */
.ai-checkbox-container .form-check-input::after,
#confirm-generation::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border: 1px solid rgba(51, 51, 51, 0.3);
    border-radius: 0.25rem;
    pointer-events: none;
}

/* For normal size checkboxes */
.ai-checkbox-container .form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 0;
    margin-right: 8px;
    flex-shrink: 0;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

/* Style for checkboxes in confirmation areas */
#confirm-generation {
    transform: none !important;
    margin-right: 8px !important;
    width: 18px !important;
    height: 18px !important;
    position: relative;
    top: -1px;
}

.ai-checkbox-container .form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

.ai-checkbox-container .form-check-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    line-height: 1.1;
    font-size: 0.9rem;
}

.ai-checkbox-container .token-cost {
    font-weight: 600;
    color: #333;
    margin-left: 3px;
}

/* Legal Pre-Footer */
.legal-pre-footer {
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    color: #666;
    padding: 0.8rem 0;
    font-size: 0.85rem;
    text-align: center;
}

.legal-pre-footer .legal-links-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.legal-pre-footer a {
    color: #555;
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
    padding: 0 5px;
}

.legal-pre-footer a:hover {
    color: #000;
    text-decoration: underline;
}

.legal-pre-footer .legal-separator {
    color: #ccc;
    font-size: 0.7rem;
    margin: 0 2px;
}

/* Media query for small screens */
@media (max-width: 767px) {
    .legal-pre-footer .legal-links-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .legal-pre-footer .legal-separator {
        display: none;
    }
}

/* Legal Pages Styling */
.legal-content-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    padding: 2rem;
    margin: 2rem 0;
}

.legal-header {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.legal-metadata {
    color: #777;
    font-style: italic;
    margin-bottom: 2rem;
}

.legal-body {
    font-size: 1rem;
    line-height: 1.7;
    color: #444;
}

.legal-body h2 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #333;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f5f5f5;
}

.legal-body h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #444;
}

.legal-body p {
    margin-bottom: 1rem;
}

.legal-body ul, .legal-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.legal-body li {
    margin-bottom: 0.5rem;
}

.legal-body a {
    color: #555;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.legal-body a:hover {
    color: #000;
}

.legal-body .highlight {
    background-color: #fffde7;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid #ffd54f;
}

.legal-toc {
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.legal-toc h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.legal-toc ul {
    list-style-type: none;
    padding-left: 0;
}

.legal-toc li {
    margin-bottom: 0.5rem;
}

.legal-toc a {
    text-decoration: none;
    color: #555;
}

.legal-toc a:hover {
    color: #000;
}

.legal-contact-info {
    background-color: #f8f9fa;
    padding: 1.5rem;
    margin-top: 2rem;
    border-radius: 4px;
}

.legal-contact-info h3 {
    margin-top: 0;
    font-size: 1.2rem;
}

.legal-return-top {
    display: block;
    margin-top: 2rem;
    text-align: right;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background-color: #fff !important;
    border-top: 1px solid #eee;
    color: #666 !important;
    padding: 2rem 0;
}

footer a {
    color: #555;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

footer a:hover {
    color: #000;
    text-decoration: none;
}

/* Override Bootstrap Dark Theme */
[data-bs-theme=dark] {
    --bs-body-color: #333;
    --bs-body-bg: #fff;
    --bs-emphasis-color: #111;
    --bs-emphasis-color-rgb: 17, 17, 17;
    --bs-secondary-color: #666;
    --bs-secondary-color-rgb: 102, 102, 102;
    --bs-tertiary-color: #999;
    --bs-tertiary-color-rgb: 153, 153, 153;
    --bs-secondary-bg: #f5f5f5;
    --bs-secondary-bg-rgb: 245, 245, 245;
    --bs-tertiary-bg: #f9f9f9;
    --bs-tertiary-bg-rgb: 249, 249, 249;
    --bs-emphasis-color: #111;
    --bs-primary-text-emphasis: #333;
    --bs-secondary-text-emphasis: #666;
    --bs-success-text-emphasis: #28a745;
    --bs-info-text-emphasis: #17a2b8;
    --bs-warning-text-emphasis: #ffc107;
    --bs-danger-text-emphasis: #dc3545;
    --bs-light-text-emphasis: #f8f9fa;
    --bs-dark-text-emphasis: #212529;
    --bs-primary-bg-subtle: #f8f9fa;
    --bs-secondary-bg-subtle: #f5f5f5;
    --bs-success-bg-subtle: #f0fff0;
    --bs-info-bg-subtle: #f0f8ff;
    --bs-warning-bg-subtle: #fffcf0;
    --bs-danger-bg-subtle: #fff0f0;
    --bs-light-bg-subtle: #fcfcfc;
    --bs-dark-bg-subtle: #e9e9e9;
    --bs-primary-border-subtle: #dee2e6;
    --bs-secondary-border-subtle: #e9ecef;
    --bs-success-border-subtle: #c3e6cb;
    --bs-info-border-subtle: #bee5eb;
    --bs-warning-border-subtle: #ffeeba;
    --bs-danger-border-subtle: #f5c6cb;
    --bs-light-border-subtle: #e9ecef;
    --bs-dark-border-subtle: #c6c8ca;
    --bs-link-color: #333;
    --bs-link-hover-color: #111;
    --bs-link-color-rgb: 51, 51, 51;
    --bs-link-hover-color-rgb: 17, 17, 17;
    --bs-code-color: #333;
    --bs-border-color: #eee;
    --bs-border-color-translucent: rgba(0, 0, 0, 0.1);
}

.btn-link {
    border-radius: 0;
    padding: 0.25rem 0.5rem;
    font-weight: normal;
    text-transform: none;
    opacity: 0.5;
    font-size: 0.75rem;
}

.btn-link:hover {
    opacity: 0.8;
}

.btn-link i {
    font-size: 0.75rem;
}

/* Enhanced Chapter Card Design */
.chapter-card {
    transition: all 0.3s ease;
    margin-bottom: 2rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.chapter-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #6366f1;
    transform: translateY(-2px);
}

/* Chapter Card Header */
.chapter-card-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.chapter-number-badge {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.chapter-number-badge i {
    opacity: 0.9;
}

.chapter-actions {
    display: flex;
    align-items: center;
}

.chapter-actions .btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: 500;
    transition: all 0.2s ease;
}

.chapter-actions .btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: translateY(-1px);
}

.chapter-actions .btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
}

/* Chapter Card Body */
.chapter-card-body {
    padding: 1.5rem;
    background: #ffffff;
}

/* Collapsible chapter body - ensure inline styles take precedence */
.chapter-card .chapter-card-body {
    transition: all 0.3s ease;
}

.chapter-card .chapter-card-body[style*="display: none"] {
    display: none !important;
}

.chapter-card .chapter-card-body[style*="display: block"] {
    display: block !important;
}

.chapter-field-group {
    margin-bottom: 0.5rem;
}

.chapter-field-group:last-child {
    margin-bottom: 0;
}

.chapter-field-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.chapter-field-label i {
    color: #6366f1;
    width: 16px;
}

.chapter-title-input {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.chapter-title-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: #ffffff;
}

.chapter-summary-input {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
    transition: all 0.2s ease;
    background: #f9fafb;
    resize: vertical;
    min-height: 100px;
}

.chapter-summary-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: #ffffff;
}

.chapter-field-divider {
    display: none;
}

/* Legacy support for existing chapter styles */
.chapter-content {
    padding: 1rem;
    font-family: Georgia, serif;
    line-height: 1.8;
    color: #333;
    text-align: justify;
    hyphens: auto;
    overflow-wrap: break-word;
    font-size: 1.05rem;
}

.chapter-summary {
    font-style: italic;
    color: #666;
    padding: 0.75rem 1rem;
    border-left: 3px solid #ccc;
    background-color: #f8f9fa;
    margin-bottom: 0;
    font-size: 0.95rem;
}

.chapter-status {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

/* Simplified Chapter Header Styles */
.chapter-header-simple {
    margin-bottom: 1.5rem;
}

.chapter-description-only {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 0;
    line-height: 1.6;
    text-align: center;
}

/* Chapter Action Buttons Row */
.chapter-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.btn-chapter-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-chapter-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.btn-chapter-action i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* AI Generation Panel */
.ai-generation-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(139, 92, 246, 0.04) 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    padding: 1.125rem 1.25rem;
    margin-bottom: 1.5rem;
}

.ai-panel-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Research Add-on Card */
.research-addon-card {
    background: #ffffff;
    border: 2px dashed rgba(14, 165, 233, 0.35);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.875rem;
}

.research-addon-card:hover {
    border-color: rgba(14, 165, 233, 0.6);
    background: rgba(14, 165, 233, 0.03);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.research-addon-card.selected {
    border-color: #0ea5e9;
    border-style: solid;
    background: rgba(14, 165, 233, 0.06);
    box-shadow: 0 2px 12px rgba(14, 165, 233, 0.15);
}

.research-addon-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}

.research-addon-header .custom-checkbox-sm {
    margin-top: 2px;
    flex-shrink: 0;
}

.research-addon-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    flex: 1;
}

.research-addon-title strong {
    color: #0369a1;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.research-cost-badge {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.18) 0%, rgba(6, 182, 212, 0.18) 100%);
    color: #0284c7;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.research-addon-benefits {
    padding-left: 2rem;
    margin-top: 0.25rem;
}

.research-addon-benefits ul {
    padding-left: 0;
    list-style: none;
    margin-bottom: 0;
}

.research-addon-benefits li {
    font-size: 0.825rem;
    color: #4b5563;
    padding: 0.2rem 0;
    line-height: 1.4;
}

.research-addon-benefits li i {
    font-size: 0.7rem;
    margin-right: 0.375rem;
}

/* Token Confirmation Section */
.token-confirmation-section {
    background: #ffffff;
    border: 2px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    padding: 0.875rem 1.25rem;
}

.token-confirmation-section .custom-checkbox-container {
    gap: 0.75rem;
}

.token-confirmation-section .checkbox-label {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.45;
}

/* Custom Checkbox Implementation */
.custom-checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem;
    user-select: none;
}

.custom-checkbox {
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid #6366f1;
    border-radius: 4px;
    background-color: #ffffff;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.custom-checkbox.checked {
    background-color: #6366f1;
    border-color: #6366f1;
}

.custom-checkbox:hover {
    border-color: #8b5cf6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.checkbox-check {
    color: white;
    font-size: 0.8rem;
}

.checkbox-label {
    color: #333;
    font-size: 0.85rem;
    line-height: 1.1;
}

/* Research Option Styling */
.research-option-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    user-select: none;
    background: rgba(14, 165, 233, 0.08);
    border-radius: 4px;
    border: 1px dashed rgba(14, 165, 233, 0.3);
    transition: all 0.2s ease;
}

.research-option-container:hover {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.5);
}

.research-option-container .custom-checkbox-sm {
    width: 1rem;
    height: 1rem;
    border: 2px solid #0ea5e9;
    border-radius: 3px;
    background-color: #ffffff;
    margin-right: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.research-option-container .custom-checkbox-sm.checked {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
}

.research-option-container .custom-checkbox-sm .checkbox-check {
    font-size: 0.6rem;
}

.research-option-container .checkbox-label {
    font-size: 0.75rem;
    color: #374151;
}

/* Manual Actions Column */
.manual-actions-column {
    display: flex;
    flex-direction: column;
}

.manual-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 110px;
}

.btn-balanced {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-balanced:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-balanced i {
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

.btn-balanced .button-title {
    font-size: 1rem;
    margin-bottom: 0;
    display: inline;
    font-weight: 500;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .chapter-action-buttons {
        flex-direction: column;
    }
    
    .btn-chapter-action {
        width: 100%;
    }
    
    .ai-generation-panel {
        padding: 0.875rem 1rem;
    }
    
    .research-addon-benefits {
        padding-left: 1.25rem;
    }
    
    .research-addon-benefits li {
        font-size: 0.75rem;
    }
}

/* Toggle lock button styling */
.toggle-lock-btn {
    transition: all 0.3s ease;
}

.toggle-lock-btn:hover {
    transform: scale(1.05);
}

/* Toast notifications */
#toast-container {
    z-index: 1080;
}

#toast-container .toast {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    opacity: 0.95;
}

/* Complete eBook status section */
.progress {
    height: 1.5rem;
    font-size: 0.8rem;
    border-radius: 2rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
    background-color: #4caf50;
}

/* Finalize book section */
.finalize-section {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Better looking status badges */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 30px;
    font-weight: normal;
    font-size: 0.8rem;
}

.badge.bg-success {
    background-color: #4caf50 !important;
}

.badge.bg-warning {
    background-color: #ff9800 !important;
    color: #fff !important;
}

.badge.bg-info {
    background-color: #2196f3 !important;
}

/* Animation for generation content - Claude.ai style */
@keyframes typing-cursor {
    0% { border-color: #e95800; }
    50% { border-color: transparent; }
    100% { border-color: #e95800; }
}

/* Animated cursor effect (blink) - Claude.ai style */
.typing-animation {
    display: inline-block;
    border-right: 4px solid #e95800;
    padding-right: 3px;
    margin-right: 1px;
    animation: typing-cursor 0.7s infinite;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Georgia, serif;
    line-height: 1.5;
}

/* Wrap the typing animation span to ensure proper text wrapping */
span.typing-animation {
    max-width: 100%;
    display: inline-block;
}

/* Animation for new content appearing */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Apply fade-in animation to newly added content */
.new-content {
    animation: fade-in 0.4s ease-in-out;
}

/* Claude.ai shimmering effect at end of text */
@keyframes claude-shimmer {
    0% { 
        opacity: 0.2; 
        transform: translateX(-40px);
        background: linear-gradient(90deg, 
                                  rgba(233, 88, 0, 0) 0%, 
                                  rgba(233, 88, 0, 0.15) 50%, 
                                  rgba(233, 88, 0, 0) 100%);
    }
    50% { 
        opacity: 0.4; 
        transform: translateX(0);
        background: linear-gradient(90deg, 
                                  rgba(233, 88, 0, 0) 0%, 
                                  rgba(233, 88, 0, 0.25) 50%, 
                                  rgba(233, 88, 0, 0) 100%);
    }
    100% { 
        opacity: 0.2; 
        transform: translateX(40px);
        background: linear-gradient(90deg, 
                                  rgba(233, 88, 0, 0) 0%, 
                                  rgba(233, 88, 0, 0.15) 50%, 
                                  rgba(233, 88, 0, 0) 100%);
    }
}

/* Smooth character-by-character animation effect */
@keyframes char-appear {
    from { opacity: 0; transform: translateY(1px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Class to apply to characters as they appear */
.char-appearing {
    animation: char-appear 0.1s ease-out forwards;
    display: inline-block;
}

/* Enhanced Claude.ai cursor animation - more pronounced */
.cursor-blink {
    display: inline-block;
    width: 3px;
    height: 18px;
    background-color: #e95800;
    margin-left: 1px;
    vertical-align: middle;
    animation: typing-cursor 0.7s infinite;
}

/* Make inline generation container look like Claude.ai */
#inline-generation-container {
    position: relative;
    z-index: 10;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: #fff;
    margin: 2rem 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

/* Add a subtle glow to the generation container when active */
#inline-generation-container.generating {
    box-shadow: 0 0.5rem 2rem rgba(233, 88, 0, 0.1);
    border: 1px solid rgba(233, 88, 0, 0.15);
}

/* Style the header to look more like Claude.ai */
#inline-generation-container .card-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Style the generation title */
#inline-generation-container .card-header h5 {
    font-weight: 600;
    margin: 0;
    font-size: 1.05rem;
    color: #333;
}

/* Style the status text for better readability */
#inline-status-text {
    font-size: 0.9rem;
    color: #555;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
}

/* Style the content display area */
.book-display-container {
    transition: all 0.3s ease;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    padding: 3rem 4rem;
    font-family: 'Georgia', serif;
    line-height: 1.8;
    font-size: 1.1rem;
    color: #333;
    position: relative;
    background-color: #fffef7; /* Improved cream background like book paper */
    border-left: 1px solid #e8e0d0;
    border-right: 1px solid #e8e0d0;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.07);
    /* Add book-like scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
    /* Add subtle paper texture */
    background-image: url("data:image/png;base64,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");
    /* Add page styling */
    position: relative;
}

/* Add page effect with a slight shadow on the side */
.book-display-container:before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.02), rgba(0,0,0,0.07));
    z-index: 1;
}

/* Add book binding effect on the left */
.book-display-container:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.07), rgba(0,0,0,0.02));
    z-index: 1;
}

/* Book format container styling */
.book-format-container {
    position: relative;
    font-family: 'Georgia', serif;
    line-height: 1.8;
    color: #333;
    margin-bottom: 1rem;
    padding: 2rem 3rem;
    background-color: #fffdf7;
    background-image: 
        linear-gradient(to right, rgba(0,0,0,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 2px;
    box-shadow: 
        0 1px 3px rgba(0,0,0,0.1),
        0 10px 20px rgba(0,0,0,0.05),
        inset 0 0 30px rgba(200, 175, 150, 0.1);
}

/* Container wrapping */
.book-display-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 0 0.5rem;
    position: relative;
    transition: all 0.3s ease;
    /* Book page edge effect */
    border-right: 1px solid rgba(0,0,0,0.05);
    background: linear-gradient(to right, rgba(0,0,0,0.02) 0%, transparent 5%);
    /* Add page edge effect on the right side */
    box-shadow: 
        inset -7px 0 9px -7px rgba(0,0,0,0.1),
        inset 7px 0 9px -7px rgba(0,0,0,0.05);
}

/* Maintain ID selector for JavaScript compatibility */
#inline-content-display {
    transition: all 0.3s ease;
}

/* Enhance scrollbar styling for WebKit browsers */
.book-display-container::-webkit-scrollbar {
    width: 8px;
}

.book-display-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.book-display-container::-webkit-scrollbar-thumb {
    background-color: rgba(139, 69, 19, 0.15);
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.01);
}

/* For backwards compatibility */
#inline-content-display::-webkit-scrollbar {
    width: 8px;
}

#inline-content-display::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

#inline-content-display::-webkit-scrollbar-thumb {
    background-color: rgba(139, 69, 19, 0.15);
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.01);
}

/* Add a smooth transition when content changes */
#inline-content-display {
    animation: content-fade-in 0.3s ease-out;
}

@keyframes content-fade-in {
    from { opacity: 0.9; }
    to { opacity: 1; }
}

/* Style the paragraphs in the content display */
#inline-content-display p,
#inline-content-display .book-paragraph {
    margin-bottom: 1.5rem;
    text-align: justify;
    text-indent: 2em;
    hyphens: auto;
    line-height: 1.8;
    font-size: 1.05rem;
    color: #333;
    letter-spacing: 0.01rem;
    word-spacing: 0.05rem;
    font-kerning: normal;
}

/* First paragraph after headings doesn't need indentation */
#inline-content-display h1 + p,
#inline-content-display h2 + p,
#inline-content-display h3 + p,
#inline-content-display .book-chapter-title + p,
#inline-content-display .book-section-title + p,
#inline-content-display .book-subsection-title + p {
    text-indent: 0;
}

/* Style lists */
#inline-content-display ul,
#inline-content-display ol,
#inline-content-display .book-list {
    margin: 1.2rem 0 1.5rem 2rem;
    padding-left: 1rem;
}

#inline-content-display ul li,
#inline-content-display ol li,
#inline-content-display .book-list li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Style blockquotes */
#inline-content-display blockquote,
#inline-content-display .book-quote {
    margin: 1.5rem 2rem;
    padding: 1rem 1.5rem;
    border-left: 3px solid #e0e0e0;
    font-style: italic;
    color: #555;
    background-color: rgba(0,0,0,0.02);
}

/* Style code blocks */
#inline-content-display pre,
#inline-content-display .book-code-block {
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1rem;
    margin: 1.5rem 0;
    font-family: monospace;
    font-size: 0.9em;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Style inline code */
#inline-content-display code,
#inline-content-display .book-inline-code {
    background-color: #f8f8f8;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85em;
    color: #d63384;
}

/* Style new markdown elements */
#inline-content-display mark {
    background-color: rgba(255, 235, 59, 0.3);
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}

#inline-content-display kbd {
    background-color: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    color: #333;
    display: inline-block;
    font-family: monospace;
    font-size: 0.85em;
    padding: 0.1rem 0.5rem;
    margin: 0 0.2rem;
}

#inline-content-display abbr {
    text-decoration: underline dotted;
    cursor: help;
}

#inline-content-display .book-link {
    color: #1a0dab;
    text-decoration: none;
    border-bottom: 1px solid rgba(26, 13, 171, 0.2);
    transition: border-color 0.2s ease;
}

#inline-content-display .book-link:hover {
    border-bottom: 1px solid rgba(26, 13, 171, 0.8);
}

/* Style the last paragraph with a special class when generating */
#inline-content-display p:last-child {
    position: relative;
}

/* Style the headings in the content display */
#inline-content-display h1, 
#inline-content-display h2, 
#inline-content-display h3,
#inline-content-display .book-chapter-title,
#inline-content-display .book-section-title,
#inline-content-display .book-subsection-title {
    margin-top: 2rem;
    margin-bottom: 1.2rem;
    font-family: 'Georgia', serif;
    font-weight: bold;
    line-height: 1.3;
    color: #000;
}

#inline-content-display h1,
#inline-content-display .book-chapter-title {
    font-size: 2.2rem;
    text-align: center;
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

#inline-content-display h2,
#inline-content-display .book-section-title {
    font-size: 1.4rem;
    padding-bottom: 0.5rem;
}

#inline-content-display h3,
#inline-content-display .book-subsection-title {
    font-size: 1.2rem;
}

/* Style the first paragraph with a drop cap */
#inline-content-display p.first-paragraph:first-letter,
#inline-content-display p:first-of-type:first-letter {
    float: left;
    font-size: 4.2rem;
    line-height: 0.8;
    margin-right: 0.4rem;
    margin-top: 0.15rem;
    margin-bottom: 0.05rem;
    padding: 0.1rem 0.2rem;
    color: #000;
    font-family: 'Georgia', serif;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
    /* Subtle background for the drop cap */
    background: linear-gradient(to bottom, rgba(233, 88, 0, 0.05), transparent);
    border-radius: 3px;
}

/* Style superscript references like [1] */
#inline-content-display sup {
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
}

/* Add a subtle loading indicator at the bottom - Claude.ai style shimmer */
.generating #inline-content-display::after {
    content: "";
    display: block;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, 
                                rgba(233, 88, 0, 0) 0%, 
                                rgba(233, 88, 0, 0.3) 50%, 
                                rgba(233, 88, 0, 0) 100%);
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 1;
    animation: claude-shimmer 2s infinite ease-in-out;
}

/* Show the loading indicator when generating */
.generating #inline-content-display p:last-child::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 1.2em;
    border-right: 3px solid #e95800;
    animation: typing-cursor 0.8s infinite;
    margin-left: 4px;
    vertical-align: middle;
}

/* Claude.ai shimmer animation */
@keyframes claude-shimmer {
    0% { 
        transform: translateX(-100%);
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% { 
        transform: translateX(100%);
        opacity: 0.7;
    }
}

/* Blinking cursor animation */
@keyframes typing-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Claude.ai style container when actively generating */
.generating #inline-content-display {
    background-color: rgba(255, 253, 250, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: inset 0 0 15px rgba(233, 88, 0, 0.03);
}

/* Add a page turn animation when new text is added */
@keyframes page-turn {
    0% { 
        transform: translateY(10px);
        opacity: 0;
    }
    100% { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Apply the animation to new paragraphs being rendered */
#inline-content-display p.new-content {
    animation: page-turn 0.5s ease-out;
}

/* Animated progress bar that's more visible */
.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite !important;
}

.progress-bar-striped {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent) !important;
    background-size: 1rem 1rem !important;
}
/* Chapter generation status message */
.chapter-generation-status {
    font-size: 0.85rem;
    color: #495057;
    text-align: center;
    margin: 5px 0;
    font-style: italic;
}
