/* Rich Text Editor Toolbar Styles */
#formattingToolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border-right: 1px solid #dee2e6;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: #dee2e6;
    border-color: #6c757d;
}

.toolbar-select {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    height: 32px;
}

.toolbar-select:hover {
    border-color: #adb5bd;
}

.toolbar-select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

input[type="color"].toolbar-color {
    width: 32px;
    height: 32px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

input[type="color"].toolbar-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"].toolbar-color::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

/* Rich Text Editor Area */
#note[contenteditable="true"] {
    min-height: calc(100vh - 180px);
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #212529;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
}

#note[contenteditable="true"]:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#note[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #6c757d;
    font-style: italic;
}

/* Dark Mode Support */
body.dark #formattingToolbar {
    background: #2d3748;
    border-bottom-color: #4a5568;
}

body.dark .toolbar-btn {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

body.dark .toolbar-btn:hover {
    background: #718096;
    border-color: #a0aec0;
}

body.dark .toolbar-btn:active,
body.dark .toolbar-btn.active {
    background: #a0aec0;
    border-color: #cbd5e0;
}

body.dark .toolbar-select {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

body.dark .toolbar-group {
    border-right-color: #4a5568;
}

body.dark #note[contenteditable="true"] {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

body.dark #note[contenteditable="true"]:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 0.2rem rgba(66, 153, 225, 0.25);
}

/* Responsive Design */
@media (max-width: 768px) {
    #formattingToolbar {
        padding: 8px 10px;
        gap: 6px;
    }

    .toolbar-group {
        padding: 0 6px;
    }

    .toolbar-btn {
        padding: 5px 8px;
        font-size: 13px;
        min-width: 28px;
        height: 28px;
    }

    .toolbar-select {
        font-size: 13px;
        padding: 5px 6px;
        height: 28px;
    }

    input[type="color"].toolbar-color {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    #formattingToolbar {
        gap: 4px;
    }

    .toolbar-group {
        padding: 0 4px;
        gap: 3px;
    }

    .toolbar-btn {
        padding: 4px 6px;
        font-size: 12px;
        min-width: 26px;
        height: 26px;
    }
}