/* 完整样式代码 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #4a6fa5;
    color: white;
    padding: 1rem;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    flex: 1;
    text-align: center;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
}

.header-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.header-btn:hover {
    background: rgba(255,255,255,0.3);
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.sidebar-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.btn {
    padding: 0.5rem 1rem;
    background: #4a6fa5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0.25rem;
    transition: background 0.2s;
}

.btn:hover {
    background: #3a5f95;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.bookshelf {
    flex: 1;
    overflow-y: auto;
}

.book-card {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.book-card:hover {
    background: #e9ecef;
    border-color: #4a6fa5;
}

.book-card.selected {
    background: #e8f4e8;
    border-color: #4a6fa5;
}

.book-title {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.book-info {
    font-size: 0.8rem;
    color: #666;
}

.micro-review {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    margin-top: 0.25rem;
    padding: 0.25rem;
    background: rgba(0,0,0,0.03);
    border-radius: 2px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.reading-area {
    height: 50%;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.reading-header {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reading-controls {
    display: flex;
    gap: 0.5rem;
}

.content-area {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.chat-area {
    height: 50%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    max-width: 80%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ai-message {
    background: #4a6fa5;
    color: white;
    align-self: flex-start;
}

.user-message {
    background: #28a745;
    color: white;
    align-self: flex-end;
}

.chat-input-area {
    padding: 0.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.status-bar {
    background: #333;
    color: white;
    padding: 0.25rem 1rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
}

.empty-state {
    text-align: center;
    color: #888;
    padding: 2rem;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group small {
    color: #666;
    font-size: 0.8rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-group input {
    width: auto;
}

.modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1rem;
}

.tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab.active {
    border-bottom-color: #4a6fa5;
    color: #4a6fa5;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.typing-indicator {
    display: inline-block;
    color: rgba(255,255,255,0.7);
    font-style: italic;
    font-size: 0.85rem;
}

.preset-prompt {
    background: #f0f0f0;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.preset-prompt:hover {
    background: #e0e0e0;
}
