/* 学习笔记侧边栏 - Markdown */
#study-notes-fab {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 9998;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #4db8a4, #62c9b8);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(77, 184, 164, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}
#study-notes-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(77, 184, 164, 0.55);
}
#study-notes-fab.hidden { display: none; }

#study-notes-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    width: 400px;
    max-width: 92vw;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s ease;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#study-notes-panel.open { transform: translateX(0); }

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #4db8a4, #62c9b8);
    color: #fff;
    flex-shrink: 0;
}
.notes-header-title { font-size: 15px; font-weight: 600; }
.notes-header-close {
    background: rgba(255,255,255,0.2);
    border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 6px;
    cursor: pointer; font-size: 18px;
}
.notes-header-close:hover { background: rgba(255,255,255,0.35); }

.notes-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.notes-tab {
    padding: 5px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
}
.notes-tab:hover { border-color: #4db8a4; color: #2a7d6e; }
.notes-tab.active {
    background: #4db8a4;
    border-color: #4db8a4;
    color: #fff;
}
.notes-tab-dl { margin-left: auto; }

.notes-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#notes-content {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: #1f2937;
    background: #fafbfc;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}
#notes-content.hidden { display: none; }
#notes-content::placeholder { color: #9ca3af; font-family: inherit; }

.notes-preview {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.75;
    color: #1f2937;
    background: #fff;
}
.notes-preview.hidden { display: none; }
.notes-preview-empty { color: #9ca3af; font-style: italic; }
.notes-preview-raw {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 13px;
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
}

/* Markdown 预览样式 */
.notes-preview h1 { font-size: 1.4em; margin: 0.6em 0 0.4em; color: #1f2937; border-bottom: 2px solid #4db8a4; padding-bottom: 4px; }
.notes-preview h2 { font-size: 1.2em; margin: 0.8em 0 0.4em; color: #2a7d6e; }
.notes-preview h3 { font-size: 1.05em; margin: 0.6em 0 0.3em; color: #374151; }
.notes-preview p { margin: 0.5em 0; }
.notes-preview ul, .notes-preview ol { margin: 0.4em 0; padding-left: 1.5em; }
.notes-preview li { margin: 0.2em 0; }
.notes-preview code {
    background: #edf9f5;
    color: #2a7d6e;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', Consolas, monospace;
}
.notes-preview pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.6em 0;
    font-size: 12px;
    line-height: 1.5;
}
.notes-preview pre code { background: none; color: inherit; padding: 0; }
.notes-preview blockquote {
    border-left: 3px solid #4db8a4;
    margin: 0.6em 0;
    padding: 4px 12px;
    color: #4b5563;
    background: #f0faf7;
    border-radius: 0 6px 6px 0;
}
.notes-preview table { border-collapse: collapse; width: 100%; margin: 0.6em 0; font-size: 13px; }
.notes-preview th, .notes-preview td { border: 1px solid #e5e7eb; padding: 6px 10px; }
.notes-preview th { background: #f3f4f6; }
.notes-preview a { color: #3a9e8c; }
.notes-preview hr { border: none; border-top: 1px solid #e5e7eb; margin: 1em 0; }

.notes-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}
#notes-status { font-size: 12px; color: #9ca3af; }
#notes-status.saved { color: #4db8a4; }
#notes-status.error { color: #ef4444; }
#notes-save-btn {
    padding: 6px 18px;
    border: none;
    border-radius: 6px;
    background: #4db8a4;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
#notes-save-btn:hover { background: #3a9e8c; }
#notes-save-btn:disabled { background: #d1d5db; cursor: not-allowed; }

body.notes-panel-open {
    margin-right: 400px;
    transition: margin-right 0.28s ease;
}

@media (max-width: 1024px) {
    body.notes-panel-open {
        margin-right: 0 !important;
    }
}
