body {
    background-color: #f9f9f9;
}

h1 {
    font-family: Arial, sans-serif;
    font-size: 2.5rem;
    color: #007bff;
}

.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    padding-top: 30px;
    z-index: 1000;
}

.chat-popup {
    width: 90%;
    /*max-width: 900px;*/
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.chat-popup .card-body {
    /*max-height: 75vh;*/
    overflow: hidden; /* Change from overflow-y: auto */
    display: flex;
    flex-direction: column;
}

.chat-output {
    flex: 1;
    min-height: 200px;
    max-height: none;
    overflow-y: auto; /* Add scrolling to chat output only */
    padding-bottom: 20px; /* Space above input area */
}

/* Add this for the input area */
.chat-input-area {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 15px 0;
    border-top: 1px solid #e9ecef;
    margin-top: auto; /* Push to bottom */
}

.inlinecode {
    font-family: 'Courier New', monospace;
    font-size: 1em;
    color: #0000ff;
    border: 1px solid #e9ecef;
    /*font-weight: 600;*/
}

pre code {
    background-color: #f8f9fa;
    /*border: 1px solid #e9ecef;*/
    border-radius: 6px;
    /*padding: 16px;*/
    display: block;
    overflow-x: auto;
}

/* Style AI-generated lists */
.chat-output li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.user-message pre code,
.inputbackground {
    /*background-color: #d1e4f7;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;*/
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", 
  "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", 
  "Segoe UI Symbol", "Noto Color Emoji" !important;
    white-space: pre-wrap;
}

.ai-message pre code {
    background-color: #e9f7e9;
    border: 1px solid #b8e7cd;
    border-radius: 6px;
    padding: 16px;
    margin: 8px 0;
    overflow-x: auto;
    white-space: pre-wrap;
}

.chat-output pre {
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
    font-size: 16px;
    line-height: 1.4;
}

.chat-output code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* Style AI-generated ordered lists */
.chat-output ol {
    padding-left: 20px;
    margin-bottom: 16px;
}

.chat-output ol li {
    margin-bottom: 8px;
    padding-left: 10px;
}

/* Style AI-generated unordered lists */
.chat-output ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

/* Style AI-generated paragraphs */
.chat-output p {
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Style AI-generated strong/bold text */
.chat-output strong {
    color: #495057;
    font-weight: 600;
}

.chat-output ol li {
    list-style-type: decimal;
    list-style-position: inside;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
}

.user-message {
    /*background-color: #e6f2ff; /* Light blue for user messages */
    border: 1px solid #75a5ec;
    border-radius: 6px;
    padding: 10px 15px;
    margin: 8px 0;
}

.ai-message {
    /*background-color: #e6f2ff; /* Light blue for user messages */
    border: 1px solid #8aec90;
    border-radius: 6px;
    padding: 10px 15px;
    margin: 8px 0;
}

.book-chat-container {
    /*max-width: 900px;*/
    margin: 20px auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    background-color: #fff;
}

.chat-output {
    max-height: 60vh; /* Make chat output scrollable */
    overflow-y: auto;
    padding: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.chat-input-area {
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.search-result-card {
    border-radius: 8px;
    margin-bottom: 10px;
}

.subchapter {
    margin-top: 30px;
}