/* Sticky Notes System CSS */

/* Rich Text Formatting Toolbar */
.formatting-toolbar {
    position: absolute;
    top: -45px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px 6px 0 0;
    padding: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.formatting-toolbar.active {
    opacity: 1;
    visibility: visible;
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
}

.format-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.format-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.format-btn.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.format-btn.color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.format-btn.color-btn.color-black { background: #000; }
.format-btn.color-btn.color-red { background: #dc3545; }
.format-btn.color-btn.color-blue { background: #007bff; }

.format-btn.clear-format-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #6c757d;
    border: 1px solid rgba(0, 0, 0, 0.2);
    font-size: 14px;
    min-width: 28px;
    height: 28px;
}

.format-btn.clear-format-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
    color: #dc3545;
    transform: translateY(-1px);
}

.format-select {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 28px;
    min-width: 60px;
    outline: none;
}

.format-select:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
}

.format-select:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: rgba(0, 0, 0, 0.2);
    margin: 4px 2px;
}

/* Enhanced contenteditable styling */
.sticky-note-textarea,
.notebook-note-content {
    position: relative;
}

.sticky-note-textarea[contenteditable="true"],
.notebook-note-content[contenteditable="true"] {
    outline: none;
    min-height: 100px;
    padding: 12px;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sticky-note-textarea[contenteditable="true"]:focus,
.notebook-note-content[contenteditable="true"]:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Placeholder support for contenteditable */
.sticky-note-textarea[contenteditable="true"]:empty:before,
.notebook-note-content[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
}

.sticky-note-textarea[contenteditable="true"]:focus:empty:before,
.notebook-note-content[contenteditable="true"]:focus:empty:before {
    color: #ccc;
}

/* Ensure toolbar container positioning */
.sticky-note-content,
.notebook-note {
    position: relative;
}

/* Text Selection and Trigger */
.sticky-note-trigger {
    position: absolute;
    background: #ffd700;
    border: 1px solid #e6c200;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    display: none;
}

.sticky-note-trigger:hover {
    background: #ffed4e;
    transform: scale(1.05);
}

.sticky-note-trigger::before {
    content: "📝";
    margin-right: 4px;
}

/* Chapter Selection Dropdown */
.chapter-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    min-width: 200px;
    max-width: 300px;
    max-height: 250px;
    overflow-y: auto;
    background-color: #fff;
    display: none;
}

.chapter-dropdown-header {
    padding: 10px 15px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

/* Chapter Options */
.chapter-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.chapter-option:hover {
    background-color: #f5f5f5;
}

.chapter-option .chapter-name {
    font-weight: 500;
    margin-right: 10px;
    flex-grow: 1;
}

.chapter-option .chapter-name[data-editable="true"]:hover {
    cursor: text;
    background-color: #e9e9e9;
    border-radius: 3px;
}

.chapter-option .chapter-notes-count {
    font-size: 0.8em;
    color: #888;
    background-color: #eee;
    padding: 2px 6px;
    border-radius: 8px;
}

.chapter-option:last-child {
    border-bottom: none;
}

.chapter-option.create-new {
    background: #e8f5e8;
    color: #2d5a2d;
    font-weight: 500;
    border-top: 1px solid #d4e6d4;
    text-align: center;
    justify-content: center;
}

.chapter-option.create-new:hover {
    background-color: #ddeedd;
}

.chapter-option.create-new::before {
    content: "";
    margin-right: 0;
}

.chapter-option .chapter-notes-count {
    font-size: 0.8em;
    color: #888;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
}

/* Chapter Preview (80-90% transparent) */
.chapter-preview {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 16px;
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0.8;
    pointer-events: auto;
    cursor: pointer;
    display: none;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.chapter-preview.show {
    display: block !important;
}

.chapter-preview:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

/* Chapter Preview Header */
.chapter-preview-header {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chapter Preview Notes */
.chapter-preview-note {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 6px;
    border-left: 3px solid #007bff;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chapter-preview-note:hover {
    background: rgba(248, 249, 250, 1);
    border-left-color: #0056b3;
}

.chapter-preview-note:last-of-type {
    margin-bottom: 12px;
}

/* Add Note Block */
.chapter-preview-add-note {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(232, 245, 232, 0.8);
    border: 2px dashed #28a745;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.chapter-preview-add-note:hover {
    background: rgba(232, 245, 232, 1);
    border-color: #1e7e34;
    transform: translateY(-1px);
}

.add-note-icon {
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 50%;
}

.add-note-text {
    font-size: 12px;
    color: #28a745;
    font-weight: 500;
}

/* Create New Chapter Form */
.create-chapter-form {
    padding: 16px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.create-chapter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 8px;
}

.create-chapter-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.create-chapter-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-create-chapter {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-create-chapter:hover {
    background: #45a049;
}

.btn-cancel-chapter {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-cancel-chapter:hover {
    background: #5a6268;
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Selection Highlighting */
.sticky-note-selection {
    background: rgba(255, 215, 0, 0.3) !important;
    transition: background-color 0.2s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chapter-dropdown {
        min-width: 250px;
        max-width: 90vw;
    }
    
    .chapter-preview {
        max-width: 90vw;
        max-height: 50vh;
    }
    
    .sticky-note-trigger {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Animation for dropdown appearance */
.chapter-dropdown.show {
    display: block !important;
    animation: slideDown 0.2s ease;
}

.chapter-preview.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.9;
    }
}

/* Error States */
.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 13px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 13px;
} 

/* Full Sticky Note Display */
.full-sticky-note {
    position: fixed;
    width: 450px;
    max-height: 500px;
    min-height: 250px;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    z-index: 10002;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    transition: all 0.3s ease;
    overflow: hidden;
    border-left: 6px solid #4a90e2;
}

.full-sticky-note.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    display: flex;
    flex-direction: column;
}

.notebook-tab {
    position: absolute;
    left: -30px;
    top: 20px;
    width: 120px;
    height: 40px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px 0 0 6px;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    transform: rotate(-90deg);
    transform-origin: right center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-note-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd) !important;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid #2c5282;
    flex-shrink: 0;
    min-height: 60px;
    position: relative;
    z-index: 10003;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sticky-note-chapter {
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
}

.sticky-note-chapter::before {
    content: "📖";
    margin-right: 8px;
    font-size: 18px;
}

/* Sticky note close button styles moved to controls section */

.sticky-note-content {
    padding: 20px 24px;
    font-size: 15px;
    line-height: 1.6;
    color: #2d3748;
    max-height: calc(500px - 80px);
    overflow-y: auto;
    word-wrap: break-word;
    flex: 1;
    background: #ffffff;
    position: relative;
}

.sticky-note-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50px;
    width: 1px;
    height: 100%;
    background: #e2e8f0;
    z-index: 1;
}

.sticky-note-content::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 23px,
        #f7fafc 23px,
        #f7fafc 25px
    );
    z-index: 1;
    pointer-events: none;
}

.sticky-note-textarea {
    width: 100%;
    min-height: 180px;
    border: none;
    background: transparent;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 15px;
    line-height: 25px;
    color: #2d3748;
    resize: vertical;
    outline: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
    padding-left: 60px;
}

.sticky-note-textarea:focus {
    background: rgba(74, 144, 226, 0.05);
    border-radius: 4px;
    padding-left: 60px;
    padding-top: 4px;
    padding-bottom: 4px;
    padding-right: 8px;
} 

/* Full Notebook Interface - Redesigned to look like a physical notebook */
.full-notebook {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 1000px;
    height: 85vh;
    max-height: 700px;
    background: #fdfaf2; /* Creamy paper background */
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
    z-index: 10003;
    display: none;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 1px solid #dcd1b4;
}

.full-notebook.show {
    display: flex; /* Changed from block to flex */
    flex-direction: row; /* Horizontal layout */
    animation: fadeIn 0.3s ease-in-out;
}

/* Notebook Drag Header */
.notebook-drag-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(0, 0, 0, 0.02);
    cursor: move;
    z-index: 10004;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.notebook-drag-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.drag-handle-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.drag-handle-area::before {
    content: "⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮";
    color: rgba(0, 0, 0, 0.15);
    font-size: 12px;
    letter-spacing: 2px;
    pointer-events: none;
}

.notebook-drag-header:hover .drag-handle-area::before {
    color: rgba(0, 0, 0, 0.25);
}

/* Remove the old notebook header */
.notebook-header {
    display: none;
}

.notebook-content {
    display: flex;
    flex-direction: row; /* Ensure horizontal layout */
    width: 100%;
    height: 100%; /* Override old height calc */
    padding-top: 40px; /* Account for drag header */
}

/* Sidebar as Chapter Tabs */
.notebook-sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    flex-shrink: 0;
    background: #f7f2e8;
    border-right: 1px solid #dcd1b4;
    padding: 20px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.notebook-sidebar h4 {
    padding: 0 20px;
    margin-bottom: 15px;
    color: #8c7b5a;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
}

.chapters-list {
    flex-grow: 1;
}

.chapter-item {
    padding: 12px 20px 12px 30px;
    margin: 0;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    border: none;
    border-left: 6px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-item:hover {
    background: #f0e9d9;
}

.chapter-item.active {
    background: #fff;
    border-left-color: #e57373; /* Red tab marker */
    font-weight: 600;
    box-shadow: inset 5px 0 15px -10px rgba(0,0,0,0.2);
}

.chapter-item .chapter-name {
    color: #5d4037;
}

.chapter-item .chapter-count {
    font-size: 12px;
    background: #e0d8c5;
    color: #5d4037;
    border-radius: 12px;
    padding: 2px 8px;
}

.add-chapter-btn {
    margin: 20px;
    padding: 10px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-chapter-btn:hover {
    background: #45a049;
}

.export-pdf-btn {
    margin: 10px 20px;
    padding: 10px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    width: calc(100% - 40px);
    font-size: 14px;
}

.export-pdf-btn:hover {
    background: #1976d2;
}

/* Create Chapter Form in Notebook */
.create-chapter-form-notebook {
    margin: 15px 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #e0d8c5;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(5px);
}

.create-chapter-input-notebook {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dcd1b4;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Georgia', serif;
    font-weight: normal;
    background: rgba(255, 255, 255, 0.9);
    color: #444;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    line-height: 1.4;
}

.create-chapter-input-notebook:focus {
    outline: none;
    border-color: #4caf50;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.create-chapter-input-notebook::placeholder {
    color: #aaa;
    font-style: italic;
    font-weight: normal;
}

.create-chapter-buttons-notebook {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.btn-create-chapter-notebook {
    background: #4caf50;
    color: white;
    border: none;
    padding: 7px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

.btn-create-chapter-notebook:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.3);
}

.btn-cancel-chapter-notebook {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: 1px solid #ddd;
    padding: 7px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel-chapter-notebook:hover {
    background: rgba(108, 117, 125, 0.15);
    border-color: #6c757d;
    color: #5a6268;
}

/* Main notes area */
.notebook-main {
    flex: 1;
    min-width: 0;
    padding: 20px 30px 20px 60px; /* Extra padding on left for margin line */
    overflow-y: auto;
    background-image: repeating-linear-gradient(#fdfaf2, #fdfaf2 23px, #d1e7fd 24px, #d1e7fd 24px); /* Blue lines */
    background-size: 100% 24px;
    position: relative;
    line-height: 24px;
}

/* Red margin line */
.notebook-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 45px;
    bottom: 0;
    width: 1px;
    background-color: #ffcdd2;
}

.current-chapter-header {
    background-color: transparent;
    border: none;
    padding: 0 0 20px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0d8c5;
}

.current-chapter-header h4 {
    font-family: 'Georgia', serif;
    font-size: 28px;
    color: #444;
    font-weight: normal;
}

.notes-container {
    font-family: 'Georgia', serif;
    color: #333;
}

.notebook-note {
    background-color: transparent;
    border: none;
    padding: 10px 0;
    margin-bottom: 10px;
}

.notebook-note-content {
    min-height: 24px; /* Align with line height */
}

.notebook-note-content[contenteditable="true"] {
    outline: none;
    background-color: rgba(255, 251, 237, 0.8);
    border-radius: 4px;
}

.notebook-note.highlighted {
    background-color: rgba(255, 248, 180, 0.6);
}

.add-note-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #c5b9a0;
}

.add-note-textarea {
    width: 100%;
    min-height: 72px; /* 3 lines */
    border: 1px solid #dcd1b4;
    border-radius: 4px;
    background-color: #fff;
    padding: 10px;
    line-height: 24px;
    font-family: 'Georgia', serif;
}

.add-note-btn {
    margin-top: 10px;
    background: #4caf50;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

/* Close button for the notebook */
.notebook-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 35px;
    height: 35px;
    background: rgba(220, 53, 69, 0.4);
    color: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10004;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    opacity: 0.6;
    transform: scale(0.8);
    /* Ensure the entire button area is clickable */
    padding: 0;
    margin: 0;
    outline: none;
    user-select: none;
    /* Add invisible padding around the button for easier clicking */
    box-sizing: content-box;
}

.notebook-close-btn:hover {
    background: rgba(220, 53, 69, 0.95);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.2);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    opacity: 1;
    font-size: 20px;
}

/* Add a larger invisible clickable area around the close button */
.notebook-close-btn::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: transparent;
    border-radius: 50%;
    z-index: -1;
}

/* Minimized notebook icon */
.minimized-notebook-icon {
    position: fixed;
    left: 20px;
    bottom: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    z-index: 10000;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.minimized-notebook-icon.show {
    opacity: 1;
    transform: scale(1);
}

.minimized-notebook-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}

/* Sticky Note Controls */
.sticky-note-controls {
    display: flex !important;
    gap: 12px;
    position: relative;
    z-index: 10004;
    align-items: center;
}

.sticky-note-minimize {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10005;
    backdrop-filter: blur(10px);
}

.sticky-note-minimize:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.sticky-note-close {
    background: rgba(220, 53, 69, 0.8) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10005;
    backdrop-filter: blur(10px);
}

.sticky-note-close:hover {
    background: rgba(220, 53, 69, 1) !important;
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

/* Minimized Sticky Note */
.minimized-sticky-note {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border: 2px solid #e6c200;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10002;
    width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideInLeft 0.3s ease;
}

.minimized-sticky-note:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.minimized-note-header {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.minimized-note-chapter {
    font-weight: 600;
    font-size: 12px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.minimized-note-close {
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.minimized-note-close:hover {
    background: #dc3545;
    transform: scale(1.1);
}

.minimized-note-preview {
    padding: 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Animation for minimized note */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%) translateY(-50%);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(-50%);
        opacity: 1;
    }
} 

.full-notebook .current-chapter-header h4[data-editable="true"],
.full-notebook .chapter-item .chapter-name {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease-in-out;
}

.full-notebook .current-chapter-header h4[data-editable="true"]:hover,
.full-notebook .chapter-item:hover .chapter-name {
    background-color: #e0e0e0;
}

.full-notebook .notes-container {
    flex-grow: 1;
    padding: 20px;
} 